This post originated from an RSS feed registered with Ruby Buzz
by Tobias Luetke.
Original Post: Deployment
Feed Title: too-biased
Feed URL: http://blog.leetsoft.com/xml/rss/
Feed Description: Read the announcement: CD Baby rewrite in Postgres and Ruby, Baby!CD Baby is going rails. This is huge! If you don’t know CD Baby, its a distribution site with over 80.000 musicians under contract and its one of the biggest digital distributors of audio to Apple iTunes, Napster, Rhapsody, etc. Read all about it here. What is even more exciting about it is that I’m on board for the rewrite and I had chance to talk to Derek on the phone directly for a consulting session which might have played its little part in the decision to go with rails. Come monday I’ll work together with him and other rails contributor Jeremy Kemper to help crunch those 90k lines of PHP in beautifully compact code for which Rails and Ruby are known. Here is a quote from Derek’s announcement on his weblog: Like a lost soul walkin’ the earth, lookin’ for spirituality, that stumbles upon the right church with the right people at the right time, I’ve found my niche with Ruby. Its little itty-bitty community attracts some brilliant “think different” types with a love for beautiful code that do this for love, not money.
A few months back we had this little discussion in IRC to which david replied that he keeps different versions of his production apps on their respective servers and uses a symlink to hook up a working copy to the web server.
The big advantage in this is that you can test the code before restarting the web server since the current web site runs untouched. This has saved me from deploying quite a couple of bugs in the beginning and it prompted me to install damagecontrol.
Over the last couple of weeks I have tried to automate this process. What I came up with is a script which basically acts as a batch handler for server deployment.
Take for instance Hieraki. Issuing deploy hieraki runs through the following steps:
ssh connect to production server
checkout the latest version from subversion
run all unit tests using rake
set permissions on log dir
point the hieraki/latest symlink to the newly deployed copy
restart apache gracefully
The current version of my deploy script reads the file ~/.deployrc for its configuration. In hieraki’s case this looks like this: