We are doing CI/CD for drupal site using Jenkins. Now, we need to run drush commands which we should run only in single instance.
For this, we have created elastic beanstalk config script with parameter leader_only as true but it still runs drush commands in all instances at time of deployment instead of one instance.
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/drushcmd.sh":
mode: "000755"
owner: root
group: root
content: |
#!/bin/bash
. /opt/elasticbeanstalk/support/envvars
cd /usr/local/bin
sudo cp /usr/bin/composer.phar /usr/local/bin/composer
sudo ln -s /usr/local/bin/composer /usr/bin/composer
composer --version
git clone https://github.com/drush-ops/drush.git /usr/local/src/drush
cd /usr/local/src/drush
git checkout 7.0.0-alpha5
sudo ln -s /usr/local/src/drush/drush /usr/bin/drush
composer install
export DRUSH_PHP=/usr/bin/php7
drush --version
container_commands:
001customize:
command: "/opt/elasticbeanstalk/hooks/appdeploy/post/drushcmd.sh"
leader_only: true
ignoreErrors: true