Initially, I was using only postinstall to do migrations and assets precompilation.
At some point though, since the precompilation is super slow, I had time outs when pushing.
Based on advice by Andy (I think), I moved stuff to postbuild.
Faced to the need of running migrations, I decided to attempt detecting instance 0 to only run those on one machine (and it worked fine).
Similarly, I deployed the cron jobs only on one instance.
For cron I had to hardcode the path to rvm wrappers.
For database connection: Rails evaluates database.yml via ERB, so I built a little dot_cloud.rb configuration helper to grab the data from the environment file.
Things would have been definitely easier here if the variables had been exposed as real environment variables.
Post deploy, I launch ab to make sure all the passenger are immediately fired up and avoid delays for the end-user.
Things to improve for the advanced user:
- I'd like to go even further and hope to use the latest "live" deploy protocol to have absolutely zero downtime if I can (tips welcome!)
- assets precompilation is very, very slow on instances (much faster locally, but it's much more convenient to not have to check the files in git) - anything to fasten that will be welcome (replacing therubyracer by something else etc... unsure)