public
Description: Deploying Rails applications with ShadowPuppet and Capistrano
Homepage: shadow_rails
Clone URL: git://github.com/wrecked/shadow_rails.git
name age message
file README Tue Feb 10 13:39:30 -0800 2009 fixed typo [wrecked]
file application_manifest.rb Tue Feb 10 08:29:05 -0800 2009 removed whitespace [wrecked]
directory bin/ Wed Feb 18 11:13:56 -0800 2009 remove hacks for Facter 1.5.3 [wrecked]
directory lib/ Tue Feb 10 13:40:24 -0800 2009 spacing [wrecked]
directory spec/ Tue Feb 10 08:29:05 -0800 2009 removed whitespace [wrecked]
directory templates/ Fri Feb 06 14:14:43 -0800 2009 moved to global config [wrecked]
README
This project is meant to be forked and modified for your own use. It illustrates
using ShadowPuppet to manage system configuration and Capistrano for deployment.

Please note:
* only works on Ubuntu 8.10
* runs on a completely clean install and assumes the user is 'rails'
* if you hate your life, blindly run on a production system.
* only installs one kind of Ruby. edit bin/bootstrap to select enterpriseyness.
* no root mysql passwd set.
* database name is 'name_production' and username is 'name'. update config/database.yml
* look at all the things you aren't giving cute names.
* you can edit passenger conf files in ./templates
* assumes a single server architecture.
* bootstrapping is slow due to compiling REE and passenger from scratch to support 64bit.
* capistrano output is crazy noisy for bootstrap. use 'cap -q'.
* use at own risk.

To get started:

1. Fork and clone this project.
2. Update shadow_rails/application_manifest.rb with your information and packages. Commit. Push.
3. Add the following to config/deploy.rb:

#############################################

# set user that can write to /u/apps and has sudo privs.
set :user, "rails"

# set your github clone url
set :shadow_repository, "git://github.com/wrecked/shadow_rails.git"

namespace :deploy do
  desc <<-DESC
  Bootstrap the system with Git, Ruby, Gems, ShadowPuppet, and ShadowFacter. Setup cap directories.
  DESC
  task :bootstrap do
    sudo "apt-get install -q -y git-core"
    run "git clone #{shadow_repository}"
    sudo '~/shadow_rails/bin/bootstrap'
  end

  desc <<-DESC
  Pull latest manifest and apply.
  DESC
  task :apply_manifest do
     run "cd shadow_rails;git pull"
    sudo 'shadow_puppet shadow_rails/application_manifest.rb'
  end

  before :deploy do
    apply_manifest
  end

  before 'deploy:migrations' do
    apply_manifest
  end

  desc <<-DESC
  Restart the Passenger processes on the app server by touching tmp/restart.txt.
  DESC
  task :restart, :roles => :app do
    run "touch #{current_path}/tmp/restart.txt"
  end
end

#############################################

4. run 'cap -q deploy:bootstrap' to bootstrap the server.
5. run 'cap deploy' to apply manifest on the server before deploy.