-
Notifications
You must be signed in to change notification settings - Fork 32
/
Rudyfile
135 lines (117 loc) · 3.8 KB
/
Rudyfile
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# = Rudy configuration
#
# ----------------------------------------------------------- DEFAULTS --------
# These values are used as defaults for their respective global settings. All
# non-boolean values are expected to be Symbols.
#
defaults do
zone :'eu-west-1b'
environment :rye
color true # Terminal colors? true/false
yes false # Auto-confirm? true/false
end
# --------------------------------------------------------- MACHINES --------
# The machines block describes the 'physical' characteristics of your machines.
machines do
zone :'us-east-1b' do
ami 'ami-e348af8a' # Alestic Debian 5.0, 32-bit (US)
bucket 'rudy-ami-us'
end
zone :'eu-west-1b' do
ami 'ami-1dbd9569' # rudy-ami-eu/debian-5.0-32-ruby-r1
bucket 'rudy-ami-eu'
end
hostname :rudy # One of: :default, :rudy, 'your-name'
env :rye do
user :root # User to connect as
size 'm1.small' # EC2 machine type for all machines
end
end
# ----------------------------------------------------------- COMMANDS --------
# The commands block defines shell commands that can be used in routines. The
# ones defined here are added to the default list defined by Rye::Cmd (Rudy
# executes all SSH commands via Rye).
#
# Usage:
#
# allow COMMAND-NAME
# allow COMMAND-NAME, '/path/2/COMMAND'
# allow COMMAND-NAME, '/path/2/COMMAND', 'default argument', 'another arg'
#
commands do
allow :apt_get, "apt-get", :y, :q
allow :gem18_install, "/usr/bin/gem1.8", "install", :n, '/usr/bin', :y, :V, "--no-rdoc", "--no-ri"
allow :gem18_sources, "/usr/bin/gem1.8", "sources"
allow :gem19_install, "/usr/local/bin/gem", "install", :n, '/usr/bin', :y, :V, "--no-rdoc", "--no-ri"
allow :gem19_sources, "/usr/local/bin/gem", "sources"
allow :update_rubygems
allow :ruby18, "/usr/bin/ruby1.8"
allow :ruby19, "/usr/local/bin/ruby"
allow :ssh_keygen, 'ssh-keygen'
allow :rm
end
# ----------------------------------------------------------- ROUTINES --------
# The routines block describes the repeatable processes for each machine group.
# To run a routine, specify its name on the command-line: rudy startup
routines do
env :rye do
startup do
after :installdeps, :authorize
after :runtest
end
end
runtest do
remote :root do
ruby18 :r, 'rubygems', 'rye/bin/try'
ruby19 'rye/bin/try'
end
end
authorize do
remote :root do
rm :f, '/root/.ssh/id_rsa'
ssh_keygen :q, :f, '/root/.ssh/id_rsa', :N, ''
rye 'authorize_local'
end
end
installdeps do
local do
rake 'package'
end
remote :root do
gem18_install "rye", "delano-rye"
gem19_install "rye", 'delano-rye'
disable_safe_mode
rm :r, :f, 'rye*'
file_upload 'pkg/rye-*gz'
tar :z, :x, :f, 'rye-*gz'
rm 'rye-*gz'
mv 'rye-*', 'rye'
cd 'rye'
end
end
# NOTE: sysupdate only needs to be run for the bare instances.
sysupdate do
remote :root do
apt_get "update"
apt_get "install", "build-essential", "git-core"
apt_get "install", "libssl-dev", "libreadline5-dev", "zlib1g-dev"
apt_get "install", "ruby1.8-dev", "rubygems"
gem18_install 'rubygems-update' # for 1.8
update_rubygems # for 1.8
gem18_sources :a, "http://gems.github.com"
end
after :install_ruby19
end
install_ruby19 do
remote :root do
wget :q, 'ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p129.tar.gz'
tar :z, :x, :f, 'ruby-1.9.1-p129.tar.gz'
cd 'ruby-1.9.1-p129'
configure
make
make 'install'
apt_get "install", "rubygems1.9"
gem19_sources :a, "http://gems.github.com"
end
end
end