nesquena-cap-recipes 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.textile +42 -0
- data/VERSION.yml +1 -1
- data/lib/cap_recipes/tasks/apache.rb +4 -4
- data/lib/cap_recipes/tasks/backgroundrb.rb +2 -2
- data/lib/cap_recipes/tasks/juggernaut.rb +3 -3
- data/lib/cap_recipes/tasks/memcache.rb +5 -4
- data/lib/cap_recipes/tasks/passenger.rb +7 -7
- data/test/cap_recipes_test.rb +1 -3
- metadata +1 -1
data/README.textile
CHANGED
@@ -126,6 +126,48 @@ h4. Tasks
|
|
126
126
|
:stop
|
127
127
|
:restart
|
128
128
|
:install
|
129
|
+
|
130
|
+
h2. EXAMPLE
|
131
|
+
|
132
|
+
Here is a sample deploy.rb file using cap_recipes:
|
133
|
+
|
134
|
+
<pre>
|
135
|
+
<code>
|
136
|
+
# =============================================================================
|
137
|
+
# GENERAL SETTINGS
|
138
|
+
# =============================================================================
|
139
|
+
|
140
|
+
set :application, "app_name"
|
141
|
+
set :deploy_to, "/var/apps/#{application}"
|
142
|
+
set :scm, :git
|
143
|
+
set :repository, "git@repos.site.com:/home/git/repos.git"
|
144
|
+
|
145
|
+
# =============================================================================
|
146
|
+
# CAP RECIPES
|
147
|
+
# =============================================================================
|
148
|
+
|
149
|
+
# Note this happens after the general settings have been defined
|
150
|
+
require 'rubygems'
|
151
|
+
require 'cap_recipes'
|
152
|
+
|
153
|
+
# PASSENGER
|
154
|
+
set :base_ruby_path, '/opt/ruby-enterprise' # defaults to "/usr"
|
155
|
+
set :apache_init_path, '/etc/init.d/apache2' # defaults to "/etc/init.d/apache2"
|
156
|
+
|
157
|
+
# BACKGROUNDRB
|
158
|
+
set :backgroundrb_log, "/var/log/backgroundrb.log" # defaults to "#{release_path}/log/backgroundrb.log"
|
159
|
+
set :backgroundrb_host, "worker.site.com" # defaults to localhost
|
160
|
+
set :backgroundrb_env, "staging" # defaults to production
|
161
|
+
|
162
|
+
# JUGGERNAUT
|
163
|
+
set :juggernaut_config, "/some/path/juggernaut.yml" # defaults to "#{current_path}/config/juggernaut.yml"
|
164
|
+
set :juggernaut_pid, "/some/path/juggernaut.pid" # defaults to "#{current_path}/tmp/pids/juggernaut.pid"
|
165
|
+
set :juggernaut_log, "/var/log/juggernaut.log" # defaults to #{release_path}/log/juggernaut.log
|
166
|
+
|
167
|
+
# MEMCACHE
|
168
|
+
set :memcache_init_path, "/etc/init.d/memcache" # defaults to "/etc/init.d/memcache"
|
169
|
+
</code>
|
170
|
+
</pre>
|
129
171
|
|
130
172
|
h2. LICENSE:
|
131
173
|
|
data/VERSION.yml
CHANGED
@@ -10,19 +10,19 @@ Capistrano::Configuration.instance(true).load do
|
|
10
10
|
desc "Stops the apache web server"
|
11
11
|
task :stop, :roles => :web do
|
12
12
|
puts "Stopping the apache server"
|
13
|
-
|
13
|
+
try_sudo "#{apache_init_path} stop"
|
14
14
|
end
|
15
15
|
|
16
16
|
desc "Starts the apache web server"
|
17
17
|
task :start, :roles => :web do
|
18
18
|
puts "Starting the apache server"
|
19
|
-
|
19
|
+
try_sudo "#{apache_init_path} start"
|
20
20
|
end
|
21
21
|
|
22
22
|
desc "Restarts the apache web server"
|
23
23
|
task :restart, :roles => :web do
|
24
24
|
puts "Restarting the apache server"
|
25
|
-
|
25
|
+
try_sudo "#{apache_init_path} restart"
|
26
26
|
end
|
27
27
|
|
28
28
|
# ===============================================================
|
@@ -32,7 +32,7 @@ Capistrano::Configuration.instance(true).load do
|
|
32
32
|
desc 'Installs apache 2 and development headers to compile passenger'
|
33
33
|
task :install, :roles => :web do
|
34
34
|
puts 'Installing apache 2'
|
35
|
-
|
35
|
+
try_sudo 'apt-get install apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapr1 libapr1-dev libaprutil1 libmagic1 libpcre3 libpq5 openssl apache2-prefork-dev -y'
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -60,8 +60,8 @@ Capistrano::Configuration.instance(true).load do
|
|
60
60
|
desc "Repair permissions to allow user to perform all actions"
|
61
61
|
task :repair_permissions, :roles => :app do
|
62
62
|
puts "Applying correct permissions to allow for proper command execution"
|
63
|
-
|
64
|
-
|
63
|
+
try_sudo "chown -R #{user}:#{user} #{current_path}"
|
64
|
+
try_sudo "chown -R #{user}:#{user} #{current_path}/tmp"
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -11,13 +11,13 @@ Capistrano::Configuration.instance(true).load do
|
|
11
11
|
desc "Starts the juggernaut push server"
|
12
12
|
task :start, :roles => :app do
|
13
13
|
puts "Starting juggernaut push server"
|
14
|
-
|
14
|
+
try_sudo "juggernaut -c #{juggernaut_config} -d --pid #{juggernaut_pid} --log #{juggernaut_log}"
|
15
15
|
end
|
16
16
|
|
17
17
|
desc "Stops the juggernaut push server"
|
18
18
|
task :stop, :roles => :app do
|
19
19
|
puts "Stopping juggernaut push server"
|
20
|
-
|
20
|
+
try_sudo "juggernaut -c #{juggernaut_config} -k * --pid #{juggernaut_pid} --log #{juggernaut_log}"
|
21
21
|
end
|
22
22
|
|
23
23
|
desc "Restarts the juggernaut push server"
|
@@ -32,7 +32,7 @@ Capistrano::Configuration.instance(true).load do
|
|
32
32
|
|
33
33
|
desc "Copies the shared/config/juggernaut yaml to release/config/"
|
34
34
|
task :copy_config, :roles => :app do
|
35
|
-
|
35
|
+
try_sudo "ln -s #{shared_path}/config/juggernaut.yml #{release_path}/config/juggernaut.yml"
|
36
36
|
end
|
37
37
|
|
38
38
|
desc "Displays the juggernaut log from the server"
|
@@ -10,19 +10,20 @@ Capistrano::Configuration.instance(true).load do
|
|
10
10
|
desc "Stops the memcache server"
|
11
11
|
task :stop, :roles => :app do
|
12
12
|
puts "Stopping the memcache server"
|
13
|
-
|
13
|
+
try_sudo "#{memcache_init_path} stop"
|
14
14
|
end
|
15
15
|
|
16
16
|
desc "Starts the memcache server"
|
17
17
|
task :start, :roles => :app do
|
18
18
|
puts "Starting the memcache server"
|
19
|
-
|
19
|
+
try_sudo "#{memcache_init_path} start"
|
20
20
|
end
|
21
21
|
|
22
22
|
desc "Restarts the memcache server"
|
23
23
|
task :restart, :roles => :app do
|
24
24
|
puts "Restarting the memcache server"
|
25
25
|
memcache.stop
|
26
|
+
sleep(5) # sleep for 5 seconds to make sure the server has mopped up everything
|
26
27
|
memcache.start
|
27
28
|
end
|
28
29
|
|
@@ -33,8 +34,8 @@ Capistrano::Configuration.instance(true).load do
|
|
33
34
|
desc 'Installs memcache and the ruby gem'
|
34
35
|
task :install, :roles => :app do
|
35
36
|
puts 'Installing memcache'
|
36
|
-
|
37
|
-
|
37
|
+
try_sudo 'apt-get install memcached'
|
38
|
+
try_sudo "#{base_ruby_path}/bin/gem install memcache-client --no-ri --no-rdoc"
|
38
39
|
memcache.start
|
39
40
|
end
|
40
41
|
end
|
@@ -55,15 +55,15 @@ Capistrano::Configuration.instance(true).load do
|
|
55
55
|
desc "Copies the shared/config/database yaml to release/config/"
|
56
56
|
task :copy_config, :roles => :web do
|
57
57
|
puts "Copying database configuration to release path"
|
58
|
-
|
58
|
+
try_sudo "ln -s #{shared_path}/config/database.yml #{release_path}/config/database.yml"
|
59
59
|
end
|
60
60
|
|
61
61
|
desc "Repair permissions to allow user to perform all actions"
|
62
62
|
task :repair_permissions, :roles => :web do
|
63
63
|
puts "Applying correct permissions to allow for proper command execution"
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
try_sudo "chmod -R 744 #{current_path}/log #{current_path}/tmp"
|
65
|
+
try_sudo "chown -R #{user}:#{user} #{current_path}"
|
66
|
+
try_sudo "chown -R #{user}:#{user} #{current_path}/tmp"
|
67
67
|
end
|
68
68
|
|
69
69
|
desc "Displays the production log from the server locally"
|
@@ -81,7 +81,7 @@ Capistrano::Configuration.instance(true).load do
|
|
81
81
|
|
82
82
|
desc "Updates all installed ruby gems"
|
83
83
|
task :gems, :roles => :web do
|
84
|
-
|
84
|
+
try_sudo "gem update"
|
85
85
|
end
|
86
86
|
|
87
87
|
desc "Installs Phusion Passenger"
|
@@ -93,7 +93,7 @@ Capistrano::Configuration.instance(true).load do
|
|
93
93
|
|
94
94
|
desc "Setup Passenger Module"
|
95
95
|
task :passenger_apache_module, :roles => :web do
|
96
|
-
|
96
|
+
try_sudo "#{base_ruby_path}/bin/gem install passenger --no-ri --no-rdoc"
|
97
97
|
input = ''
|
98
98
|
run "sudo #{base_ruby_path}/bin/passenger-install-apache2-module" do |ch, stream, out|
|
99
99
|
next if out.chomp == input.chomp || out.chomp == ''
|
@@ -120,7 +120,7 @@ Capistrano::Configuration.instance(true).load do
|
|
120
120
|
EOF
|
121
121
|
|
122
122
|
put passenger_config, "/tmp/passenger"
|
123
|
-
|
123
|
+
try_sudo "mv /tmp/passenger /etc/apache2/conf.d/passenger"
|
124
124
|
apache.restart
|
125
125
|
end
|
126
126
|
|
data/test/cap_recipes_test.rb
CHANGED