- Newest
- Most votes
- Most comments
Greetings User-5343824
This is expected behavior, looking at your .ebexensions (migrate.config, post_actions.config) your test is leader_only. As mentioned in the Elastic Beanstalk ebestensions documentation.
You can use leader_only to only run the command on a single instance, or configure a test to only run the command when a test command evaluates to true. Leader-only container commands are only executed during environment creation and deployments, while other commands and server customization operations are performed every time an instance is provisioned or updated. Leader-only container commands are not executed due to launch configuration changes, such as a change in the AMI Id or instance type.
In extension to this Reboots of current instances or the launch of new instances do not trigger the leader_only evaluation.
If you need commands like the 01_migrate or 01_collectstatic I would recommend removing the leader_only test. from their definition
migrate.config file:
01_migrate:
command: "source /var/app/venv/*/bin/activate && python3 manage.py migrate"
post_actions.config
01_collectstatic:
command: "source /var/app/venv/*/bin/activate && python3 manage.py collectstatic --noinput"
Should you require a constant command to be run within your fleet you could implement the following ebextension cron-leaderonly-linux
This .ebextension configures a script on the instances that perform a describe on the Environment Auto Scaling group and if it matches the first instance in the sorted list it will exit 0. This will mean that this script will only exit 0 for one of the instances in your environment.
Hope this helps
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago