public
Description: Deploying Rails applications with ShadowPuppet and Capistrano
Homepage: shadow_rails
Clone URL: git://github.com/wrecked/shadow_rails.git
wrecked (author)
Wed Feb 11 15:33:04 -0800 2009
commit  0cbf8d4e83de30fda29a14d4176d05f0a0108dc9
tree    7d7f3d1a72779576b8c3719ed85c2b7fb45c6c8c
parent  fb098524ce7407635a7cc99805be8a26aba7029a
name age message
file README Loading commit data...
file application_manifest.rb Tue Feb 10 08:29:05 -0800 2009 removed whitespace [wrecked]
directory bin/
directory lib/
directory spec/ Tue Feb 10 08:29:05 -0800 2009 removed whitespace [wrecked]
directory templates/
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.