I work on an application which we are about to move to Amazon EC2 and Amazon RDS (Relational Data Service). In the process I’ve been trying to find some blogposts which focus on using Liquibase with Amazon RDS, but my googling hasn’t given me any result.
My current plan is something like this:
- Put all migrations script tar-gizzed together and store them on Amazon S3
- Have a script on the application server which during boot does the following (by providing the script in the UserData field):
- Downloads Liquibase
- Downloads the latest migration scripts and unpacks them
- Run Liquibase command line tool to migrate the database
- Possible add a "migrate-utility" in a management console on the webapp to start a new migration on a running server.
Does anyone have any thoughts and/or experience to share with regards to working with both Liquibase & RDS? Would you go with a different strategy than what I’ve suggested above?
Regards,
Trond Andersen
I am using the Clojure version of Liquibase on RDS. I have setup Rake tasks to invoke Update
and Rollback
commands, which work well. I keep the migration as part of the code itself so that I can always refer it together with the app.
I liked the idea of a web console for migration from what you described. It is probably a good idea as a Liquibase extension
Regards,
Shantanu
After reading a bit more about CloudFormation and the possibilities here, I’ve come to the following conclusion:
- The app server (Beantalk) get the responsibility to do database migration
- The CloudFormation template (CFT) includes a reference on the Beanstalk instance to liquibase file stored on Amazon S3
- CFT will include a cfn-init part which will download liquibase and the changesets
- The user data for the Beanstalk instance includes a small script which triggers the cfn-init to run and after cfn-init is finished, run the liquibase migration
This is mostly based on the information in this paper:
https://s3.amazonaws.com/cloudformation-examples/BoostrappingApplicationsWithAWSCloudFormation.pdf
From page 7 there is a description on how to get CloudFormation to define packages to install and scripts to be run which makes me think this is the best approach for us since we are going to use CloudFormation.