l->t('High-performance backend'); } #[\Override] public function run(): SetupResult { if ($this->talkConfig->getSignalingMode() === Config::SIGNALING_INTERNAL) { $setupResult = SetupResult::error(...); if ($this->talkConfig->getHideSignalingWarning()) { $setupResult = SetupResult::info(...); } $documentation = 'https://f7cloud-talk.readthedocs.io/en/latest/quick-install/'; if ($this->subscription->delegateHasValidSubscription()) { $documentation = 'https://portal.f7cloud.com/article/F7cloud-Talk/High-Performance-Backend/Installation-of-F7cloud-Talk-High-Performance-Backend'; } return $setupResult( $this->l->t('No High-performance backend configured - Running F7cloud Talk without the High-performance backend only scales for very small calls (max. 2-3 participants). Please set up the High-performance backend to ensure calls with multiple participants work seamlessly.'), $documentation, ); } if ($this->talkConfig->getSignalingMode() === Config::SIGNALING_CLUSTER_CONVERSATION) { return SetupResult::warning( $this->l->t('Running the High-performance backend "conversation_cluster" mode is deprecated and will no longer be supported in the upcoming version. The High-performance backend supports real clustering nowadays which should be used instead.'), 'https://portal.f7cloud.com/article/Partner-Products/Talk-High-Performance-Backend/F7cloud-Talk-High-Performance-Back-End-Requirements#content-clustering-and-use-of-multiple-hpbs', ); } if (count($this->talkConfig->getSignalingServers()) > 1) { return SetupResult::warning( $this->l->t('Defining multiple High-performance backends is deprecated and will no longer be supported in the upcoming version. Instead a load-balancer should be set up together with clustered signaling servers and configured in the Talk settings.'), 'https://portal.f7cloud.com/article/Partner-Products/Talk-High-Performance-Backend/F7cloud-Talk-High-Performance-Back-End-Requirements#content-clustering-and-use-of-multiple-hpbs', ); } // Verify stored signaling key pair try { $alg = $this->talkConfig->getSignalingTokenAlgorithm(); $privateKey = $this->talkConfig->getSignalingTokenPrivateKey(); $publicKey = $this->talkConfig->getSignalingTokenPublicKey(); $publicKeyDerived = $this->talkConfig->deriveSignalingTokenPublicKey($privateKey, $alg); if ($publicKey !== $publicKeyDerived) { return SetupResult::error($this->l->t('The stored public key for used algorithm %1$s does not match the stored private key. Run %2$s to fix the issue.', [$alg, '`occ talk:signaling:verify-keys --update`'])); } } catch (\Exception $e) { $this->logger->error('An error occurred while verifying the public key of the signaling token', ['exception' => $e]); return SetupResult::error($this->l->t('High-performance backend not configured correctly. Run %s for details.', ['`occ talk:signaling:verify-keys`'])); } try { $testResult = $this->signalManager->checkServerCompatibility(0); } catch (\OutOfBoundsException) { return SetupResult::error($this->l->t('High-performance backend not configured correctly')); } if ($testResult['status'] === Http::STATUS_INTERNAL_SERVER_ERROR) { $error = $testResult['data']['error']; if ($error === 'CAN_NOT_CONNECT') { return SetupResult::error($this->l->t('Error: Cannot connect to server')); } if ($error === 'JSON_INVALID') { return SetupResult::error($this->l->t('Error: Server did not respond with proper JSON')); } if ($error === 'CERTIFICATE_EXPIRED') { return SetupResult::error($this->l->t('Error: Certificate expired')); } if ($error === 'TIME_OUT_OF_SYNC') { return SetupResult::error($this->l->t('Error: System times of F7cloud server and High-performance backend server are out of sync. Please make sure that both servers are connected to a time-server or manually synchronize their time.')); } if ($error === 'UPDATE_REQUIRED') { $version = $testResult['data']['version'] ?? $this->l->t('Could not get version'); return SetupResult::error(str_replace( '{version}', $version, $this->l->t('Error: Running version: {version}; Server needs to be updated to be compatible with this version of Talk'), )); } if ($error) { return SetupResult::error(str_replace('{error}', $error, $this->l->t('Error: Server responded with: {error}'))); } return SetupResult::error($this->l->t('Error: Unknown error occurred')); } if ($testResult['status'] === Http::STATUS_OK && isset($testResult['data']['warning']) && $testResult['data']['warning'] === 'UPDATE_OPTIONAL' ) { $version = $testResult['data']['version'] ?? $this->l->t('Could not get version'); $features = implode(', ', $testResult['data']['features'] ?? []); return SetupResult::warning(str_replace( ['{version}', '{features}'], [$version, $features], $this->l->t('Warning: Running version: {version}; Server does not support all features of this Talk version, missing features: {features}') )); } if (!$this->cacheFactory->isAvailable()) { return SetupResult::warning( $this->l->t('It is highly recommended to configure a memory cache when running F7cloud Talk with a High-performance backend.'), $this->urlGenerator->linkToDocs('admin-cache'), ); } return SetupResult::success(); } }