capitate 0.2.11 → 0.2.13
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/History.txt +9 -0
- data/Manifest.txt +11 -1
- data/lib/capitate/cap_ext/connections.rb +15 -8
- data/lib/capitate/cap_ext/run_via.rb +2 -0
- data/lib/capitate/cap_ext/variables.rb +9 -2
- data/lib/capitate/plugins/base.rb +17 -12
- data/lib/capitate/plugins/build.rb +14 -11
- data/lib/capitate/plugins/prompt.rb +6 -8
- data/lib/capitate/plugins/script.rb +6 -4
- data/lib/capitate/plugins/templates.rb +16 -7
- data/lib/capitate/plugins/upload.rb +2 -1
- data/lib/capitate/plugins/utils.rb +7 -5
- data/lib/capitate/task_node.rb +30 -32
- data/lib/capitate/version.rb +1 -1
- data/lib/recipes/backgroundrb.rb +18 -4
- data/lib/recipes/centos/backgroundrb.rb +10 -3
- data/lib/recipes/centos/centos.rb +21 -8
- data/lib/recipes/centos/imagemagick.rb +4 -1
- data/lib/recipes/centos/memcached.rb +26 -8
- data/lib/recipes/centos/mongrel_cluster.rb +33 -13
- data/lib/recipes/centos/monit.rb +32 -11
- data/lib/recipes/centos/mysql.rb +7 -2
- data/lib/recipes/centos/nginx.rb +29 -10
- data/lib/recipes/centos/ruby.rb +11 -2
- data/lib/recipes/centos/sphinx.rb +32 -10
- data/lib/recipes/docs.rb +12 -7
- data/lib/recipes/logrotate/backgroundrb.rb +25 -0
- data/lib/recipes/logrotated.rb +18 -12
- data/lib/recipes/memcached.rb +0 -25
- data/lib/recipes/monit/backgroundrb.rb +39 -0
- data/lib/recipes/monit/memcached.rb +22 -0
- data/lib/recipes/{mongrel_cluster.rb → monit/mongrel_cluster.rb} +22 -12
- data/lib/recipes/monit/mysql.rb +21 -0
- data/lib/recipes/monit/nginx.rb +34 -0
- data/lib/recipes/monit/sphinx.rb +29 -0
- data/lib/recipes/monit/sshd.rb +27 -0
- data/lib/recipes/monit.rb +18 -3
- data/lib/recipes/mysql.rb +22 -32
- data/lib/recipes/nginx.rb +15 -30
- data/lib/recipes/rails.rb +17 -6
- data/lib/recipes/sphinx.rb +11 -24
- data/lib/recipes/sshd.rb +4 -22
- data/lib/recipes/syslogd.rb +4 -0
- data/lib/templates/backgroundrb/backgroundrb.monitrc.erb +4 -0
- data/lib/templates/backgroundrb/backgroundrb.yml.erb +4 -0
- data/website/index.html +10 -2
- data/website/javascripts/code_highlighter.js +188 -0
- data/website/javascripts/ruby.js +18 -0
- data/website/stylesheets/screen.css +116 -23
- data/website/template.rhtml +9 -1
- data/website/template_recipe.rhtml +12 -1
- metadata +13 -3
@@ -5,19 +5,37 @@ namespace :memcached do
|
|
5
5
|
desc <<-DESC
|
6
6
|
Install memcached.
|
7
7
|
|
8
|
-
|
8
|
+
<dl>
|
9
|
+
<dt>memcached_build_options</dt>
|
10
|
+
<dd>Memcached build options.</dd>
|
11
|
+
<dd>
|
9
12
|
<pre>
|
13
|
+
<code class="ruby">
|
10
14
|
set :memcached_build_options, {
|
11
15
|
:url => "http://www.danga.com/memcached/dist/memcached-1.2.4.tar.gz",
|
12
16
|
:configure_options => "--prefix=/usr/local"
|
13
17
|
}
|
14
|
-
</
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
</code>
|
19
|
+
</pre>
|
20
|
+
</dd>
|
21
|
+
|
22
|
+
|
23
|
+
<dt>memcached_memory</dt>
|
24
|
+
<dd>Memcached memory (in MB).</dd>
|
25
|
+
<dd>@set :memcached_memory, 64@</dd>
|
26
|
+
|
27
|
+
<dt>memcached_pid_path*</dt>
|
28
|
+
<dd>Path to memcached pid file.</dd>
|
29
|
+
<dd class="default">Defaults to @/var/run/memcached.pid@</dd>
|
30
|
+
<dd>@set :memcached_pid_path, "/var/run/memcached.pid"@</dd>
|
31
|
+
|
32
|
+
<dt>memcached_port</dt>
|
33
|
+
<dd>Memcached port<dd>
|
34
|
+
<dd class="default">Defaults to 11211.</dd>
|
35
|
+
<dd>@set :memcached_port, 11211@</dd>
|
36
|
+
|
37
|
+
</dl>
|
38
|
+
"Source":#{link_to_source(__FILE__)}
|
21
39
|
DESC
|
22
40
|
task :install do
|
23
41
|
|
@@ -6,19 +6,39 @@ namespace :mongrel do
|
|
6
6
|
|
7
7
|
desc <<-DESC
|
8
8
|
Create mongrel cluster.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
9
|
+
|
10
|
+
<dl>
|
11
|
+
<dt>mongrel_size</dt><dd>Number of mongrels</dd>
|
12
|
+
<dd>@set :mongrel_size, 3@</dd>
|
13
|
+
|
14
|
+
<dt>mongrel_port</dt><dd>Starting port for mongrels. If there are 3 mongrels with port 9000,
|
15
|
+
then instances will be at 9000, 9001, and 9002</dd>
|
16
|
+
<dd>@set :mongrel_port, 9000@</dd>
|
17
|
+
|
18
|
+
<dt>mongrel_config_dir</dt>
|
19
|
+
<dd>Directory for mongrel config.</dd>
|
20
|
+
<dd class="default">Defaults to @\#{shared_path}/config/mongrel@</dd>
|
21
|
+
|
22
|
+
<dt>mongrel_pid_dir</dt><dd>Directory for mongrel pids</dd>
|
23
|
+
<dd class="default">Defaults to @\#{shared_path}/pids@</dd>
|
24
|
+
|
25
|
+
<dt>mongrel_config_script</dt><dd>Config script to load with mongrel</dd>
|
26
|
+
<dd class="default">Defaults to @nil@</dd>
|
27
|
+
<dd>@set :mongrel_config_script, "config/mongrel_handler.rb"@</dd>
|
28
|
+
|
29
|
+
<dt>mongrel_cluster_command</dt>
|
30
|
+
<dd>Mongrel cluster command.</dd>
|
31
|
+
<dd class="default">Defaults to @mongrel_cluster_ctl@</dd>
|
32
|
+
|
33
|
+
<dt>mongrel_initscript_name</dt><dd>Mongrel initscript name.</dd>
|
34
|
+
<dd class="default">Defaults to @mongrel_cluster_\#{application}@</dd>
|
35
|
+
|
36
|
+
<dt>mongrel_config_options</dt>
|
37
|
+
<dd>Config options appended to cluster yml.</dd>
|
38
|
+
<dd class="default">Defaults to @{}@</dd>
|
39
|
+
|
40
|
+
</dl>
|
41
|
+
"Source":#{link_to_source(__FILE__)}
|
22
42
|
DESC
|
23
43
|
task :setup do
|
24
44
|
|
data/lib/recipes/centos/monit.rb
CHANGED
@@ -5,17 +5,38 @@ namespace :monit do
|
|
5
5
|
desc <<-DESC
|
6
6
|
Install monit.
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
8
|
+
<dl>
|
9
|
+
<dt>monit_build_options</dt>
|
10
|
+
<dd>Monit build options.</dd>
|
11
|
+
|
12
|
+
<pre>
|
13
|
+
<code class="ruby">
|
14
|
+
set :monit_build_options, { :url => "http://www.tildeslash.com/monit/dist/monit-4.10.1.tar.gz" }
|
15
|
+
</code>
|
16
|
+
</pre>
|
17
|
+
|
18
|
+
<dt>monit_port</dt>
|
19
|
+
<dd>Monit port</dd>
|
20
|
+
<dd class="default">Defaults to @2812@</dd>
|
21
|
+
<dd>@set :monit_port, 2812@</dd>
|
22
|
+
|
23
|
+
<dt>monit_password</dt>
|
24
|
+
<dd>Monit password</dd>
|
25
|
+
<dd class="default">Defaults to password prompt</dd>
|
26
|
+
<dd>@set :monit_password, prompt.password('Monit admin password (to set): ')@</dd>
|
27
|
+
|
28
|
+
<dt>monit_conf_dir</dt><dd>Directory for monitrc files.</dd>
|
29
|
+
<dd>@set :monit_conf_dir, "/etc/monit"@</dd>
|
30
|
+
|
31
|
+
<dt>monit_pid_path</dt><dd>Path to monit pid.</dd>
|
32
|
+
@set :monit_pid_path, "/var/run/monit.pid"@</dd>
|
33
|
+
|
34
|
+
<dt>monit_log_path</dt>
|
35
|
+
<dd>Path to monit log file.</dd>
|
36
|
+
<dd class="default">Defaults to @/var/log/monit.log@</dd>
|
37
|
+
|
38
|
+
</dl>
|
39
|
+
"Source":#{link_to_source(__FILE__)}
|
19
40
|
DESC
|
20
41
|
task :install do
|
21
42
|
|
data/lib/recipes/centos/mysql.rb
CHANGED
@@ -5,8 +5,13 @@ namespace :mysql do
|
|
5
5
|
desc <<-DESC
|
6
6
|
Install mysql.
|
7
7
|
|
8
|
-
|
9
|
-
<
|
8
|
+
<dl>
|
9
|
+
<dt>mysql_admin_password_set</dt>
|
10
|
+
<dd>Mysql admin password (to set)</dd>
|
11
|
+
<dd class="default">Defaults to password prompt.</dd>
|
12
|
+
<pre><code class="ruby">set :mysql_admin_password_set, prompt.password('Mysql admin password (to set): ')<code></pre>
|
13
|
+
</dl>
|
14
|
+
"Source":#{link_to_source(__FILE__)}
|
10
15
|
DESC
|
11
16
|
task :install do
|
12
17
|
|
data/lib/recipes/centos/nginx.rb
CHANGED
@@ -5,23 +5,42 @@ namespace :nginx do
|
|
5
5
|
desc <<-DESC
|
6
6
|
Install nginx, conf, initscript, nginx user and service.
|
7
7
|
|
8
|
-
|
8
|
+
<dl>
|
9
|
+
<dt>nginx_build_options</dt>
|
10
|
+
<dd>Nginx build options.
|
9
11
|
<pre>
|
12
|
+
<code class="ruby">
|
10
13
|
set :nginx_build_options, {
|
11
14
|
:url => "http://sysoev.ru/nginx/nginx-0.5.35.tar.gz",
|
12
15
|
:configure_options => "--sbin-path=\#{nginx_bin_path} --conf-path=\#{nginx_conf_path}
|
13
16
|
--pid-path=\#{nginx_pid_path} --error-log-path=/var/log/nginx_master_error.log --lock-path=/var/lock/nginx
|
14
17
|
--prefix=\#{nginx_prefix_path} --with-md5=auto/lib/md5 --with-sha1=auto/lib/sha1 --with-http_ssl_module"
|
15
18
|
}
|
16
|
-
</
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
</code>
|
20
|
+
</pre>
|
21
|
+
</dd>
|
22
|
+
|
23
|
+
<dt>nginx_bin_path</dt>
|
24
|
+
<dd>Nginx sbin path</dd>
|
25
|
+
<dd class="default">Defaults to /sbin/nginx</dd>
|
26
|
+
<dd>@set :nginx_bin_path, "/sbin/nginx"@</dd>
|
27
|
+
|
28
|
+
<dt>nginx_conf_path</dt>
|
29
|
+
<dd>Path to nginx conf.</dd>
|
30
|
+
<dd class="default">Defaults to /etc/nginx/nginx.conf</dd>
|
31
|
+
<dd>@set :nginx_conf_path, "/etc/nginx/nginx.conf"@</dd>
|
32
|
+
|
33
|
+
<dt>nginx_pid_path</dt>
|
34
|
+
<dd>Path to nginx pid file</dd>
|
35
|
+
<dd class="default">Defaults to /var/run/nginx.pid</dd>
|
36
|
+
<dd>@set :nginx_pid_path, "/var/run/nginx.pid"@</dd>
|
37
|
+
|
38
|
+
<dt>nginx_prefix_path</dt>
|
39
|
+
<dd>Nginx install prefix</dd>
|
40
|
+
<dd class="default">Defaults to /var/nginx_</dd>
|
41
|
+
<dd>@set :nginx_prefix_path, "/var/nginx"@</dd>
|
42
|
+
</dl>
|
43
|
+
"Source":#{link_to_source(__FILE__)}
|
25
44
|
DESC
|
26
45
|
task :install do
|
27
46
|
|
data/lib/recipes/centos/ruby.rb
CHANGED
@@ -5,16 +5,25 @@ namespace :ruby do
|
|
5
5
|
desc <<-DESC
|
6
6
|
Install ruby and rubygems.
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
<dl>
|
9
|
+
<dt>ruby_build_options</dt>
|
10
|
+
<dd>Ruby build options.</dd>
|
11
|
+
|
12
|
+
<dt>rubygems_build_options<dt>
|
13
|
+
<dd>Rubygems build options.</dd>
|
14
|
+
</dl>
|
15
|
+
|
10
16
|
<pre>
|
17
|
+
<code class="ruby">
|
11
18
|
set :ruby_build_options, {
|
12
19
|
:url => "http://capitate.s3.amazonaws.com/ruby-1.8.6-p110.tar.gz",
|
13
20
|
:build_dest => "/usr/src",
|
14
21
|
:configure_options => "--prefix=/usr",
|
15
22
|
:clean => false
|
16
23
|
}
|
24
|
+
</code>
|
17
25
|
</pre>
|
26
|
+
"Source":#{link_to_source(__FILE__)}
|
18
27
|
DESC
|
19
28
|
task :install do
|
20
29
|
|
@@ -4,15 +4,26 @@ namespace :sphinx do
|
|
4
4
|
|
5
5
|
desc <<-DESC
|
6
6
|
Install sphinx.\n
|
7
|
-
|
7
|
+
|
8
|
+
<dl>
|
9
|
+
<dt>sphinx_build_options</dt>
|
10
|
+
<dd>Sphinx build options.</dd>
|
11
|
+
<dd>
|
8
12
|
<pre>
|
13
|
+
<code class="ruby">
|
9
14
|
set :sphinx_build_options, {
|
10
15
|
:url => "http://www.sphinxsearch.com/downloads/sphinx-0.9.7.tar.gz",
|
11
16
|
:configure_options => "--with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib/mysql
|
12
17
|
--prefix=\#{sphinx_prefix}"
|
13
18
|
}
|
14
|
-
</
|
15
|
-
|
19
|
+
</code>
|
20
|
+
</pre>
|
21
|
+
</dd>
|
22
|
+
|
23
|
+
<dt>sphinx_prefix</dt>
|
24
|
+
<dd>Sphinx install prefix</dd>
|
25
|
+
<dd class="default">Defaults to @/usr/local/sphinx@</dd>
|
26
|
+
</dl>
|
16
27
|
DESC
|
17
28
|
task :install do
|
18
29
|
|
@@ -28,11 +39,15 @@ namespace :sphinx do
|
|
28
39
|
end
|
29
40
|
|
30
41
|
desc <<-DESC
|
31
|
-
Setup sphinx for application
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
42
|
+
Setup sphinx for application.
|
43
|
+
|
44
|
+
<dl>
|
45
|
+
<dt>sphinx_prefix</dt><dd>Sphinx install prefix</dd><dd class="default">Defaults to @/usr/local/sphinx@</dd>
|
46
|
+
<dt>sphinx_pid_path</dt><dd>Directory to sphinx pid</dd><dd class="default">Defaults to @\#{shared_path}/pids/searchd.pid@</dd>
|
47
|
+
<dt>sphinx_conf_path</dt><dd>Path to sphinx.conf</dd><dd class="default">Defaults to @\#{shared_path}/config/sphinx.conf@</dd>
|
48
|
+
<dt>sphinx_index_path</dt><dd>Path to sphinx indexes</dd><dd class="default">Defaults to @\#{shared_path}/var/index@</dd>
|
49
|
+
</dl>
|
50
|
+
"Source":#{link_to_source(__FILE__)}
|
36
51
|
DESC
|
37
52
|
task :setup do
|
38
53
|
|
@@ -57,8 +72,15 @@ namespace :sphinx do
|
|
57
72
|
desc <<-DESC
|
58
73
|
Install sphinx firewall rule.
|
59
74
|
|
60
|
-
|
61
|
-
|
75
|
+
This doesn't work yet (doesn't insert in right place).
|
76
|
+
|
77
|
+
<dl>
|
78
|
+
<dt>sphinx_portdt>
|
79
|
+
<dd>Sphinx port</dd>
|
80
|
+
<dd class="default">Defaults to @3312@</dd>
|
81
|
+
<dd>@set :sphinx_port, 3312@</dd>
|
82
|
+
</dl>
|
83
|
+
"Source":#{link_to_source(__FILE__)}
|
62
84
|
DESC
|
63
85
|
task :iptables do
|
64
86
|
# Settings
|
data/lib/recipes/docs.rb
CHANGED
@@ -3,14 +3,19 @@ namespace :docs do
|
|
3
3
|
desc <<-DESC
|
4
4
|
Generate documentation for all currently loaded recipes. Assumes textile formatting.
|
5
5
|
|
6
|
-
|
6
|
+
This recipe generated this documentation.
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
<dl>
|
9
|
+
<dt>docs_recipes_dir</dd>
|
10
|
+
<dd>Destination directory</dd>
|
11
|
+
<dd class="default">Defaults to @docs/recipes@</dd>
|
12
|
+
<dd>@set :docs_recipes_dir, "docs/recipes"@</dd>
|
13
13
|
|
14
|
+
<dt>docs_recipes_clear</dt>
|
15
|
+
<dd>Whether to clear destination before generating.</dd>
|
16
|
+
<dd>@set :docs_recipes_clear, true@</dd>
|
17
|
+
</dl>
|
18
|
+
"Source":#{link_to_source(__FILE__)}
|
14
19
|
DESC
|
15
20
|
task :recipes do
|
16
21
|
|
@@ -24,7 +29,7 @@ namespace :docs do
|
|
24
29
|
FileUtils.rm_rf(docs_recipes_dir) if docs_recipes_clear
|
25
30
|
FileUtils.mkdir_p(docs_recipes_dir)
|
26
31
|
|
27
|
-
top_node.write_doc(docs_recipes_dir, "index", "Recipes")
|
32
|
+
top_node.write_doc(docs_recipes_dir, "index", "Recipes", :include_source => true)
|
28
33
|
|
29
34
|
end
|
30
35
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
namespace :backgroundrb do
|
2
|
+
|
3
|
+
namespace :logrotate do
|
4
|
+
|
5
|
+
desc <<-DESC
|
6
|
+
Install logrotated conf for backgroundrb.
|
7
|
+
|
8
|
+
<dl>
|
9
|
+
<dt>backgroundrb_logrotate_path<dt>
|
10
|
+
<dd>Backgroundrb logrotate paths.</dd>
|
11
|
+
<dd class="default">Defaults to @\#{shared_path}/log/backgroundrb*.log@</dd>
|
12
|
+
</dl>
|
13
|
+
DESC
|
14
|
+
task :install do
|
15
|
+
fetch_or_default(:backgroundrb_logrotate_path, "#{shared_path}/log/backgroundrb*.log")
|
16
|
+
|
17
|
+
set :logrotate_name, "backgroundrb_#{application}"
|
18
|
+
set :logrotate_log_path, backgroundrb_logrotate_path
|
19
|
+
set :logrotate_options, [ { :rotate => 2 }, :weekly, :missingok, :notifempty, :copytruncate ]
|
20
|
+
|
21
|
+
logrotated.install_conf
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/lib/recipes/logrotated.rb
CHANGED
@@ -4,26 +4,32 @@ namespace :logrotated do
|
|
4
4
|
desc <<-DESC
|
5
5
|
Create logrotated conf. You probably use this in other recipes and not standalone.
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
<dl>
|
8
|
+
<dt>logrotate_name</dt>
|
9
|
+
<dd>Name of file in /etc/logrotate.d/</dd>
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
<dt>logrotate_log_path<dt>
|
12
|
+
<dd>Path to log file. Can include wildcards, like /var/log/foo_*.log.</dd>
|
13
|
+
|
14
|
+
<dt>logrotate_options</dt>
|
15
|
+
<dd>:rotate (Number of times to rotate before discarding)</dd>
|
16
|
+
<dd>:size (Rotate when file hits this size)</dd>
|
17
|
+
<dd>:daily, :weekly, :monthly (How often to perform rotate)</dd>
|
18
|
+
<dd>:missingok</dd>
|
19
|
+
<dd>:compress</dd>
|
20
|
+
<dd>:delaycompress</dd>
|
21
|
+
<dd>:notifempty</dd>
|
22
|
+
<dd>:copytruncate</dd>
|
19
23
|
|
20
24
|
See man page for all the options.
|
21
25
|
|
22
26
|
<pre>
|
27
|
+
<code class="ruby">
|
23
28
|
set :logrotate_options, [ { :rotate => 7, :size => 10MB },
|
24
29
|
:daily, :missingok, :compress, :delaycompress, :notifempty, :copytruncate ]
|
30
|
+
</code>
|
25
31
|
</pre>
|
26
|
-
|
32
|
+
"Source":#{link_to_source(__FILE__)}
|
27
33
|
DESC
|
28
34
|
task :install_conf do
|
29
35
|
|
data/lib/recipes/memcached.rb
CHANGED
@@ -21,30 +21,5 @@ namespace :memcached do
|
|
21
21
|
task :update_code, :roles => :app do
|
22
22
|
run "ln -nfs #{shared_path}/config/memcached.yml #{release_path}/config/memcached.yml"
|
23
23
|
end
|
24
|
-
|
25
|
-
namespace :monit do
|
26
|
-
|
27
|
-
desc <<-DESC
|
28
|
-
Generate and install memcached monitrc.
|
29
|
-
|
30
|
-
*memcached_pid_path*: Path to memcached pid file. _Defaults to /var/run/memcached.pid_\n
|
31
|
-
@set :memcached_pid_path, "/var/run/memcached.pid"@\n
|
32
|
-
*memcached_port*: Memcached port. _Defaults to 11211_\n
|
33
|
-
@set :memcached_port, 11211@\n
|
34
|
-
*monit_conf_dir*: Destination for monitrc. _Defaults to "/etc/monit"_\n
|
35
|
-
@set :monit_conf_dir, "/etc/monit"@\n
|
36
|
-
DESC
|
37
|
-
task :install do
|
38
|
-
|
39
|
-
# Settings
|
40
|
-
fetch_or_default(:memcached_pid_path, "/var/run/memcached.pid")
|
41
|
-
fetch_or_default(:memcached_port, 11211)
|
42
|
-
fetch_or_default(:monit_conf_dir, "/etc/monit")
|
43
24
|
|
44
|
-
put template.load("memcached/memcached.monitrc.erb"), "/tmp/memcached.monitrc"
|
45
|
-
run_via "install -o root /tmp/memcached.monitrc #{monit_conf_dir}/memcached.monitrc"
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
25
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
namespace :backgroundrb do
|
2
|
+
|
3
|
+
namespace :monit do
|
4
|
+
|
5
|
+
desc <<-DESC
|
6
|
+
Generate and install backgroundrb (for application) monitrc.
|
7
|
+
|
8
|
+
"Source":#{link_to_source(__FILE__)}
|
9
|
+
DESC
|
10
|
+
task :install do
|
11
|
+
|
12
|
+
# Settings
|
13
|
+
fetch_or_default(:backgroundrb_port, 11006)
|
14
|
+
fetch_or_default(:backgroundrb_pid_path, "#{shared_path}/pids/backgroundrb.pid")
|
15
|
+
fetch_or_default(:monit_conf_dir, "/etc/monit")
|
16
|
+
|
17
|
+
utils.install_template("backgroundrb/backgroundrb.monitrc.erb", "#{monit_conf_dir}/backgroundrb.monitrc")
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Restart backgroundrb (for application)"
|
21
|
+
task :restart do
|
22
|
+
fetch_or_default(:monit_bin_path, "monit")
|
23
|
+
sudo "#{monit_bin_path} restart backgroundrb_#{application}"
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Start mongrel cluster (for application)"
|
27
|
+
task :start do
|
28
|
+
fetch_or_default(:monit_bin_path, "monit")
|
29
|
+
sudo "#{monit_bin_path} start backgroundrb_#{application}"
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Stop mongrel cluster (for application)"
|
33
|
+
task :stop do
|
34
|
+
fetch_or_default(:monit_bin_path, "monit")
|
35
|
+
sudo "#{monit_bin_path} stop backgroundrb_#{application}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
namespace :memcached do
|
2
|
+
|
3
|
+
namespace :monit do
|
4
|
+
|
5
|
+
desc <<-DESC
|
6
|
+
Generate and install memcached monitrc.
|
7
|
+
"Source":#{link_to_source(__FILE__)}
|
8
|
+
DESC
|
9
|
+
task :install do
|
10
|
+
|
11
|
+
# Settings
|
12
|
+
fetch_or_default(:memcached_pid_path, "/var/run/memcached.pid")
|
13
|
+
fetch_or_default(:memcached_port, 11211)
|
14
|
+
fetch_or_default(:monit_conf_dir, "/etc/monit")
|
15
|
+
|
16
|
+
put template.load("memcached/memcached.monitrc.erb"), "/tmp/memcached.monitrc"
|
17
|
+
run_via "install -o root /tmp/memcached.monitrc #{monit_conf_dir}/memcached.monitrc"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -7,18 +7,7 @@ namespace :mongrel do
|
|
7
7
|
|
8
8
|
desc <<-DESC
|
9
9
|
Create monit configuration for mongrel cluster.
|
10
|
-
|
11
|
-
*mongrel_application*: Name of application (monit group). _Defaults to <tt>"mongrel_cluster_\#{fetch(:application)}"</tt>_
|
12
|
-
*mongrel_bin_path*: Path to mongrel command. _Defaults to <tt>/usr/bin/mongrel_rails</tt>_
|
13
|
-
*mongrel_size*: Number of mongrels.\n
|
14
|
-
@set :mongrel_size, 3@\n
|
15
|
-
*mongrel_port*: Starting port for mongrels. If there are 3 mongrels with port 9000, then instances
|
16
|
-
will be at 9000, 9001, and 9002\n
|
17
|
-
@set :mongrel_port, 9000@\n
|
18
|
-
*mongrel_config_script*: Config script to load with mongrel. _Defaults to nil_\n
|
19
|
-
@set :mongrel_config_script, "config/mongrel_handler.rb"@\n
|
20
|
-
*monit_conf_dir*: Destination for monitrc. _Defaults to "/etc/monit"_\n
|
21
|
-
@set :monit_conf_dir, "/etc/monit"@\n
|
10
|
+
"Source":#{link_to_source(__FILE__)}
|
22
11
|
DESC
|
23
12
|
task :setup do
|
24
13
|
|
@@ -68,6 +57,27 @@ namespace :mongrel do
|
|
68
57
|
sudo "install -o root /tmp/#{mongrel_application}.monitrc #{monit_conf_dir}/#{mongrel_application}.monitrc"
|
69
58
|
end
|
70
59
|
|
60
|
+
desc "Restart mongrel cluster (for application)"
|
61
|
+
task :restart do
|
62
|
+
fetch_or_default(:monit_bin_path, "monit")
|
63
|
+
fetch_or_default(:mongrel_application, Proc.new { "mongrel_cluster_#{fetch(:application)}" })
|
64
|
+
sudo "#{monit_bin_path} -g #{mongrel_application} restart all"
|
65
|
+
end
|
66
|
+
|
67
|
+
desc "Start mongrel cluster (for application)"
|
68
|
+
task :start do
|
69
|
+
fetch_or_default(:monit_bin_path, "monit")
|
70
|
+
fetch_or_default(:mongrel_application, Proc.new { "mongrel_cluster_#{fetch(:application)}" })
|
71
|
+
sudo "#{monit_bin_path} -g #{mongrel_application} start all"
|
72
|
+
end
|
73
|
+
|
74
|
+
desc "Stop mongrel cluster (for application)"
|
75
|
+
task :stop do
|
76
|
+
fetch_or_default(:monit_bin_path, "monit")
|
77
|
+
fetch_or_default(:mongrel_application, Proc.new { "mongrel_cluster_#{fetch(:application)}" })
|
78
|
+
sudo "#{monit_bin_path} -g #{mongrel_application} stop all"
|
79
|
+
end
|
80
|
+
|
71
81
|
end
|
72
82
|
|
73
83
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
namespace :mysql do
|
2
|
+
|
3
|
+
namespace :monit do
|
4
|
+
|
5
|
+
desc <<-DESC
|
6
|
+
Install mysql monit hooks. "Source":#{link_to_source(__FILE__)}
|
7
|
+
DESC
|
8
|
+
task :install do
|
9
|
+
|
10
|
+
# Settings
|
11
|
+
fetch_or_default(:mysql_pid_path, "/var/run/mysqld/mysqld.pid")
|
12
|
+
fetch_or_default(:mysql_port, 3306)
|
13
|
+
fetch_or_default(:monit_conf_dir, "/etc/monit")
|
14
|
+
|
15
|
+
put template.load("mysql/mysql.monitrc.erb", binding), "/tmp/mysql.monitrc"
|
16
|
+
run_via "install -o root /tmp/mysql.monitrc #{monit_conf_dir}/mysql.monitrc"
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
namespace :nginx do
|
2
|
+
|
3
|
+
namespace :monit do
|
4
|
+
|
5
|
+
desc <<-DESC
|
6
|
+
Install nginx monit hooks.
|
7
|
+
|
8
|
+
<dl>
|
9
|
+
|
10
|
+
<dt>nginx_pid_path</dt>
|
11
|
+
<dd>Path to nginx pid file</dd>
|
12
|
+
<dd>Defaults to /var/run/nginx.pid</dd>
|
13
|
+
<dd>@set :nginx_pid_path, "/var/run/nginx.pid"@</dd>
|
14
|
+
|
15
|
+
<dt>monit_conf_dir</dt>
|
16
|
+
<dd>Destination for monitrc.</dd>
|
17
|
+
<dd>Defaults to "/etc/monit"</dd>
|
18
|
+
<dd>@set :monit_conf_dir, "/etc/monit"@</dd>
|
19
|
+
</dl>
|
20
|
+
"Source":#{link_to_source(__FILE__)}
|
21
|
+
DESC
|
22
|
+
task :install do
|
23
|
+
|
24
|
+
# Settings
|
25
|
+
fetch_or_default(:nginx_pid_path, "/var/run/nginx.pid")
|
26
|
+
fetch_or_default(:monit_conf_dir, "/etc/monit")
|
27
|
+
|
28
|
+
put template.load("nginx/nginx.monitrc.erb", binding), "/tmp/nginx.monitrc"
|
29
|
+
run_via "install -o root /tmp/nginx.monitrc #{monit_conf_dir}/nginx.monitrc"
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
namespace :sphinx do
|
2
|
+
|
3
|
+
namespace :monit do
|
4
|
+
|
5
|
+
desc <<-DESC
|
6
|
+
Create monit configuration for sphinx.\n
|
7
|
+
*monit_conf_dir*: Destination for monitrc. _Defaults to "/etc/monit"_\n
|
8
|
+
*sphinx_pid_path*: Location for sphinx pid. _Defaults to "[shared_path]/pids/searchd.pid"_\n
|
9
|
+
|
10
|
+
"Source":#{link_to_source(__FILE__)}
|
11
|
+
DESC
|
12
|
+
task :setup do
|
13
|
+
|
14
|
+
# Settings
|
15
|
+
fetch_or_default(:monit_conf_dir, "/etc/monit")
|
16
|
+
fetch_or_default(:sphinx_pid_path, "#{shared_path}/pids/searchd.pid")
|
17
|
+
|
18
|
+
put template.load("sphinx/sphinx.monitrc.erb"), "/tmp/sphinx_#{application}.monitrc"
|
19
|
+
sudo "install -o root /tmp/sphinx_#{application}.monitrc #{monit_conf_dir}/sphinx_#{application}.monitrc"
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Restart sphinx"
|
23
|
+
task :restart do
|
24
|
+
sudo "/sbin/service monit restart sphinx_#{application}"
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|