We experience a very weird issue at the moment. Our tech stack involves AWS Elastic Beanstalk,EC2 and Laravel deploying the code with Bitbucket Pipelines.
The problem is that whenever we include a migration in the deploy then it's run twice (as many times as our EC2 instances in this environment!).
Our scripts are located under .ebextensions dir:
option_settings:
"aws:elasticbeanstalk:container:php:phpini":
document_root: /public
container_commands:
01initdb:
command: "php artisan migrate"
We ended up breaking our deploy a few times because the system can't tell that this migration has already run.
Anyone saw this issue before?
Update
We came up with this implementation as MySQL connection is refused if we add
php artisan migrate in the build script.