Deploying a Rails app without a database using Capistrano

So you’ve got a simple-but-devastatingly-clever Rails app that doesn’t use a database, you’ve dutifully added the line to config/environment.rb to disable the ActiveRecord framework, and now you’re ready to unleash it to the world, using Capistrano for deployment. But when you run ‘cap deploy:cold’, it merrily tries to run database migrations and fails with “uninitialized constant ActiveRecord”. How do you make Capistrano behave?

A simple question, with a simple answer, but one which is curiously absent from the internet. Googlejuice ahoy!

Stick this at the bottom of config/deploy.rb:

namespace :deploy do
	desc "Override deploy:cold to NOT run migrations - there's no database"
	task :cold do
		update
		start
	end
end

2 Responses to “Deploying a Rails app without a database using Capistrano”

  1. Randy says:

    That is pretty sweet. I always enjoy the small little tips people come up with. I also run a rails blog where i talk about little tricks and stuff that might help out.

    Cheers

  2. Just what I needed, thanks for taking the time to publish that very useful bit of info.

Leave a Reply