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 18 11:13:56 -0800 2009
commit  e9f8d545daf7123fd82f109ee02021fb5d292b61
tree    eef4e684aa0fd90c24bbf5dd5eebfa169c6c63be
parent  0cbf8d4e83de30fda29a14d4176d05f0a0108dc9
shadow_rails / README
100644 74 lines (56 sloc) 2.217 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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.