Question

I have development environment like below.

Development server with tomcat7, mysql installed. Our application runs on this using the mysql database. We have one more server called Production server which also hosts tomcat7 and mysql. Our application runs as well there. we are using amazon web services like ec2 instances. The problem is whenever we integrate some database change in development server, we need to replicate the same process in production server. Can anyone suggest me ideal infrastructure, wherein we can make use complete clone or any easy process. Any good architecture in practice are welcome.

Was it helpful?

Solution

Every change to the database must be tracked just like any other part of your application (the most obvious "other part" being your code base, of course).

Log every change made to the database in a SQL script. This script will be applied on the target environments as part of your standard upgrade procedure -- applying a patch then means "install new code and apply database upgrade script, and this processed can be easily scripted.

If you foresee the possibility of having to install new instances of your application in the future, you will need to be able to create new empty databases. For this purpose, you will also need to mainain an "initialisation script" that creates the default structures of your application. This includes tables, triggers, stored routines creation scripts, and possibly some default rows in your tables. This script must be maintained in the same way as the upgrade scripts. You may want to keep an empty database on some integration server that you would upgrade with the standard upgrade script. Then dump this database at every release; this dump becomes your reference database creation script.

This blog post at Coding Horror points to several high quality articles on this subject.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top