SonataNotificationBundle: Run command in deployment on amazon Beanstalk

0

I have an app made with Symfony and SonataNotificationBundle. I need to deploy the app on amazon Beanstalk to execute a command to activate the consumers that I have made with sonataNotification.

Currently I have two files in the .ebextensions folder: composer.config notifications.config

the composer.config works correctly, I have located the error in the notifications.config. This only has three lines:

commands:
  02execute_consumers:
    command: php app/console --env=prod sonata:notification:start

Beanstalk returns this error in the deployment:

[2017-06-13T05:48:05.389Z] INFO [7883] - [Application update aws-ffm-bgg34@43/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_1_PROYECTO/Command 02execute_consumers] : Activity execution failed, because: Could not open input file: app/console
(ElasticBeanstalk::ExternalInvocationError)

What I understand here is that the directory where the deployment environment is located is not that of the app, so it does not find the app / console file.

On a local computer, the only thing you would have to do is go to the application directory, and execute that same command:

php app/console --env=prod sonata:notification:start

How can I do this in Beanstalk? What would the directory be? Or am I forgetting something basic?

    
asked by Jakala 13.06.2017 в 07:56
source

1 answer

0

After a few days thinking about this issue, I found a solution. I have modified the file in which I have the command and I put the following:

commands:
  10MigrationCommand:
    command: export COMPOSER_HOME=/root && sudo php /var/www/html/app/console doctrine:migrations:migrate --env=prod --no-interaction

option_settings:
  - namespace: aws:elasticbeanstalk:application:environment
    option_name: COMPOSER_HOME
    value: /root

In this case, the console file is in / var / www / html / app / console

DO NOT FORGET the - env = prod , because if not take the development data (usually the bbdd in development refers to localhost) and

    
answered by 20.06.2017 в 11:39