I'm somewhat confused about how to implement a system based on Elastic Beanstalk that will allow me to roll back both my server code and RDS schema to a known good state in the event of a bad deploy.
I have an application that handles forward/up schema migrations on each deploy (using .ebextensions/
). However, consider the following scenario:
- Elastic Beanstalk is running version 1 of my application and database schema.
- I push version 2 of my application, which migrates the RDS schema to version 2.
- I redeploy version 1 of my application, however, the RDS schema remains at version 2
I don't think I can roll back the migrations at step 3, because the backwards/down migration from version 2 doesn't exist at that point.
So, what is the best way to approach this? Should I be using something like capistrano in place of an Elastic Beanstalk deploy to gain more control over the process?