slingshot 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/slingshot/recipes.rb +1 -1
- data/lib/slingshot/server_setup.rb +80 -0
- data/lib/slingshot/version.rb +1 -1
- data/website/index.html +18 -2
- data/website/index.txt +15 -0
- metadata +2 -2
data/lib/slingshot/recipes.rb
CHANGED
@@ -144,12 +144,17 @@ task :create_startup_files_and_entries do
|
|
144
144
|
run "echo \"Include /etc/rails/*.conf\" >> /usr/local/apache2/conf/httpd.conf"
|
145
145
|
run "echo \"NameVirtualHost *:80\" >> /usr/local/apache2/conf/httpd.conf"
|
146
146
|
|
147
|
+
# mysql
|
147
148
|
run "/etc/init.d/mysqld start"
|
148
149
|
run "/sbin/chkconfig mysqld on"
|
149
150
|
|
150
151
|
# sendmail
|
151
152
|
run "/etc/init.d/sendmail start"
|
152
153
|
run "/sbin/chkconfig sendmail on"
|
154
|
+
|
155
|
+
# yum nightly updates
|
156
|
+
run "/etc/init.d/yum start"
|
157
|
+
run "/sbin/chkconfig yum on"
|
153
158
|
end
|
154
159
|
|
155
160
|
desc "Setup timezone and ntpdate"
|
@@ -542,4 +547,79 @@ EOF
|
|
542
547
|
run "mysql -u root < #{deploy_to}/#{shared_dir}/system/mysql_setup_file.sql"
|
543
548
|
end
|
544
549
|
|
550
|
+
desc "Setup Daily tasks"
|
551
|
+
task :setup_daily_tasks do
|
552
|
+
svn_backup_cron_job = render :template => <<-EOF
|
553
|
+
#~/bin/bash
|
554
|
+
# backup and make hotcopies of svn repos
|
555
|
+
# ex:
|
556
|
+
# svnadmin hotcopy /var/svn/repos/simple /backups/svn/simple
|
557
|
+
|
558
|
+
svnAdmin="/usr/local/bin/svnadmin"
|
559
|
+
svnDirs=`find /var/svn/repos/* -type d -prune`
|
560
|
+
backupDir="/backups/svn/"
|
561
|
+
|
562
|
+
# hotcopy expects an empty directory
|
563
|
+
rm -rf $backupDir
|
564
|
+
mkdir -p $backupDir
|
565
|
+
|
566
|
+
for dir in $svnDirs; do
|
567
|
+
appName=`basename $dir`
|
568
|
+
$svnAdmin hotcopy $dir $backupDir/$appName
|
569
|
+
done
|
570
|
+
EOF
|
571
|
+
|
572
|
+
put svn_backup_cron_job, "#{deploy_to}/#{shared_dir}/system/svn_backup.sh"
|
573
|
+
sudo "ln -nfs #{deploy_to}/#{shared_dir}/system/svn_backup.sh /etc/cron.daily/svn_backup.sh"
|
574
|
+
sudo "chmod +x /etc/cron.daily/svn_backup.sh"
|
575
|
+
|
576
|
+
mysql_backup_cron_job = render :template => <<-EOF
|
577
|
+
#!/bin/bash
|
578
|
+
# backup all databases
|
579
|
+
mkdir -p /backups/mysql
|
580
|
+
/usr/bin/mysqldump --user=root --all-databases > /backups/mysql/mysqldump_all_databases.sql
|
581
|
+
EOF
|
582
|
+
|
583
|
+
put mysql_backup_cron_job, "#{deploy_to}/#{shared_dir}/system/mysql_backup.sh"
|
584
|
+
sudo "ln -nfs #{deploy_to}/#{shared_dir}/system/mysql_backup.sh /etc/cron.daily/mysql_backup.sh"
|
585
|
+
sudo "chmod +x /etc/cron.daily/mysql_backup.sh"
|
586
|
+
|
587
|
+
end
|
588
|
+
|
589
|
+
desc "Patch mongrel to remove stale PIDS"
|
590
|
+
task :patch_mongrel_to_remove_stale_pids do
|
591
|
+
|
592
|
+
mongrel_patch_to_remove_stale_pids = render :template => <<-'EOF'
|
593
|
+
--- bin/mongrel_rails-orig 2007-04-13 09:44:11.000000000 +0300
|
594
|
+
+++ bin/mongrel_rails 2007-04-13 10:00:39.000000000 +0300
|
595
|
+
@@ -83,10 +83,18 @@
|
596
|
+
config = Mongrel::Rails::RailsConfigurator.new(settings) do
|
597
|
+
if defaults[:daemon]
|
598
|
+
if File.exist? defaults[:pid_file]
|
599
|
+
- log "!!! PID file #{defaults[:pid_file]} already exists. Mongrel could be running already. Check your #{defaults[:log_file]} for errors."
|
600
|
+
- log "!!! Exiting with error. You must stop mongrel and clear the .pid before I'll attempt a start."
|
601
|
+
- exit 1
|
602
|
+
- end
|
603
|
+
+ # mongrels that crash can leave stale PID files behind, and these
|
604
|
+
+ # should not stop mongrel from being restarted by monitors...
|
605
|
+
+ pid = File.new(defaults[:pid_file]).readline
|
606
|
+
+ unless `ps -ef | grep #{pid} | grep -v grep`.length > 0
|
607
|
+
+ # use "ps ax" for freebsd
|
608
|
+
+ log "!!! PID file #{defaults[:pid_file]} exists, but is stale, and will be deleted so that this mongrel can run."
|
609
|
+
+ File.delete(defaults[:pid_file])
|
610
|
+
+ else
|
611
|
+
+ log "!!! PID file #{defaults[:pid_file]} already exists and the process id referred to in it is running. This mongrel is probably already running. #{defaults[:log_file]} for errors. EXITING."
|
612
|
+
+ exit 1
|
613
|
+
+ end
|
614
|
+
+ end
|
615
|
+
|
616
|
+
daemonize
|
617
|
+
log "Daemonized, any open files are closed. Look at #{defaults[:pid_file]} and #{defaults[:log_file]} for info."
|
618
|
+
EOF
|
619
|
+
|
620
|
+
put mongrel_patch_to_remove_stale_pids, "/tmp/mongrel_patch_to_remove_stale_pids.patch"
|
621
|
+
run "cd /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1 && sudo patch -p0 < /tmp/mongrel_patch_to_remove_stale_pids.patch"
|
622
|
+
end
|
623
|
+
|
624
|
+
|
545
625
|
end # end capistrano extensions
|
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.0.1</a>
|
37
37
|
</div>
|
38
38
|
<h2>What</h2>
|
39
39
|
|
@@ -108,11 +108,27 @@ config/deploy.rb:</p>
|
|
108
108
|
|
109
109
|
|
110
110
|
<pre syntax="ruby">
|
111
|
+
set :application, "application"
|
112
|
+
set :repository, "http://svn.yourhost.com/#{application}/trunk"
|
113
|
+
|
111
114
|
set :server_name, 'daytona.slingshothosting.com'
|
112
115
|
set :server_ip, '1.2.3.4'
|
113
116
|
set :server_fqdn, 'daytona.slingshothosting.com'
|
114
117
|
|
115
118
|
set :domain_name, 'yourdomain.com'
|
119
|
+
|
120
|
+
set :user, 'deploy'
|
121
|
+
set :password, 'password'
|
122
|
+
|
123
|
+
set :deploy_to, "/var/www/apps/#{application}"
|
124
|
+
</pre>
|
125
|
+
|
126
|
+
<p>You can also optionally set a valid timezone such as <span class="caps">EST</span>, EST5EDT,
|
127
|
+
<span class="caps">CST6DT</span>, MST, or <span class="caps">PST8PDT</span> (the default is <span class="caps">GMT</span>):</p>
|
128
|
+
|
129
|
+
|
130
|
+
<pre syntax="ruby">
|
131
|
+
set :server_timezone, 'GMT'
|
116
132
|
</pre>
|
117
133
|
|
118
134
|
<p>Let’s do a pretend setup to see what happens:</p>
|
@@ -172,7 +188,7 @@ just holler at the Highgroove Studios or Slingshot Hosting team.</p>
|
|
172
188
|
|
173
189
|
<p>Comments are welcome. Send an email to <a href="mailto:cbq@highgroove.com">Charles Brian Quinn</a>.</p>
|
174
190
|
<p class="coda">
|
175
|
-
<a href="mailto:cbq@highgroove.com">Charles Brian Quinn</a>,
|
191
|
+
<a href="mailto:cbq@highgroove.com">Charles Brian Quinn</a>, 1st July 2007<br>
|
176
192
|
Gem packager/webpage/scripts by <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a><br>
|
177
193
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
178
194
|
</p>
|
data/website/index.txt
CHANGED
@@ -56,11 +56,26 @@ We now need to configure a few variables, simply add these to the
|
|
56
56
|
config/deploy.rb:
|
57
57
|
|
58
58
|
<pre syntax="ruby">
|
59
|
+
set :application, "application"
|
60
|
+
set :repository, "http://svn.yourhost.com/#{application}/trunk"
|
61
|
+
|
59
62
|
set :server_name, 'daytona.slingshothosting.com'
|
60
63
|
set :server_ip, '1.2.3.4'
|
61
64
|
set :server_fqdn, 'daytona.slingshothosting.com'
|
62
65
|
|
63
66
|
set :domain_name, 'yourdomain.com'
|
67
|
+
|
68
|
+
set :user, 'deploy'
|
69
|
+
set :password, 'password'
|
70
|
+
|
71
|
+
set :deploy_to, "/var/www/apps/#{application}"
|
72
|
+
</pre>
|
73
|
+
|
74
|
+
You can also optionally set a valid timezone such as EST, EST5EDT,
|
75
|
+
CST6DT, MST, or PST8PDT (the default is GMT):
|
76
|
+
|
77
|
+
<pre syntax="ruby">
|
78
|
+
set :server_timezone, 'GMT'
|
64
79
|
</pre>
|
65
80
|
|
66
81
|
Let's do a pretend setup to see what happens:
|
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.0.1
|
7
|
+
date: 2007-07-02 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
|