A simple capistrano recipe for setting-up a Rails server at Slicehost
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Capistrano recipe to setup an Ubuntu Slicehost server

This script sets up a Rails server stack on Slicehost, running Ubuntu Inprepid

Includes updated gems, ImageMagick, and setup configs as specified in Slicehost articles for Ubuntu Intrepid

What’s installed

  • Ubuntu Development Tools
  • Git
  • Apache
  • Passenger
  • MySQL
  • Ruby 1.8.6
  • Rubygems 1.3.1
  • Rails 2.3.2
  • IMageMagick

The following gems are installed:

  • radiant
  • flickr_fu
  • haml
  • mislav-will_paginate
  • fastercsv
  • RedCloth
  • rmagick
  • xml-magic
  • json
  • thoughtbot-paperclip

Also configures Apache for use with Passenger, as well setting up a vhost container for the rails app.
For more details, checkout config/deploy.rb


  sudo aptitude safe-upgrade
  sudo aptitude full-upgrade

How to use

You should only need to modify the variables at the top of the deploy recipe in config/deploy.rb

  set :application, "mydomain.com" # The vhost container name (e.g. domain)
  set :repository,  "git@github.com:USERNAME/REPONAME.git" # GitHub repo where this deploy lives
  set :user, "username" # Username of your slice
  set :slice, "xx.xx.xx.xx" # The IP address of your slice

The two lines below probably only need to be used if you are also deploying your app from this same recipe
I only use this recipe for setting up my server, and is not contained in the app’s repo itself

  set :repository,  "git@github.com:USERNAME/REPONAME.git"
  set :deploy_to, "/home/#{user}/#{application}"

You can, of course, use this recipe as the primary deploy.rb, where all your cap commands access the declared namespaces. This would allow you to setup the recipe on a per project basis.

As an alternative, you can place this recipe in your app alongside the dev, staging, and production recipes using the capistrano-ext gem, which would allow you to issue cap commands on a per environment basis. In this case, you could name this recipe slicehost.rb. Be sure to declare this recipe in the top-level deploy.rb file.

To run the recipe in it’s entirety, issue the command cap slicehost:setup_env.

To see all the available commands, issue the command cap -T.

Credit to Matt Swasey of Viget Labs for the idea, based on his blog entry

Copyright © 2009 Brandon Calloway, released under the MIT License