Using Turnkey Linux Rails with Capistrano

The guys at TurnkeyLinux.org have, among other stuff, a very useful Rails VM. As useful as it is out of the box, I like to use together with Capistrano. To do so, it needs some minor tweaks.

Clean up the current app

Fire up the VM, and ssh to it. ssh root@192.168.2.18 The application is in /var/www/railsapp; go there, and delete the contents of the directory. cd /var/www/railsapp; rm -rf *

Configure Apache

With that out of the way, we need to tell the embedded Apache that something has changed. In /etc/apache2/conf/railsapp.conf, replace the occurences of 'public' by 'current/public'. Then, restart apache by using apache2ctl restart

Install subversion

For some reason the Turnkey VM doesn't ship with subversion. Install that using apt-get update; apt-get install subversion

Connect to your subversion server once

When you're using svn+ssh as I am, you will want to connect to your subversion server once, for instance using something like svn info svn+ssh://angelo@192.168.2.4/svn This gives ssh the chance to 'get to know' your server.

That's it!

There, with a few minor tweaks, you can start using an off-the-shelf VM for you Capistrano deployment. I personally use one of these to test my deployment scripts, and hence use it as a staging server.

Some time soon, I will (a) do a walkthrough of building an application that can readily be deployed onto this VM, and (b) show how you can use Capistrano to deploy to both a staging environment in one of these VM's, and to a 'real' production server.