slingshot 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +18 -4
- data/lib/slingshot/recipes.rb +23 -24
- data/lib/slingshot/server_setup.rb +40 -27
- data/lib/slingshot/version.rb +2 -2
- data/website/index.html +2 -2
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,10 +1,24 @@
|
|
1
|
-
==
|
1
|
+
== 1.1.0 2007-07-13
|
2
2
|
|
3
|
-
*
|
4
|
-
|
5
|
-
|
3
|
+
* updated to work with CentOS 5
|
4
|
+
|
5
|
+
== 1.0.2 2007-07-07
|
6
|
+
|
7
|
+
* altered monit setup script
|
8
|
+
|
9
|
+
== 1.0.1 2007-07-02
|
10
|
+
|
11
|
+
* several minor enhancements
|
12
|
+
* addition of mongrel patch method
|
13
|
+
* general fixes
|
6
14
|
|
7
15
|
== 1.0.0 2007-06-30
|
8
16
|
|
9
17
|
* Version 1.0.0 Release!
|
10
18
|
* New! Improved! Better than Ever!
|
19
|
+
|
20
|
+
== 0.0.1 2007-05-25
|
21
|
+
|
22
|
+
* 1 major enhancement:
|
23
|
+
* Initial release
|
24
|
+
* Includes all server setup tasks
|
data/lib/slingshot/recipes.rb
CHANGED
@@ -40,8 +40,8 @@ set :server_timezone, "GMT"
|
|
40
40
|
# =============================================================================
|
41
41
|
|
42
42
|
# set this to the correct web start script
|
43
|
-
set :web_server,
|
44
|
-
set :
|
43
|
+
set :web_server, "httpd"
|
44
|
+
set :path_to_web_server_logs, "/var/log/httpd"
|
45
45
|
|
46
46
|
# set this to true to add an apache redirect rule to ensure domain requests to
|
47
47
|
# http://yourdomain.com/ are redirected to http://www.yourdomain.com/
|
@@ -64,7 +64,7 @@ set :keep_releases, 3
|
|
64
64
|
set :checkout, "export"
|
65
65
|
|
66
66
|
# mongrel configuration:
|
67
|
-
set :mongrel_conf, "#{current_path}/
|
67
|
+
set :mongrel_conf, "#{current_path}/system/mongrel_cluster.yml"
|
68
68
|
|
69
69
|
# number of mongrel servers to start
|
70
70
|
set :mongrel_servers, 3
|
@@ -77,33 +77,32 @@ set :overwrite_crontab, false
|
|
77
77
|
set :crontab_email, "root@localhost"
|
78
78
|
|
79
79
|
set :mongrel_cluster_configuration_dir, "/etc/mongrel_cluster"
|
80
|
-
set :rails_apache_configuration_dir, "/etc/rails"
|
81
80
|
|
82
81
|
# =============================================================================
|
83
82
|
# RAILS APPLICATION CONFIGURATION TASKS
|
84
83
|
# =============================================================================
|
85
84
|
|
86
|
-
desc "Tasks to execute before initial setup"
|
87
|
-
task :before_setup do
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
end
|
85
|
+
# desc "Tasks to execute before initial setup"
|
86
|
+
# task :before_setup do
|
87
|
+
# sudo "mkdir -p #{File.dirname(deploy_to)}"
|
88
|
+
# sudo "chown -R #{user}:#{group} #{File.dirname(deploy_to)}"
|
89
|
+
#
|
90
|
+
# sudo "mkdir -p #{mongrel_cluster_configuration_dir}"
|
91
|
+
# sudo "mkdir -p #{rails_apache_configuration_dir}"
|
92
|
+
# end
|
94
93
|
|
95
94
|
desc "Tasks to execute after initial setup"
|
96
95
|
task :after_setup do
|
97
96
|
|
98
97
|
# make shared config dir to hold config files
|
99
|
-
run "mkdir -p #{deploy_to}/#{shared_dir}/config"
|
98
|
+
# run "mkdir -p #{deploy_to}/#{shared_dir}/config"
|
100
99
|
|
101
100
|
# make a shared tmp dir for sessions
|
102
|
-
run "mkdir -p #{deploy_to}/#{shared_dir}/tmp"
|
103
|
-
run "mkdir -p #{deploy_to}/#{shared_dir}/tmp/cache"
|
104
|
-
run "mkdir -p #{deploy_to}/#{shared_dir}/tmp/sessions"
|
105
|
-
run "mkdir -p #{deploy_to}/#{shared_dir}/tmp/sockets"
|
106
|
-
run "mkdir -p #{deploy_to}/#{shared_dir}/tmp/pids"
|
101
|
+
# run "mkdir -p #{deploy_to}/#{shared_dir}/tmp"
|
102
|
+
# run "mkdir -p #{deploy_to}/#{shared_dir}/tmp/cache"
|
103
|
+
# run "mkdir -p #{deploy_to}/#{shared_dir}/tmp/sessions"
|
104
|
+
# run "mkdir -p #{deploy_to}/#{shared_dir}/tmp/sockets"
|
105
|
+
# run "mkdir -p #{deploy_to}/#{shared_dir}/tmp/pids"
|
107
106
|
|
108
107
|
# create any other shared dirs
|
109
108
|
# run "mkdir -p #{deploy_to}/#{shared_dir}/db"
|
@@ -120,10 +119,10 @@ end
|
|
120
119
|
desc "Tasks to execute after code update"
|
121
120
|
task :after_update_code, :roles => [:app, :db] do
|
122
121
|
# relink shared deployment database configuration
|
123
|
-
run "ln -nfs #{deploy_to}/#{shared_dir}/
|
122
|
+
run "ln -nfs #{deploy_to}/#{shared_dir}/system/database.yml #{release_path}/config/database.yml"
|
124
123
|
|
125
124
|
# relink shared deployment mongrel_cluster configuration
|
126
|
-
run "ln -nfs #{deploy_to}/#{shared_dir}/
|
125
|
+
run "ln -nfs #{deploy_to}/#{shared_dir}/system/mongrel_cluster.yml #{release_path}/config/mongrel_cluster.yml"
|
127
126
|
|
128
127
|
# relink shared tmp dir (for session and cache data)
|
129
128
|
sudo "rm -rf #{release_path}/tmp" # technically shouldn't be in svn
|
@@ -147,7 +146,7 @@ cwd: #{deploy_to}/current
|
|
147
146
|
port: "#{mongrel_start_port}"
|
148
147
|
environment: production
|
149
148
|
address: 127.0.0.1
|
150
|
-
pid_file:
|
149
|
+
pid_file: /var/run/mongrel_cluster/mongrel.pid
|
151
150
|
log_file: #{deploy_to}/current/log/mongrel.log
|
152
151
|
servers: #{mongrel_servers}
|
153
152
|
user: #{user}
|
@@ -156,8 +155,8 @@ group: #{group}
|
|
156
155
|
EOF
|
157
156
|
|
158
157
|
# put mongrel configuration in shared config dir and link in /etc/mongrel_cluster
|
159
|
-
put mongrel_configuration, "#{deploy_to}/#{shared_dir}/
|
160
|
-
sudo "ln -nfs #{deploy_to}/#{shared_dir}/
|
158
|
+
put mongrel_configuration, "#{deploy_to}/#{shared_dir}/system/mongrel_cluster.yml"
|
159
|
+
sudo "ln -nfs #{deploy_to}/#{shared_dir}/system/mongrel_cluster.yml #{mongrel_cluster_configuration_dir}/#{application}.yml"
|
161
160
|
|
162
161
|
end
|
163
162
|
|
@@ -187,7 +186,7 @@ production:
|
|
187
186
|
EOF
|
188
187
|
|
189
188
|
# put database configuration in shared config dir
|
190
|
-
put database_configuration, "#{deploy_to}/#{shared_dir}/
|
189
|
+
put database_configuration, "#{deploy_to}/#{shared_dir}/system/database.yml"
|
191
190
|
end
|
192
191
|
|
193
192
|
# =============================================================================
|
@@ -7,6 +7,8 @@
|
|
7
7
|
Capistrano.configuration(:must_exist).load do
|
8
8
|
|
9
9
|
set :src_home, "/usr/local/src"
|
10
|
+
set :apache_conf_home, "/etc/httpd/conf.d"
|
11
|
+
set :apache_ssl_home, "/etc/httpd/conf/ssl"
|
10
12
|
|
11
13
|
set :apache2, "httpd-2.2.4"
|
12
14
|
set :apache2_url, "http://www.apache.org/dist/httpd/#{apache2}.tar.gz"
|
@@ -131,18 +133,24 @@ end
|
|
131
133
|
|
132
134
|
desc "Create directories, links, startup files"
|
133
135
|
task :create_startup_files_and_entries do
|
134
|
-
run "ln -s /usr/local/lib/ruby/gems/1.8/gems/mongrel_cluster-0.2
|
136
|
+
run "ln -s /usr/local/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.2/resources/mongrel_cluster /etc/init.d/mongrel_cluster"
|
135
137
|
run "chmod +x /etc/init.d/mongrel_cluster"
|
136
138
|
run "/sbin/chkconfig --level 345 mongrel_cluster on"
|
139
|
+
run "mkdir -p /etc/mongrel_cluster"
|
140
|
+
run "chown -R #{deploy_username} /etc/mongrel_cluster"
|
137
141
|
|
138
|
-
run "mkdir -p /etc/rails"
|
139
|
-
run "chown deploy -R /etc/rails"
|
142
|
+
# run "mkdir -p /etc/rails"
|
143
|
+
# run "chown deploy -R /etc/rails"
|
140
144
|
# run "chgrp deploy -R /etc/rails"
|
141
145
|
|
142
|
-
run "echo \"\" >> /usr/local/apache2/conf/httpd.conf"
|
143
|
-
run "echo \"# Added by Slingshot Install script\" >> /usr/local/apache2/conf/httpd.conf"
|
144
|
-
run "echo \"Include /etc/rails/*.conf\" >> /usr/local/apache2/conf/httpd.conf"
|
145
|
-
run "echo \"NameVirtualHost *:80\" >> /usr/local/apache2/conf/httpd.conf"
|
146
|
+
# run "echo \"\" >> /usr/local/apache2/conf/httpd.conf"
|
147
|
+
# run "echo \"# Added by Slingshot Install script\" >> /usr/local/apache2/conf/httpd.conf"
|
148
|
+
# run "echo \"Include /etc/rails/*.conf\" >> /usr/local/apache2/conf/httpd.conf"
|
149
|
+
# run "echo \"NameVirtualHost *:80\" >> /usr/local/apache2/conf/httpd.conf"
|
150
|
+
|
151
|
+
# apache
|
152
|
+
run "/etc/init.d/httpd start"
|
153
|
+
run "/sbin/chkconfig httpd on"
|
146
154
|
|
147
155
|
# mysql
|
148
156
|
run "/etc/init.d/mysqld start"
|
@@ -153,8 +161,8 @@ task :create_startup_files_and_entries do
|
|
153
161
|
run "/sbin/chkconfig sendmail on"
|
154
162
|
|
155
163
|
# yum nightly updates
|
156
|
-
run "/etc/init.d/yum start"
|
157
|
-
run "/sbin/chkconfig yum on"
|
164
|
+
run "/etc/init.d/yum-updatesd start"
|
165
|
+
run "/sbin/chkconfig yum-updatesd on"
|
158
166
|
end
|
159
167
|
|
160
168
|
desc "Setup timezone and ntpdate"
|
@@ -311,17 +319,22 @@ EOF
|
|
311
319
|
|
312
320
|
(0..mongrel_servers-1).each do |server|
|
313
321
|
monit_configuration +=<<-EOF
|
314
|
-
check process mongrel-#{mongrel_start_port + server} with pidfile #{deploy_to}/
|
322
|
+
check process mongrel-#{mongrel_start_port + server} with pidfile #{deploy_to}/shared/log/mongrel.#{mongrel_start_port + server}.pid
|
315
323
|
group mongrel
|
316
|
-
start program = "/usr/local/bin/ruby /usr/local/bin/mongrel_rails start -d -e production -p #{mongrel_start_port + server} -a 127.0.0.1 -l #{deploy_to}/current/log/mongrel.log -P #{deploy_to}/shared/log/mongrel.#{mongrel_start_port + server}.pid -c #{deploy_to}/current"
|
324
|
+
start program = "/usr/local/bin/ruby /usr/local/bin/mongrel_rails start -d -e production -p #{mongrel_start_port + server} -a 127.0.0.1 -l #{deploy_to}/current/log/mongrel.log -P #{deploy_to}/shared/log/mongrel.#{mongrel_start_port + server}.pid -c #{deploy_to}/current --user #{user} --group #{group}"
|
317
325
|
stop program = "/usr/local/bin/ruby /usr/local/bin/mongrel_rails stop -P #{deploy_to}/shared/log/mongrel.#{mongrel_start_port + server}.pid"
|
318
326
|
if totalmem > 100.0 MB for 5 cycles then restart
|
319
|
-
if failed port #{mongrel_start_port + server} protocol http with timeout
|
327
|
+
if failed port #{mongrel_start_port + server} protocol http with timeout 59 seconds then restart
|
328
|
+
if cpu is greater than 60% for 2 cycles then alert
|
329
|
+
if cpu > 80% for 5 cycles then restart
|
330
|
+
if loadavg(5min) greater than 10 for 8 cycles then restart
|
331
|
+
if 3 restarts within 5 cycles then timeout
|
320
332
|
|
321
333
|
EOF
|
322
334
|
end
|
323
335
|
|
324
|
-
put monit_configuration, "/
|
336
|
+
put monit_configuration, "#{deploy_to}/shared/system/monit_#{application}.conf"
|
337
|
+
sudo "ln -nfs #{deploy_to}/shared/system/monit_#{application}.conf /etc/monit.d/#{application}.conf"
|
325
338
|
|
326
339
|
end
|
327
340
|
|
@@ -331,10 +344,10 @@ task :apache_configuration_setup do
|
|
331
344
|
# generate web server configuration (apache specific)
|
332
345
|
apache2_rails_conf = <<-EOF
|
333
346
|
<VirtualHost *:80>
|
334
|
-
Include
|
347
|
+
Include #{apache_conf_home}/#{application}.common
|
335
348
|
|
336
|
-
ErrorLog #{
|
337
|
-
CustomLog #{
|
349
|
+
ErrorLog #{path_to_web_server_logs}/#{application}_errors_log
|
350
|
+
CustomLog #{path_to_web_server_logs}/#{application}_log combined
|
338
351
|
</VirtualHost>
|
339
352
|
EOF
|
340
353
|
|
@@ -343,7 +356,7 @@ EOF
|
|
343
356
|
apache2_rails_conf +=<<-EOF
|
344
357
|
Listen 443
|
345
358
|
<VirtualHost _default_:443>
|
346
|
-
Include
|
359
|
+
Include #{apache_conf_home}/#{application}.common
|
347
360
|
|
348
361
|
RequestHeader set X_FORWARDED_PROTO 'https'
|
349
362
|
|
@@ -351,9 +364,9 @@ EOF
|
|
351
364
|
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
|
352
365
|
|
353
366
|
# Server Certificate and CA:
|
354
|
-
SSLCertificateFile #{
|
355
|
-
SSLCertificateKeyFile #{
|
356
|
-
SSLCACertificateFile #{
|
367
|
+
SSLCertificateFile #{apache_ssl_home}/#{ssl_certificate_file}
|
368
|
+
SSLCertificateKeyFile #{apache_ssl_home}/#{ssl_certificate_key_file}
|
369
|
+
SSLCACertificateFile #{apache_ssl_home}/#{ssl_ca_certificate_file}
|
357
370
|
|
358
371
|
<IfModule setenvif_module>
|
359
372
|
BrowserMatch ".*MSIE.*" \
|
@@ -446,8 +459,8 @@ EOF
|
|
446
459
|
|
447
460
|
# if apache is setup to read /etc/rails/*.conf these will get read as configuration files
|
448
461
|
# see prerequisites above for more info
|
449
|
-
sudo "ln -nfs #{deploy_to}/#{shared_dir}/system/#{application}.conf
|
450
|
-
sudo "ln -nfs #{deploy_to}/#{shared_dir}/system/#{application}.common
|
462
|
+
sudo "ln -nfs #{deploy_to}/#{shared_dir}/system/#{application}.conf #{apache_conf_home}/#{application}.conf"
|
463
|
+
sudo "ln -nfs #{deploy_to}/#{shared_dir}/system/#{application}.common #{apache_conf_home}/#{application}.common"
|
451
464
|
|
452
465
|
end
|
453
466
|
|
@@ -470,7 +483,7 @@ EOF
|
|
470
483
|
put redirect_apache2_rails_configuration, "#{deploy_to}/#{shared_dir}/system/redirects.conf"
|
471
484
|
|
472
485
|
# since apache is setup to read /etc/rails/*.conf these will get read as configuration files
|
473
|
-
sudo "ln -nfs #{deploy_to}/#{shared_dir}/system/redirects.conf /
|
486
|
+
sudo "ln -nfs #{deploy_to}/#{shared_dir}/system/redirects.conf #{apache_conf_home}/redirects.conf"
|
474
487
|
end
|
475
488
|
end
|
476
489
|
|
@@ -506,13 +519,13 @@ HOME=/
|
|
506
519
|
|
507
520
|
# BACKUP tasks - to supress all output use: cd #{deploy_to}/current && rake s3:backup >/dev/null 2>&1
|
508
521
|
# every day at 3:00am:
|
509
|
-
00 3 * * * root cd #{deploy_to}/current && /usr/local/bin/rake RAILS_ENV=production s3:backup INCREMENT=daily >> #{deploy_to}/shared/log/backup.log && /usr/local/bin/rake RAILS_ENV=production s3:manage:clean_up KEEP=7 INCREMENT=daily >> #{deploy_to}/shared/log/backup.log
|
522
|
+
# 00 3 * * * root cd #{deploy_to}/current && /usr/local/bin/rake RAILS_ENV=production s3:backup INCREMENT=daily >> #{deploy_to}/shared/log/backup.log && /usr/local/bin/rake RAILS_ENV=production s3:manage:clean_up KEEP=7 INCREMENT=daily >> #{deploy_to}/shared/log/backup.log
|
510
523
|
# every sunday at 3:22am:
|
511
|
-
22 3 * * 0 root cd #{deploy_to}/current && /usr/local/bin/rake RAILS_ENV=production s3:backup INCREMENT=weekly >> #{deploy_to}/shared/log/backup.log && /usr/local/bin/rake RAILS_ENV=production s3:manage:clean_up KEEP=5 INCREMENT=weekly >> #{deploy_to}/shared/log/backup.log
|
524
|
+
# 22 3 * * 0 root cd #{deploy_to}/current && /usr/local/bin/rake RAILS_ENV=production s3:backup INCREMENT=weekly >> #{deploy_to}/shared/log/backup.log && /usr/local/bin/rake RAILS_ENV=production s3:manage:clean_up KEEP=5 INCREMENT=weekly >> #{deploy_to}/shared/log/backup.log
|
512
525
|
# every 1st of month at 3:42am:
|
513
|
-
42 3 1 * * root cd #{deploy_to}/current && /usr/local/bin/rake RAILS_ENV=production s3:backup INCREMENT=monthly >> #{deploy_to}/shared/log/backup.log && /usr/local/bin/rake RAILS_ENV=production s3:manage:clean_up KEEP=12 INCREMENT=monthly >> #{deploy_to}/shared/log/backup.log
|
526
|
+
# 42 3 1 * * root cd #{deploy_to}/current && /usr/local/bin/rake RAILS_ENV=production s3:backup INCREMENT=monthly >> #{deploy_to}/shared/log/backup.log && /usr/local/bin/rake RAILS_ENV=production s3:manage:clean_up KEEP=12 INCREMENT=monthly >> #{deploy_to}/shared/log/backup.log
|
514
527
|
# every year on dec 31 at 4:00am:
|
515
|
-
00 4 31 12 * root cd #{deploy_to}/current && /usr/local/bin/rake RAILS_ENV=production s3:backup INCREMENT=yearly >> #{deploy_to}/shared/log/backup.log && /usr/local/bin/rake RAILS_ENV=production s3:manage:clean_up KEEP=1 INCREMENT=yearly >> #{deploy_to}/shared/log/backup.log
|
528
|
+
# 00 4 31 12 * root cd #{deploy_to}/current && /usr/local/bin/rake RAILS_ENV=production s3:backup INCREMENT=yearly >> #{deploy_to}/shared/log/backup.log && /usr/local/bin/rake RAILS_ENV=production s3:manage:clean_up KEEP=1 INCREMENT=yearly >> #{deploy_to}/shared/log/backup.log
|
516
529
|
|
517
530
|
# resync time at 2:59am:
|
518
531
|
59 2 * * * root /usr/sbin/ntpdate 0.pool.ntp.org
|
data/lib/slingshot/version.rb
CHANGED
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>Slingshot</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/slingshot"; return false'>
|
35
35
|
Get Version
|
36
|
-
<a href="http://rubyforge.org/projects/slingshot" class="numbers">1.0
|
36
|
+
<a href="http://rubyforge.org/projects/slingshot" class="numbers">1.1.0</a>
|
37
37
|
</div>
|
38
38
|
<h2>What</h2>
|
39
39
|
|
@@ -188,7 +188,7 @@ just holler at the Highgroove Studios or Slingshot Hosting team.</p>
|
|
188
188
|
|
189
189
|
<p>Comments are welcome. Send an email to <a href="mailto:cbq@highgroove.com">Charles Brian Quinn</a>.</p>
|
190
190
|
<p class="coda">
|
191
|
-
<a href="mailto:cbq@highgroove.com">Charles Brian Quinn</a>,
|
191
|
+
<a href="mailto:cbq@highgroove.com">Charles Brian Quinn</a>, 2nd July 2007<br>
|
192
192
|
Gem packager/webpage/scripts by <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a><br>
|
193
193
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
194
194
|
</p>
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: slingshot
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0
|
7
|
-
date: 2007-07-
|
6
|
+
version: 1.1.0
|
7
|
+
date: 2007-07-13 00:00:00 -04:00
|
8
8
|
summary: Set of server setup tasks for use with Slingshot Hosting
|
9
9
|
require_paths:
|
10
10
|
- lib
|