Rails + Elastic Beanstalk: Abort deployments when database migration fails

88 Views Asked by At

I've got a Rails 5/Ruby 2.3 app running on Elastic Beanstalk. I want deployments to abort when a database migration fails.

My RAILS_SKIP_MIGRATIONS is set to false, so migrations execute when deployment. However, I had an issue where one migration failed but the deployment completed. This of course resulted in several 500 afterwards.

I've considered writing an ebextension which runs on post-deployment and checks whether there's an issue. If there is, then I rollback to the previous app version. However, I'm not sure if this approach is the right one.

0

There are 0 best solutions below