/
Rudyfile
227 lines (186 loc) · 5.35 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
require 'stella'
machines do
region :'us-east-1' do
ami 'ami-212ccf48' # Stella Debian 5.0, 32-bit (US)
end
region :'eu-west-1' do
ami 'ami-6ecde51a' # Alestic Debian 5.0, 32-bit (EU)
end
env :stage do
role :app do
positions 2
user :root
size 'm1.small'
end
role :gen do
user :root
size 'm1.large'
ami 'ami-7133d018'
end
role :demo do
user :root
size 'm1.small'
end
end
end
commands do
allow :apt_get, "apt-get", :y, :q
allow :gem_install, "/usr/bin/gem", "install", :n, '/usr/bin', :y, :V, "--no-rdoc", "--no-ri"
allow :gem_sources, "/usr/bin/gem", "sources"
allow :gem_uninstall, "/usr/bin/gem", "uninstall", :V
allow :update_rubygems
allow :rake
allow :thin
allow :stella
allow :rm
allow :ulimit
allow :ruby19, "/usr/local/bin/ruby"
allow :gem19_install, "/usr/local/bin/gem", "install"
allow :rackup_path do
v = [Stella::VERSION::MAJOR, Stella::VERSION::MINOR, Stella::VERSION::TINY].join('.')
"/usr/lib/ruby/gems/1.8/gems/stella-#{v}/support/sample_webapp/config.ru"
end
end
routines do
role :app do
# rudy -r app -v start
start do
remote do
#ulimit :n, '30000'
#ulimit :n
rm :f, 'thin.log'
mkdir :p, 'stats'
thin :d, :l, 'thin.log', :p, 3114, :R, rackup_path, '--stats', './stats', '--max-conns', 8192, 'start'
end
end
# rudy -r app -v stop
stop do
remote do
thin :R, rackup_path, 'stop'
sleep 1
ps 'ux'
end
end
end
# rudy -v -r gen verify ip-10-251-27-245.ec2.internal:3114
verify do
remote do |arg|
file_upload 'examples/essentials/plan.rb'
file_upload 'examples/essentials/search_terms.txt'
file_upload 'examples/essentials/logo.png'
stella :v, 'verify', :p, 'plan.rb', "#{arg.first}"
end
end
# rudy -v -r gen generate ip-10-251-27-245.ec2.internal:3114
generate do
remote do |arg|
file_upload 'examples/essentials/plan.rb'
file_upload 'examples/essentials/search_terms.txt'
file_upload 'examples/essentials/logo.png'
stella :v, 'generate', :p, 'plan.rb', :c, 1, :d, '1m', :W, "#{arg.first}"
end
end
setup do
after :sysupdate, :installdeps, :install_ruby19
end
shutdown do
end
reboot do
end
install_netperf do
#ftp://ftp.netperf.org/netperf/netperf-2.4.5.tar.bz2
end
install_rubyforge do
remote :root do
gem19_install 'stella', :V
gem_install 'stella', :V
end
end
install_github do
remote :root do
gem_sources :a, "http://gems.github.com"
gem_install 'solutious-stella'
end
end
package_gem do
local do
rm :r, :f, 'pkg'
rake 'package'
end
end
remove_rudy do
remote :root do
gem_uninstall 'stella'
rm :r, :f, '.stella'
end
end
install_gem do
before :package_gem
remote :root do
file_upload "pkg/stella-#{Stella::VERSION}.gem", "/tmp/"
gem_install "/tmp/stella-#{Stella::VERSION}.gem"
end
end
install_zlib do
remote do
wget "http://www.zlib.net/zlib-1.2.3.tar.gz"
tar :x, :z, :f, "zlib-1.2.3.tar.gz"
cd "zlib-1.2.3"
configure '--prefix=/usr/local'
make
make "install"
end
end
installdeps do
remote :root do
gem_install "test-spec", "rspec", "camping", "fcgi", "memcache-client"
gem_install "mongrel"
gem_install "ruby-openid", :v, "2.0.4" # thin requires 2.0.x
gem_install "rack", "thin", "sinatra"
end
end
install_jruby do
remote do
wget 'http://jruby.kenai.com/downloads/1.4.0RC2/jruby-bin-1.4.0RC2.tar.gz'
tar :x, :z, :f, 'jruby-bin-1.4.0RC2.tar.gz'
mv 'jruby-1.4.0RC2', '/usr/jruby'
end
end
install_ruby19 do
before :install_zlib
remote do
apt_get "install", "libssl-dev", "libreadline5-dev", "zlib1g-dev"
#wget 'ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.bz2'
rm :r, :f, 'ruby-1.9.1-p243'
tar :x, :j, :v, :f, 'ruby-1.9.1-p243.tar.bz2'
cd 'ruby-1.9.1-p243'
configure '--prefix=/usr/local'
make
make 'install'
end
end
sysupdate {
remote {
apt_get "update"
apt_get "install", "libxml2-dev", "libxslt-dev"
apt_get "install", "build-essential", "git-core"
apt_get "install", "ruby1.8-dev", "rdoc", "libzlib-ruby", "rubygems"
apt_get "install", "libfcgi-dev", "libfcgi-ruby1.8"
apt_get "install", "joe", "siege", "httperf"
gem_sources :a, "http://gems.github.com"
mkdir :p, "/var/lib/gems/1.8/bin" # Doesn't get created, but causes Rubygems to fail
gem_install "builder", "session"
gem_install 'hoe-seattlerb'
gem_install 'rubygems-update', "-v=1.3.4"
update_rubygems
gem_install 'hoe'
}
}
end
defaults do
zone :'us-east-1a'
environment :stage
role :app
color true
user :root
end