I’ve blogged before about deploying Rails applications. Normally I opt for using capistrano, as it provides all the features I need and is pretty easy to customize if needed.
One of my previous strategies was to use capistrano to checkout a branch on a remote server, and git fetch that branch upon a new deployment.
The problem with capistrano, however, is that it can be quite slow from time to time.
Randuin posted a comment on my previous Lighting fast, zero-downtime deployments with git, capistrano, nginx and Unicorn post asking how I handle database migrations. This is a good question.
Database migrations, especially with large datasets, take a long time to run. They also lock your database tables which may cause all kinds of trouble.
There’s a quite an easy solution for this, offered to us by Capistrano. Unfortunately it will cause downtime for your site while the migration is running.
Everyone who has ever developed a web app has had to deploy it. Back in the day you simply uploaded your files with FTP and everything would be good. Today we have to clone git repositories, restart servers, set permissions, create symlinks to our configuration files, clean out caches and what not.
Doctor, what’s wrong? In my opinion there are two critical problems with deployments today:
They are slow They cause downtime Both topics have been discussed by the likes of Twitter and Github.