cap-recipes 0.3.27 → 0.3.28
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 +48 -32
- data/VERSION.yml +1 -1
- data/cap-recipes.gemspec +6 -2
- data/lib/cap_recipes/tasks/thinking_sphinx.rb +1 -0
- data/lib/cap_recipes/tasks/thinking_sphinx/hooks.rb +4 -0
- data/lib/cap_recipes/tasks/thinking_sphinx/install.rb +17 -0
- data/lib/cap_recipes/tasks/thinking_sphinx/manage.rb +65 -0
- data/lib/cap_recipes/tasks/utilities.rb +1 -0
- metadata +6 -2
data/README.textile
CHANGED
@@ -17,6 +17,7 @@ Currently included recipes in this gem:
|
|
17
17
|
* Apache Server
|
18
18
|
* Phusion Passenger
|
19
19
|
* Memcached Management
|
20
|
+
* ThinkingSphinx Daemon
|
20
21
|
* Juggernaut Daemon
|
21
22
|
* Backgroundrb Server
|
22
23
|
* DelayedJob Worker
|
@@ -33,8 +34,7 @@ To install the gem, execute:
|
|
33
34
|
|
34
35
|
Then, include into your @deploy.rb@ configuration file for Capistrano:
|
35
36
|
|
36
|
-
<pre>
|
37
|
-
<code>
|
37
|
+
<pre><code>
|
38
38
|
# use the complete deployment process (NOT RECOMMENDED)
|
39
39
|
require 'cap_recipes'
|
40
40
|
|
@@ -44,6 +44,7 @@ Then, include into your @deploy.rb@ configuration file for Capistrano:
|
|
44
44
|
# tasks for managing and tasks for installing):
|
45
45
|
require 'cap_recipes/tasks/memcache'
|
46
46
|
require 'cap_recipes/tasks/passenger'
|
47
|
+
require 'cap_recipes/tasks/thinking_sphinx'
|
47
48
|
# or ruby, rubygems, rails, apache, delayed_job, juggernaut, backgroundrb, aptitude, whenever
|
48
49
|
|
49
50
|
# OR
|
@@ -53,8 +54,7 @@ Then, include into your @deploy.rb@ configuration file for Capistrano:
|
|
53
54
|
# OR
|
54
55
|
#only use install tasks:
|
55
56
|
require 'cap_recipes/tasks/memcache/install'
|
56
|
-
</code>
|
57
|
-
</pre>
|
57
|
+
</code></pre>
|
58
58
|
|
59
59
|
You can find full examples of what your @deploy.rb@ file should look like in the @examples@ folder.
|
60
60
|
|
@@ -168,14 +168,12 @@ manage.rb
|
|
168
168
|
|
169
169
|
hooks.rb
|
170
170
|
|
171
|
-
<pre>
|
172
|
-
<code>
|
171
|
+
<pre><code>
|
173
172
|
after "deploy:update_code", "rails:symlink_db_config" # copy database.yml file to release path
|
174
173
|
after "deploy:update_code", "rails:sweep:cache" # clear cache after updating code
|
175
174
|
after "deploy:restart" , "rails:repair_permissions" # fix the permissions to work properly
|
176
175
|
after "deploy:restart" , "rails:ping" # ping passenger to start the rails instance
|
177
|
-
</code>
|
178
|
-
</pre>
|
176
|
+
</code></pre>
|
179
177
|
|
180
178
|
h3. DelayedJob
|
181
179
|
|
@@ -196,13 +194,11 @@ manage.rb
|
|
196
194
|
|
197
195
|
hooks.rb
|
198
196
|
|
199
|
-
<pre>
|
200
|
-
<code>
|
197
|
+
<pre><code>
|
201
198
|
after "deploy:start", "delayed_job:start"
|
202
199
|
after "deploy:stop", "delayed_job:stop"
|
203
200
|
after "deploy:restart", "delayed_job:restart"
|
204
|
-
</code>
|
205
|
-
</pre>
|
201
|
+
</code></pre>
|
206
202
|
|
207
203
|
h3. Backgroundrb
|
208
204
|
|
@@ -226,13 +222,11 @@ manage.rb
|
|
226
222
|
|
227
223
|
hooks.rb
|
228
224
|
|
229
|
-
<pre>
|
230
|
-
<code>
|
225
|
+
<pre><code>
|
231
226
|
after "deploy:update_code" , "backgroundrb:symlink_config" # copy backgroundrb config to release
|
232
227
|
after "deploy:restart" , "backgroundrb:restart" # restart backgroundrb daemon
|
233
228
|
after "backgroundrb:restart" , "backgroundrb:repair_permissions" # restart backgroundrb damon
|
234
|
-
</code>
|
235
|
-
</pre>
|
229
|
+
</code></pre>
|
236
230
|
|
237
231
|
h3. Juggernaut
|
238
232
|
|
@@ -256,12 +250,40 @@ manage.rb
|
|
256
250
|
|
257
251
|
hooks.rb
|
258
252
|
|
259
|
-
<pre>
|
260
|
-
<code>
|
253
|
+
<pre><code>
|
261
254
|
after "deploy:update_code", "juggernaut:symlink_config" # copy juggernaut.yml to release
|
262
255
|
after "deploy:restart" , "juggernaut:restart" # restart juggernaut daemon
|
263
|
-
</code>
|
264
|
-
|
256
|
+
</code></pre>
|
257
|
+
|
258
|
+
h3. ThinkingSphinx
|
259
|
+
|
260
|
+
These recipes are for managing the thinking_sphinx search index daemon
|
261
|
+
|
262
|
+
h4. Configuration
|
263
|
+
|
264
|
+
* None required
|
265
|
+
|
266
|
+
h4. Tasks
|
267
|
+
|
268
|
+
manage.rb
|
269
|
+
|
270
|
+
* thinking_sphinx:start - starts the thinking_sphinx search daemon
|
271
|
+
* thinking_sphinx:index - executes the thinking_sphinx search indexer
|
272
|
+
* thinking_sphinx:stop - stop the thinking_sphinx search daemon
|
273
|
+
* thinking_sphinx:restart - restart (and index) the thinking_sphinx search daemon
|
274
|
+
* thinking_sphinx:symlink_config - copy sphinx.yml from shared/config to release
|
275
|
+
* thinking_sphinx:tail - tails the juggernaut log file in production
|
276
|
+
|
277
|
+
install.rb
|
278
|
+
|
279
|
+
* thinking_sphinx:install - installs sphinx, dependencies, and thinking_sphinx gem
|
280
|
+
|
281
|
+
hooks.rb
|
282
|
+
|
283
|
+
<pre><code>
|
284
|
+
after "deploy:update_code", "thinking_sphinx:symlink_config" # sym thinking_sphinx.yml on update code
|
285
|
+
after "deploy:restart" , "thinking_sphinx:restart" # restart thinking_sphinx on app restart
|
286
|
+
</code></pre>
|
265
287
|
|
266
288
|
h3. Memcache
|
267
289
|
|
@@ -289,11 +311,9 @@ install.rb
|
|
289
311
|
|
290
312
|
hooks.rb
|
291
313
|
|
292
|
-
<pre>
|
293
|
-
<code>
|
314
|
+
<pre><code>
|
294
315
|
after "deploy:restart", "memcache:restart" # clear cache after updating code
|
295
|
-
</code>
|
296
|
-
</pre>
|
316
|
+
</code></pre>
|
297
317
|
|
298
318
|
h3. Whenever
|
299
319
|
|
@@ -311,18 +331,15 @@ manage.rb
|
|
311
331
|
|
312
332
|
hooks.rb
|
313
333
|
|
314
|
-
<pre>
|
315
|
-
<code>
|
334
|
+
<pre><code>
|
316
335
|
after "deploy:symlink", "whenever:update_crontab"
|
317
|
-
</code>
|
318
|
-
</pre>
|
336
|
+
</code></pre>
|
319
337
|
|
320
338
|
h2. EXAMPLE
|
321
339
|
|
322
340
|
Here is a sample deploy.rb file using cap_recipes:
|
323
341
|
|
324
|
-
<pre>
|
325
|
-
<code>
|
342
|
+
<pre><code>
|
326
343
|
# =============================================================================
|
327
344
|
# GENERAL SETTINGS
|
328
345
|
# =============================================================================
|
@@ -364,8 +381,7 @@ set :juggernaut_log, "/var/log/juggernaut.log" # defaults to #{release_path}/log
|
|
364
381
|
# MEMCACHE
|
365
382
|
require 'cap_recipes/tasks/memcache'
|
366
383
|
set :memcache_init_path, "/etc/init.d/memcache" # defaults to "/etc/init.d/memcache"
|
367
|
-
</code>
|
368
|
-
</pre>
|
384
|
+
</code></pre>
|
369
385
|
|
370
386
|
You can find more examples of what your @deploy.rb@ file should look like in the @examples@ folder.
|
371
387
|
|
data/VERSION.yml
CHANGED
data/cap-recipes.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cap-recipes}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.28"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nathan Esquenazi"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-16}
|
13
13
|
s.description = %q{Battle-tested capistrano recipes for debian, passenger, apache, delayed_job, juggernaut, rubygems, backgroundrb, rails and more}
|
14
14
|
s.email = %q{nesquena@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -57,6 +57,10 @@ Gem::Specification.new do |s|
|
|
57
57
|
"lib/cap_recipes/tasks/rubygems.rb",
|
58
58
|
"lib/cap_recipes/tasks/rubygems/install.rb",
|
59
59
|
"lib/cap_recipes/tasks/rubygems/manage.rb",
|
60
|
+
"lib/cap_recipes/tasks/thinking_sphinx.rb",
|
61
|
+
"lib/cap_recipes/tasks/thinking_sphinx/hooks.rb",
|
62
|
+
"lib/cap_recipes/tasks/thinking_sphinx/install.rb",
|
63
|
+
"lib/cap_recipes/tasks/thinking_sphinx/manage.rb",
|
60
64
|
"lib/cap_recipes/tasks/utilities.rb",
|
61
65
|
"lib/cap_recipes/tasks/whenever.rb",
|
62
66
|
"lib/cap_recipes/tasks/whenever/hooks.rb",
|
@@ -0,0 +1 @@
|
|
1
|
+
Dir[File.join(File.dirname(__FILE__), 'thinking_sphinx/*.rb')].sort.each { |lib| require lib }
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../utilities')
|
2
|
+
|
3
|
+
Capistrano::Configuration.instance(true).load do
|
4
|
+
namespace :thinking_sphinx do
|
5
|
+
desc 'Installs sphinx and thinking_sphinx'
|
6
|
+
task :install, :roles => :app do
|
7
|
+
puts 'Installing thinking_sphinx'
|
8
|
+
utilities.apt_upgrade
|
9
|
+
utilities.apt_install 'build-essential libmysqlclient15-dev libmysql++-dev'
|
10
|
+
run "cd /tmp; #{sudo} wget http://www.sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz"
|
11
|
+
run "cd /tmp; #{sudo} tar xvzf sphinx-0.9.8.1.tar.gz"
|
12
|
+
run "cd /tmp/sphinx-0.9.8.1/; ./configure --with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib/mysql"
|
13
|
+
run "cd /tmp/sphinx-0.9.8.1/; #{sudo} make; #{sudo} make install"
|
14
|
+
sudo "gem install thinking-sphinx --source http://gemcutter.org --no-ri --no-rdoc"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
Capistrano::Configuration.instance(true).load do
|
2
|
+
set :sphinx_role, :app
|
3
|
+
|
4
|
+
namespace :thinking_sphinx do
|
5
|
+
# ===============================================================
|
6
|
+
# PROCESS MANAGEMENT
|
7
|
+
# ===============================================================
|
8
|
+
|
9
|
+
desc "Starts the thinking sphinx searchd server"
|
10
|
+
task :start, :roles => sphinx_role do
|
11
|
+
utilities.with_role(sphinx_role) do
|
12
|
+
puts "Starting thinking sphinx searchd server"
|
13
|
+
rake = fetch(:rake, "rake")
|
14
|
+
rails_env = fetch(:rails_env, "production")
|
15
|
+
|
16
|
+
run "cd #{current_path}; #{rake} RAILS_ENV=#{rails_env} thinking_sphinx:configure"
|
17
|
+
run "cd #{current_path}; #{rake} RAILS_ENV=#{rails_env} ts:start"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Stops the thinking sphinx searchd server"
|
22
|
+
task :stop, :roles => sphinx_role do
|
23
|
+
utilities.with_role(sphinx_role) do
|
24
|
+
puts "Stopping thinking sphinx searchd server"
|
25
|
+
rake = fetch(:rake, "rake")
|
26
|
+
rails_env = fetch(:rails_env, "production")
|
27
|
+
|
28
|
+
run "cd #{current_path}; #{rake} RAILS_ENV=#{rails_env} thinking_sphinx:configure"
|
29
|
+
run "cd #{current_path}; #{rake} RAILS_ENV=#{rails_env} ts:stop"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Restarts the thinking sphinx searchd server"
|
34
|
+
task :restart, :roles => sphinx_role do
|
35
|
+
utilities.with_role(sphinx_role) do
|
36
|
+
thinking_sphinx.stop
|
37
|
+
thinking_sphinx.index
|
38
|
+
thinking_sphinx.start
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# ===============================================================
|
43
|
+
# FILE MANAGEMENT
|
44
|
+
# ===============================================================
|
45
|
+
|
46
|
+
desc "Copies the shared/config/sphinx yaml to release/config/"
|
47
|
+
task :symlink_config, :roles => :app do
|
48
|
+
run "ln -s #{shared_path}/config/sphinx.yml #{release_path}/config/sphinx.yml"
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "Displays the thinking sphinx log from the server"
|
52
|
+
task :tail, :roles => :app do
|
53
|
+
stream "tail -f #{shared_path}/log/searchd.log"
|
54
|
+
end
|
55
|
+
|
56
|
+
desc "Runs Thinking Sphinx indexer"
|
57
|
+
task :index, :roles => sphinx_role do
|
58
|
+
rake = fetch(:rake, "rake")
|
59
|
+
rails_env = fetch(:rails_env, "production")
|
60
|
+
puts "Updating search index"
|
61
|
+
|
62
|
+
run "cd #{current_path}; #{rake} RAILS_ENV=#{rails_env} ts:index"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cap-recipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Esquenazi
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-16 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -63,6 +63,10 @@ files:
|
|
63
63
|
- lib/cap_recipes/tasks/rubygems.rb
|
64
64
|
- lib/cap_recipes/tasks/rubygems/install.rb
|
65
65
|
- lib/cap_recipes/tasks/rubygems/manage.rb
|
66
|
+
- lib/cap_recipes/tasks/thinking_sphinx.rb
|
67
|
+
- lib/cap_recipes/tasks/thinking_sphinx/hooks.rb
|
68
|
+
- lib/cap_recipes/tasks/thinking_sphinx/install.rb
|
69
|
+
- lib/cap_recipes/tasks/thinking_sphinx/manage.rb
|
66
70
|
- lib/cap_recipes/tasks/utilities.rb
|
67
71
|
- lib/cap_recipes/tasks/whenever.rb
|
68
72
|
- lib/cap_recipes/tasks/whenever/hooks.rb
|