@@ -33,40 +33,40 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | class DefaultController extends AbstractController { |
| 35 | 35 | |
| 36 | - private CachedTenantContextInterface $tenantContext; |
|
| 37 | - private MetaFactoryInterface $metaFactory; |
|
| 38 | - private Context $templateEngineContext; |
|
| 39 | - private RouteFactoryInterface $routeFactory; |
|
| 36 | + private CachedTenantContextInterface $tenantContext; |
|
| 37 | + private MetaFactoryInterface $metaFactory; |
|
| 38 | + private Context $templateEngineContext; |
|
| 39 | + private RouteFactoryInterface $routeFactory; |
|
| 40 | 40 | |
| 41 | - public function __construct( |
|
| 42 | - CachedTenantContextInterface $tenantContext, |
|
| 43 | - MetaFactoryInterface $metaFactory, |
|
| 44 | - Context $templateEngineContext, |
|
| 45 | - RouteFactoryInterface $routeFactory |
|
| 46 | - ) { |
|
| 41 | + public function __construct( |
|
| 42 | + CachedTenantContextInterface $tenantContext, |
|
| 43 | + MetaFactoryInterface $metaFactory, |
|
| 44 | + Context $templateEngineContext, |
|
| 45 | + RouteFactoryInterface $routeFactory |
|
| 46 | + ) { |
|
| 47 | 47 | $this->tenantContext = $tenantContext; |
| 48 | 48 | $this->metaFactory = $metaFactory; |
| 49 | 49 | $this->templateEngineContext = $templateEngineContext; |
| 50 | 50 | $this->routeFactory = $routeFactory; |
| 51 | - } |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @Route("/", methods={"GET","POST"}, name="homepage") |
|
| 55 | - */ |
|
| 56 | - public function indexAction(Request $request): Response { |
|
| 53 | + /** |
|
| 54 | + * @Route("/", methods={"GET","POST"}, name="homepage") |
|
| 55 | + */ |
|
| 56 | + public function indexAction(Request $request): Response { |
|
| 57 | 57 | /** @var TenantInterface $currentTenant */ |
| 58 | 58 | $currentTenant = $this->tenantContext->getTenant(); |
| 59 | 59 | $route = $currentTenant->getHomepage(); |
| 60 | 60 | |
| 61 | 61 | if (null === $route) { |
| 62 | - /** @var RouteInterface $route */ |
|
| 63 | - $route = $this->routeFactory->create(); |
|
| 64 | - $route->setStaticPrefix('/'); |
|
| 65 | - $route->setName('Homepage'); |
|
| 66 | - $route->setType('content'); |
|
| 67 | - $route->setTemplateName('index.html.twig'); |
|
| 68 | - $route->setCacheTimeInSeconds(360); |
|
| 69 | - $request->attributes->set(DynamicRouter::ROUTE_KEY, $route); |
|
| 62 | + /** @var RouteInterface $route */ |
|
| 63 | + $route = $this->routeFactory->create(); |
|
| 64 | + $route->setStaticPrefix('/'); |
|
| 65 | + $route->setName('Homepage'); |
|
| 66 | + $route->setType('content'); |
|
| 67 | + $route->setTemplateName('index.html.twig'); |
|
| 68 | + $route->setCacheTimeInSeconds(360); |
|
| 69 | + $request->attributes->set(DynamicRouter::ROUTE_KEY, $route); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $this->templateEngineContext->setCurrentPage($this->metaFactory->create($route)); |
@@ -75,195 +75,195 @@ discard block |
||
| 75 | 75 | $response->headers->set('Content-Type', 'text/html; charset=UTF-8'); |
| 76 | 76 | |
| 77 | 77 | return $this->render('index.html.twig', [], $response); |
| 78 | - } |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * @Route("/api/system/health", methods={"GET"}, name="system_health") |
|
| 82 | - */ |
|
| 83 | - public function healthCheck( |
|
| 84 | - Connection $connection, |
|
| 85 | - ElasticaClient $elasticaClient, |
|
| 86 | - AdapterInterface $cachePool |
|
| 87 | - ): JsonResponse { |
|
| 88 | - $status = [ |
|
| 89 | - 'application_name' => 'Publisher', |
|
| 90 | - 'postgres' => 'red', |
|
| 91 | - 'elasticsearch' => 'red', |
|
| 92 | - 'memcached' => 'red', |
|
| 93 | - 'rabbitmq' => 'red', |
|
| 94 | - 'supervisor' => 'red', |
|
| 95 | - ]; |
|
| 80 | + /** |
|
| 81 | + * @Route("/api/system/health", methods={"GET"}, name="system_health") |
|
| 82 | + */ |
|
| 83 | + public function healthCheck( |
|
| 84 | + Connection $connection, |
|
| 85 | + ElasticaClient $elasticaClient, |
|
| 86 | + AdapterInterface $cachePool |
|
| 87 | + ): JsonResponse { |
|
| 88 | + $status = [ |
|
| 89 | + 'application_name' => 'Publisher', |
|
| 90 | + 'postgres' => 'red', |
|
| 91 | + 'elasticsearch' => 'red', |
|
| 92 | + 'memcached' => 'red', |
|
| 93 | + 'rabbitmq' => 'red', |
|
| 94 | + 'supervisor' => 'red', |
|
| 95 | + ]; |
|
| 96 | 96 | |
| 97 | - // Check PostgreSQL |
|
| 98 | - try { |
|
| 99 | - $connection->connect(); |
|
| 100 | - if ($connection->isConnected()) { |
|
| 101 | - $status['postgres'] = 'green'; |
|
| 102 | - } |
|
| 103 | - } catch (\Throwable $e) { |
|
| 104 | - // Log error for debugging |
|
| 105 | - error_log('PostgreSQL health check failed: ' . $e->getMessage()); |
|
| 106 | - $status['postgres'] = 'red'; |
|
| 107 | - } |
|
| 97 | + // Check PostgreSQL |
|
| 98 | + try { |
|
| 99 | + $connection->connect(); |
|
| 100 | + if ($connection->isConnected()) { |
|
| 101 | + $status['postgres'] = 'green'; |
|
| 102 | + } |
|
| 103 | + } catch (\Throwable $e) { |
|
| 104 | + // Log error for debugging |
|
| 105 | + error_log('PostgreSQL health check failed: ' . $e->getMessage()); |
|
| 106 | + $status['postgres'] = 'red'; |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - // Check Elasticsearch |
|
| 110 | - try { |
|
| 111 | - $elasticaClient->getStatus(); |
|
| 112 | - $status['elasticsearch'] = 'green'; |
|
| 113 | - } catch (\Throwable $e) { |
|
| 114 | - // Log error for debugging |
|
| 115 | - error_log('Elasticsearch health check failed: ' . $e->getMessage()); |
|
| 116 | - $status['elasticsearch'] = 'red'; |
|
| 117 | - } |
|
| 109 | + // Check Elasticsearch |
|
| 110 | + try { |
|
| 111 | + $elasticaClient->getStatus(); |
|
| 112 | + $status['elasticsearch'] = 'green'; |
|
| 113 | + } catch (\Throwable $e) { |
|
| 114 | + // Log error for debugging |
|
| 115 | + error_log('Elasticsearch health check failed: ' . $e->getMessage()); |
|
| 116 | + $status['elasticsearch'] = 'red'; |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - // Check Memcached (Symfony Cache) |
|
| 120 | - try { |
|
| 121 | - // First check if we can connect to Memcached directly |
|
| 122 | - $memcached = new \Memcached(); |
|
| 123 | - $memcached->addServer('localhost', 11211); |
|
| 119 | + // Check Memcached (Symfony Cache) |
|
| 120 | + try { |
|
| 121 | + // First check if we can connect to Memcached directly |
|
| 122 | + $memcached = new \Memcached(); |
|
| 123 | + $memcached->addServer('localhost', 11211); |
|
| 124 | 124 | |
| 125 | - // Test basic connectivity |
|
| 126 | - if ($memcached->getVersion() === false) { |
|
| 127 | - throw new \Exception('Cannot connect to Memcached server'); |
|
| 128 | - } |
|
| 125 | + // Test basic connectivity |
|
| 126 | + if ($memcached->getVersion() === false) { |
|
| 127 | + throw new \Exception('Cannot connect to Memcached server'); |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - // Test cache operations |
|
| 131 | - $cacheKey = 'health_check_' . uniqid(); |
|
| 132 | - $cacheItem = $cachePool->getItem($cacheKey); |
|
| 133 | - $cacheItem->set('ok'); |
|
| 134 | - $cachePool->save($cacheItem); |
|
| 130 | + // Test cache operations |
|
| 131 | + $cacheKey = 'health_check_' . uniqid(); |
|
| 132 | + $cacheItem = $cachePool->getItem($cacheKey); |
|
| 133 | + $cacheItem->set('ok'); |
|
| 134 | + $cachePool->save($cacheItem); |
|
| 135 | 135 | |
| 136 | - // Verify the item was saved |
|
| 137 | - $savedItem = $cachePool->getItem($cacheKey); |
|
| 138 | - if (!$savedItem->isHit()) { |
|
| 139 | - throw new \Exception('Cache item was not saved successfully'); |
|
| 140 | - } |
|
| 136 | + // Verify the item was saved |
|
| 137 | + $savedItem = $cachePool->getItem($cacheKey); |
|
| 138 | + if (!$savedItem->isHit()) { |
|
| 139 | + throw new \Exception('Cache item was not saved successfully'); |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - $cachePool->deleteItem($cacheKey); |
|
| 143 | - $status['memcached'] = 'green'; |
|
| 144 | - } catch (\Throwable $e) { |
|
| 145 | - // Log error for debugging |
|
| 146 | - error_log('Memcached health check failed: ' . $e->getMessage()); |
|
| 147 | - $status['memcached'] = 'red'; |
|
| 148 | - } |
|
| 142 | + $cachePool->deleteItem($cacheKey); |
|
| 143 | + $status['memcached'] = 'green'; |
|
| 144 | + } catch (\Throwable $e) { |
|
| 145 | + // Log error for debugging |
|
| 146 | + error_log('Memcached health check failed: ' . $e->getMessage()); |
|
| 147 | + $status['memcached'] = 'red'; |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - // Check RabbitMQ using php-amqp extension |
|
| 151 | - try { |
|
| 152 | - $amqp = new \AMQPConnection([ |
|
| 153 | - 'host' => $_ENV['RABBIT_MQ_HOST'] ?? 'localhost', |
|
| 154 | - 'port' => (int)($_ENV['RABBIT_MQ_PORT'] ?? 5672), |
|
| 155 | - 'login' => $_ENV['RABBIT_MQ_USER'] ?? 'guest', |
|
| 156 | - 'password' => $_ENV['RABBIT_MQ_PASSWORD'] ?? 'guest', |
|
| 157 | - 'vhost' => $_ENV['RABBIT_MQ_VHOST'] ?? '/', |
|
| 158 | - ]); |
|
| 159 | - $amqp->connect(); |
|
| 160 | - if ($amqp->isConnected()) { |
|
| 161 | - $status['rabbitmq'] = 'green'; |
|
| 162 | - } |
|
| 163 | - } catch (\Throwable $e) { |
|
| 164 | - // Log error for debugging |
|
| 165 | - error_log('RabbitMQ health check failed: ' . $e->getMessage()); |
|
| 166 | - $status['rabbitmq'] = 'red'; |
|
| 167 | - } |
|
| 150 | + // Check RabbitMQ using php-amqp extension |
|
| 151 | + try { |
|
| 152 | + $amqp = new \AMQPConnection([ |
|
| 153 | + 'host' => $_ENV['RABBIT_MQ_HOST'] ?? 'localhost', |
|
| 154 | + 'port' => (int)($_ENV['RABBIT_MQ_PORT'] ?? 5672), |
|
| 155 | + 'login' => $_ENV['RABBIT_MQ_USER'] ?? 'guest', |
|
| 156 | + 'password' => $_ENV['RABBIT_MQ_PASSWORD'] ?? 'guest', |
|
| 157 | + 'vhost' => $_ENV['RABBIT_MQ_VHOST'] ?? '/', |
|
| 158 | + ]); |
|
| 159 | + $amqp->connect(); |
|
| 160 | + if ($amqp->isConnected()) { |
|
| 161 | + $status['rabbitmq'] = 'green'; |
|
| 162 | + } |
|
| 163 | + } catch (\Throwable $e) { |
|
| 164 | + // Log error for debugging |
|
| 165 | + error_log('RabbitMQ health check failed: ' . $e->getMessage()); |
|
| 166 | + $status['rabbitmq'] = 'red'; |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - // Check Supervisor processes |
|
| 170 | - try { |
|
| 171 | - $process = new \Symfony\Component\Process\Process(['supervisorctl', 'status', 'messenger-consume:*']); |
|
| 172 | - $process->setTimeout(10); |
|
| 173 | - $process->run(); |
|
| 169 | + // Check Supervisor processes |
|
| 170 | + try { |
|
| 171 | + $process = new \Symfony\Component\Process\Process(['supervisorctl', 'status', 'messenger-consume:*']); |
|
| 172 | + $process->setTimeout(10); |
|
| 173 | + $process->run(); |
|
| 174 | 174 | |
| 175 | - // Log the raw output for debugging |
|
| 176 | - error_log('Supervisor command output: ' . $process->getOutput()); |
|
| 177 | - error_log('Supervisor command error: ' . $process->getErrorOutput()); |
|
| 178 | - error_log('Supervisor command exit code: ' . $process->getExitCode()); |
|
| 175 | + // Log the raw output for debugging |
|
| 176 | + error_log('Supervisor command output: ' . $process->getOutput()); |
|
| 177 | + error_log('Supervisor command error: ' . $process->getErrorOutput()); |
|
| 178 | + error_log('Supervisor command exit code: ' . $process->getExitCode()); |
|
| 179 | 179 | |
| 180 | - if ($process->isSuccessful()) { |
|
| 181 | - $output = $process->getOutput(); |
|
| 182 | - $lines = explode(PHP_EOL, trim($output)); |
|
| 183 | - $runningProcesses = 0; |
|
| 184 | - $totalProcesses = 0; |
|
| 180 | + if ($process->isSuccessful()) { |
|
| 181 | + $output = $process->getOutput(); |
|
| 182 | + $lines = explode(PHP_EOL, trim($output)); |
|
| 183 | + $runningProcesses = 0; |
|
| 184 | + $totalProcesses = 0; |
|
| 185 | 185 | |
| 186 | - foreach ($lines as $line) { |
|
| 187 | - $line = trim($line); |
|
| 188 | - if ($line) { |
|
| 189 | - $totalProcesses++; |
|
| 190 | - // Check for various running states |
|
| 191 | - if (stripos($line, 'RUNNING') !== false || |
|
| 186 | + foreach ($lines as $line) { |
|
| 187 | + $line = trim($line); |
|
| 188 | + if ($line) { |
|
| 189 | + $totalProcesses++; |
|
| 190 | + // Check for various running states |
|
| 191 | + if (stripos($line, 'RUNNING') !== false || |
|
| 192 | 192 | stripos($line, 'STARTING') !== false || |
| 193 | 193 | stripos($line, 'BACKOFF') !== false) { |
| 194 | - $runningProcesses++; |
|
| 195 | - } |
|
| 196 | - } |
|
| 197 | - } |
|
| 194 | + $runningProcesses++; |
|
| 195 | + } |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | - error_log("Supervisor check - Total processes: $totalProcesses, Running processes: $runningProcesses"); |
|
| 199 | + error_log("Supervisor check - Total processes: $totalProcesses, Running processes: $runningProcesses"); |
|
| 200 | 200 | |
| 201 | - if ($totalProcesses > 0 && $runningProcesses === $totalProcesses) { |
|
| 202 | - $status['supervisor'] = 'green'; |
|
| 203 | - } else { |
|
| 204 | - $status['supervisor'] = 'red'; |
|
| 205 | - } |
|
| 206 | - } else { |
|
| 207 | - // Try alternative command if the first one fails |
|
| 208 | - $process2 = new \Symfony\Component\Process\Process(['supervisorctl', 'status']); |
|
| 209 | - $process2->setTimeout(10); |
|
| 210 | - $process2->run(); |
|
| 201 | + if ($totalProcesses > 0 && $runningProcesses === $totalProcesses) { |
|
| 202 | + $status['supervisor'] = 'green'; |
|
| 203 | + } else { |
|
| 204 | + $status['supervisor'] = 'red'; |
|
| 205 | + } |
|
| 206 | + } else { |
|
| 207 | + // Try alternative command if the first one fails |
|
| 208 | + $process2 = new \Symfony\Component\Process\Process(['supervisorctl', 'status']); |
|
| 209 | + $process2->setTimeout(10); |
|
| 210 | + $process2->run(); |
|
| 211 | 211 | |
| 212 | - error_log('Alternative supervisor command output: ' . $process2->getOutput()); |
|
| 212 | + error_log('Alternative supervisor command output: ' . $process2->getOutput()); |
|
| 213 | 213 | |
| 214 | - if ($process2->isSuccessful()) { |
|
| 215 | - $output = $process2->getOutput(); |
|
| 216 | - $lines = explode(PHP_EOL, trim($output)); |
|
| 217 | - $runningProcesses = 0; |
|
| 218 | - $totalProcesses = 0; |
|
| 214 | + if ($process2->isSuccessful()) { |
|
| 215 | + $output = $process2->getOutput(); |
|
| 216 | + $lines = explode(PHP_EOL, trim($output)); |
|
| 217 | + $runningProcesses = 0; |
|
| 218 | + $totalProcesses = 0; |
|
| 219 | 219 | |
| 220 | - foreach ($lines as $line) { |
|
| 221 | - $line = trim($line); |
|
| 222 | - if ($line && stripos($line, 'messenger-consume') !== false) { |
|
| 223 | - $totalProcesses++; |
|
| 224 | - if (stripos($line, 'RUNNING') !== false || |
|
| 220 | + foreach ($lines as $line) { |
|
| 221 | + $line = trim($line); |
|
| 222 | + if ($line && stripos($line, 'messenger-consume') !== false) { |
|
| 223 | + $totalProcesses++; |
|
| 224 | + if (stripos($line, 'RUNNING') !== false || |
|
| 225 | 225 | stripos($line, 'STARTING') !== false || |
| 226 | 226 | stripos($line, 'BACKOFF') !== false) { |
| 227 | - $runningProcesses++; |
|
| 228 | - } |
|
| 229 | - } |
|
| 230 | - } |
|
| 227 | + $runningProcesses++; |
|
| 228 | + } |
|
| 229 | + } |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | - error_log("Alternative supervisor check - Total messenger processes: $totalProcesses, Running processes: $runningProcesses"); |
|
| 232 | + error_log("Alternative supervisor check - Total messenger processes: $totalProcesses, Running processes: $runningProcesses"); |
|
| 233 | 233 | |
| 234 | - if ($totalProcesses > 0 && $runningProcesses === $totalProcesses) { |
|
| 235 | - $status['supervisor'] = 'green'; |
|
| 236 | - } else { |
|
| 237 | - $status['supervisor'] = 'red'; |
|
| 238 | - } |
|
| 239 | - } else { |
|
| 240 | - $status['supervisor'] = 'red'; |
|
| 241 | - } |
|
| 242 | - } |
|
| 243 | - } catch (\Throwable $e) { |
|
| 244 | - // Log error for debugging |
|
| 245 | - error_log('Supervisor health check failed: ' . $e->getMessage()); |
|
| 246 | - $status['supervisor'] = 'red'; |
|
| 247 | - } |
|
| 234 | + if ($totalProcesses > 0 && $runningProcesses === $totalProcesses) { |
|
| 235 | + $status['supervisor'] = 'green'; |
|
| 236 | + } else { |
|
| 237 | + $status['supervisor'] = 'red'; |
|
| 238 | + } |
|
| 239 | + } else { |
|
| 240 | + $status['supervisor'] = 'red'; |
|
| 241 | + } |
|
| 242 | + } |
|
| 243 | + } catch (\Throwable $e) { |
|
| 244 | + // Log error for debugging |
|
| 245 | + error_log('Supervisor health check failed: ' . $e->getMessage()); |
|
| 246 | + $status['supervisor'] = 'red'; |
|
| 247 | + } |
|
| 248 | 248 | |
| 249 | - // Determine overall status |
|
| 250 | - $redServices = 0; |
|
| 251 | - $totalServices = count($status) - 1; // Exclude application_name from count |
|
| 249 | + // Determine overall status |
|
| 250 | + $redServices = 0; |
|
| 251 | + $totalServices = count($status) - 1; // Exclude application_name from count |
|
| 252 | 252 | |
| 253 | - foreach ($status as $service => $serviceStatus) { |
|
| 254 | - if ($service !== 'application_name' && $serviceStatus === 'red') { |
|
| 255 | - $redServices++; |
|
| 256 | - } |
|
| 257 | - } |
|
| 253 | + foreach ($status as $service => $serviceStatus) { |
|
| 254 | + if ($service !== 'application_name' && $serviceStatus === 'red') { |
|
| 255 | + $redServices++; |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | - if ($redServices === 0) { |
|
| 260 | - $status['status'] = 'green'; |
|
| 261 | - } elseif ($redServices === $totalServices) { |
|
| 262 | - $status['status'] = 'red'; |
|
| 263 | - } else { |
|
| 264 | - $status['status'] = 'orange'; |
|
| 265 | - } |
|
| 259 | + if ($redServices === 0) { |
|
| 260 | + $status['status'] = 'green'; |
|
| 261 | + } elseif ($redServices === $totalServices) { |
|
| 262 | + $status['status'] = 'red'; |
|
| 263 | + } else { |
|
| 264 | + $status['status'] = 'orange'; |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | - return new JsonResponse($status); |
|
| 268 | - } |
|
| 267 | + return new JsonResponse($status); |
|
| 268 | + } |
|
| 269 | 269 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | } catch (\Throwable $e) { |
| 104 | 104 | // Log error for debugging |
| 105 | - error_log('PostgreSQL health check failed: ' . $e->getMessage()); |
|
| 105 | + error_log('PostgreSQL health check failed: '.$e->getMessage()); |
|
| 106 | 106 | $status['postgres'] = 'red'; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $status['elasticsearch'] = 'green'; |
| 113 | 113 | } catch (\Throwable $e) { |
| 114 | 114 | // Log error for debugging |
| 115 | - error_log('Elasticsearch health check failed: ' . $e->getMessage()); |
|
| 115 | + error_log('Elasticsearch health check failed: '.$e->getMessage()); |
|
| 116 | 116 | $status['elasticsearch'] = 'red'; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | // Test cache operations |
| 131 | - $cacheKey = 'health_check_' . uniqid(); |
|
| 131 | + $cacheKey = 'health_check_'.uniqid(); |
|
| 132 | 132 | $cacheItem = $cachePool->getItem($cacheKey); |
| 133 | 133 | $cacheItem->set('ok'); |
| 134 | 134 | $cachePool->save($cacheItem); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $status['memcached'] = 'green'; |
| 144 | 144 | } catch (\Throwable $e) { |
| 145 | 145 | // Log error for debugging |
| 146 | - error_log('Memcached health check failed: ' . $e->getMessage()); |
|
| 146 | + error_log('Memcached health check failed: '.$e->getMessage()); |
|
| 147 | 147 | $status['memcached'] = 'red'; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | try { |
| 152 | 152 | $amqp = new \AMQPConnection([ |
| 153 | 153 | 'host' => $_ENV['RABBIT_MQ_HOST'] ?? 'localhost', |
| 154 | - 'port' => (int)($_ENV['RABBIT_MQ_PORT'] ?? 5672), |
|
| 154 | + 'port' => (int) ($_ENV['RABBIT_MQ_PORT'] ?? 5672), |
|
| 155 | 155 | 'login' => $_ENV['RABBIT_MQ_USER'] ?? 'guest', |
| 156 | 156 | 'password' => $_ENV['RABBIT_MQ_PASSWORD'] ?? 'guest', |
| 157 | 157 | 'vhost' => $_ENV['RABBIT_MQ_VHOST'] ?? '/', |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | } catch (\Throwable $e) { |
| 164 | 164 | // Log error for debugging |
| 165 | - error_log('RabbitMQ health check failed: ' . $e->getMessage()); |
|
| 165 | + error_log('RabbitMQ health check failed: '.$e->getMessage()); |
|
| 166 | 166 | $status['rabbitmq'] = 'red'; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | $process->run(); |
| 174 | 174 | |
| 175 | 175 | // Log the raw output for debugging |
| 176 | - error_log('Supervisor command output: ' . $process->getOutput()); |
|
| 177 | - error_log('Supervisor command error: ' . $process->getErrorOutput()); |
|
| 178 | - error_log('Supervisor command exit code: ' . $process->getExitCode()); |
|
| 176 | + error_log('Supervisor command output: '.$process->getOutput()); |
|
| 177 | + error_log('Supervisor command error: '.$process->getErrorOutput()); |
|
| 178 | + error_log('Supervisor command exit code: '.$process->getExitCode()); |
|
| 179 | 179 | |
| 180 | 180 | if ($process->isSuccessful()) { |
| 181 | 181 | $output = $process->getOutput(); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $process2->setTimeout(10); |
| 210 | 210 | $process2->run(); |
| 211 | 211 | |
| 212 | - error_log('Alternative supervisor command output: ' . $process2->getOutput()); |
|
| 212 | + error_log('Alternative supervisor command output: '.$process2->getOutput()); |
|
| 213 | 213 | |
| 214 | 214 | if ($process2->isSuccessful()) { |
| 215 | 215 | $output = $process2->getOutput(); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | } catch (\Throwable $e) { |
| 244 | 244 | // Log error for debugging |
| 245 | - error_log('Supervisor health check failed: ' . $e->getMessage()); |
|
| 245 | + error_log('Supervisor health check failed: '.$e->getMessage()); |
|
| 246 | 246 | $status['supervisor'] = 'red'; |
| 247 | 247 | } |
| 248 | 248 | |