Frontend:project:install-dependencies RabbitMq connection when using staging Environment


#1

Hi,

when i try to execute the command vendor/bin/console “frontend:project:install-dependencies -vvv” using development Environment it works, but if i use staging Environment it is tried to make connection to the RabbitMq and stop. Is there a difference when i use staging or Production Environment.

Best Regards,
Jozsef


#2

Hi Jozsef,

Could you provide more details? There can be a lot differences, How do you change the environment, different server, by env var? What is the exact exception?

WBR,
Valerii


#3

Hi Valerii,

i try to build the docker image in travis-ci. The error comes just in case of staging environment because in Pyz\Zed\Console\ConsoleDependencyProvider it is included the “EventSubscriber” ConsoleLogPlugin():

public function getEventSubscriber(Container $container)
{
    $eventSubscriber = parent::getEventSubscriber($container);

    if (!Environment::isDevelopment()) {
        $eventSubscriber[] = new ConsoleLogPlugin();
        $eventSubscriber[] = new NewRelicConsolePlugin();
    }

    return $eventSubscriber;
}

I think the ConsoleLogPlugin tries to make a connection with the RabbitMQ.

Using Environment staging when i try to execute command: frontend:project:install-dependencies -vvv than i get the following error:

[exec] #0 /var/www/spryker/releases/current/vendor/spryker/console/src/Spryker/Zed/Console/ConsoleDependencyProvider.php(45): Pyz\Zed\Console\ConsoleDependencyProvider->getConsoleCommands(Object(Spryker\Zed\Kernel\Container))
 [exec] #1 /var/www/spryker/releases/current/vendor/pimple/pimple/lib/Pimple.php(83): Spryker\Zed\Console\ConsoleDependencyProvider->Spryker\Zed\Console\{closure}(Object(Spryker\Zed\Kernel\Container))
 [exec] #2 /var/www/spryker/releases/current/vendor/spryker/kernel/src/Spryker/Zed/Kernel/BundleDependencyProviderResolverAwareTrait.php(56): Pimple->offsetGet('commands')
 [exec] #3 /var/www/spryker/releases/current/vendor/spryker/console/src/Spryker/Zed/Console/Business/ConsoleBusinessFactory.php(35): Spryker\Zed\Kernel\AbstractFactory->getProvidedDependency('commands')
 [exec] #4 /var/www/spryker/releases/current/vendor/spryker/console/src/Spryker/Zed/Console/Business/ConsoleFacade.php(28): Spryker\Zed\Console\Business\ConsoleBusinessFactory->getConsoleCommands()
 [exec] #5 /var/www/spryker/releases/current/vendor/spryker/console/src/Spryker/Zed/Console/Communication/ConsoleBootstrap.php(83): Spryker\Zed\Console\Business\ConsoleFacade->getConsoleCommands()
 [exec] #6 /var/www/spryker/releases/current/vendor/symfony/console/Application.php(1219): Spryker\Zed\Console\Communication\ConsoleBootstrap->getDefaultCommands()
 [exec] #7 /var/www/spryker/releases/current/vendor/symfony/console/Application.php(589): Symfony\Component\Console\Application->init()
 [exec] #8 /var/www/spryker/releases/current/vendor/symfony/console/Application.php(229): Symfony\Component\Console\Application->find('frontend:projec...')
 [exec] #9 /var/www/spryker/releases/current/vendor/spryker/console/src/Spryker/Zed/Console/Communication/ConsoleBootstrap.php(150): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
 [exec] #10 /var/www/spryker/releases/current/vendor/symfony/console/Application.php(148): Spryker\Zed\Console\Communication\ConsoleBootstrap->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
 [exec] #11 /var/www/spryker/releases/current/vendor/spryker/console/bin/console(21): Symfony\Component\Console\Application->run()
 [exec] #12 {main}
 [exec] Fatal error: Uncaught ErrorException: stream_socket_client(): unable to connect to tcp://: (Failed to parse address ":") in /var/www/spryker/releases/current/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/IO/StreamIO.php:141
 [exec] Stack trace:
 [exec] #0 [internal function]: PhpAmqpLib\Wire\IO\StreamIO->error_handler(2, 'stream_socket_c...', '/var/www/spryke...', 141, Array)
 [exec] #1 /var/www/spryker/releases/current/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/IO/StreamIO.php(141): stream_socket_client('tcp://:', 0, 'Failed to parse...', 3, 4, Resource id #437)
 [exec] #2 /var/www/spryker/releases/current/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Connection/AbstractConnection.php(205): PhpAmqpLib\Wire\IO\StreamIO->connect()
 [exec] #3 /var/www/spryker/releases/current/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Connection/AbstractConnection.php(189): PhpAmqpLib\Connection\AbstractConnection->connect()
 [exec] #4 /var/www/spryker/releases/current/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Connection/AMQPStreamConnection.php(60): PhpAmqpLib\Connection\AbstractConnect in /var/www/spryker/releases/current/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/IO/StreamIO.php on line 141 

Best regards,
Jozsef


#4

Hallo,

i found out the source of the Problem which we in travis have. in Pyz\Zed\Log\LogDependencyProvider you use for the LogHandlers also the QueueHandlerPlugin, this means that you write the logs (console logs) also in the queue (RabbitMq).

/**
 * @return \Spryker\Shared\Log\Dependency\Plugin\LogHandlerPluginInterface[]
 */
protected function getLogHandlers()
{
    return [
        new StreamHandlerPlugin(),
        new ExceptionStreamHandlerPlugin(),
        new QueueHandlerPlugin()
    ];
}

Best Regards,
Jozsef