Reputation: 107
I have an architecture built on AWS container service with laravel running as an api service to my JS app.
My question is: What is the best way to execute migrations?
My assumption is with multiple instances of the same laravel app running in the cluster I risk issues with the app themselves running the migrations at the same time. right ?
What is the best way to run migrations on the database with no downtime for our clients ? maybe an external service specifically designed to run migrations on a mirror db ?
Arch outline :
Upvotes: 0
Views: 2442
Reputation: 6907
The app containers should not run administrative tasks like migrations, or you will get contention with multiple instances or useless operations at restart.
From reading a few articles, the clean solution seems to run a one-off task to perform migrations. This is similar to hwo things work on Heroku for example.
Upvotes: 4