/** * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return mixed */ protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln('<info>INFO:</info> environment=<comment>' . $this->config->environment() . '</comment>'); $output->writeln('<info>INFO:</info> <comment>CONTAINER INFORMATION</comment>'); $containerInfo = $this->container->info(); if ($containerInfo === []) { $output->writeln('<error>ERROR:</error> container service is not available'); } else { foreach ($containerInfo as $info) { $output->writeln($info); } $containers = $this->container->containers(); $output->writeln('Container details:'); foreach ($containers as $container) { $networks = $container['NetworkSettings']['Networks']; $ports = $container['NetworkSettings']['Ports']; foreach ($networks as $network) { /** @noinspection DisconnectedForeachInstructionInspection */ $output->writeln(' Name: ' . $container['Name']); $output->writeln(' Address: ' . $network['IPAddress']); /** @noinspection DisconnectedForeachInstructionInspection */ $keys = array_keys($ports); foreach ($keys as $port) { $output->writeln(' Port: ' . $port); } } } } $output->writeln('<info>INFO:</info> <comment>LOAD-BALANCER INFORMATION</comment>'); $loadBalancerInfo = $this->loadBalancer->info(); if ('' === $loadBalancerInfo) { $output->writeln('<error>ERROR:</error> load-balancer service is not available'); } else { $loadBalancerInfo = get_object_vars(json_decode($loadBalancerInfo)); $output->writeln(' Version: ' . $loadBalancerInfo['nginx_version']); $output->writeln(' IP Address: ' . $loadBalancerInfo['address']); $output->writeln(' Upstreams:'); $upstreams = $loadBalancerInfo['upstreams']->php_servers->peers; foreach ($upstreams as $upstream) { $output->writeln(' Server: ' . $upstream->id . '=' . $upstream->server); } } }
/** * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return mixed */ protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln('<info>INFO:</info> environment=<comment>' . $this->config->environment() . '</comment>'); if (!$this->pidFileExists()) { $output->writeln('<error>ERROR:</error> ' . $this->getPidFileName() . ' does not exist'); $output->writeln('<error>ERROR:</error> ' . Version::NAME . ' service not running'); } else { $output->writeln('<info>INFO:</info> ' . Version::NAME . ' service is running'); } if ('' === $this->container->version()) { $output->writeln('<error>ERROR:</error> container service is not available'); } else { $output->writeln('<info>INFO:</info> container service is available'); } if ('' === $this->loadBalancer->version()) { $output->writeln('<error>ERROR:</error> load-balancer service is not available'); } else { $output->writeln('<info>INFO:</info> load-balancer service is available'); } }