capitate 0.3.5 → 0.3.6
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 +10 -0
- data/Manifest.txt +3 -9
- data/lib/capitate.rb +14 -0
- data/lib/capitate/cap_ext/namespace.rb +34 -0
- data/lib/capitate/cap_ext/task_definition.rb +22 -0
- data/lib/capitate/task_node.rb +21 -1
- data/lib/capitate/version.rb +1 -1
- data/lib/recipes/active_record.rb +7 -36
- data/lib/recipes/backgroundrb.rb +4 -19
- data/lib/recipes/centos/backgroundjob.rb +5 -26
- data/lib/recipes/centos/backgroundrb.rb +2 -13
- data/lib/recipes/centos/centos.rb +4 -26
- data/lib/recipes/centos/imagemagick.rb +8 -9
- data/lib/recipes/centos/memcached.rb +12 -53
- data/lib/recipes/centos/merb.rb +7 -33
- data/lib/recipes/centos/mongrel_cluster.rb +15 -51
- data/lib/recipes/centos/monit.rb +10 -36
- data/lib/recipes/centos/mysql.rb +1 -10
- data/lib/recipes/centos/nginx.rb +14 -42
- data/lib/recipes/centos/ruby.rb +6 -15
- data/lib/recipes/centos/sphinx.rb +13 -36
- data/lib/recipes/docs.rb +2 -14
- data/lib/recipes/logrotated.rb +20 -40
- data/lib/recipes/memcached.rb +10 -41
- data/lib/recipes/merb.rb +3 -4
- data/lib/recipes/monit.rb +4 -23
- data/lib/recipes/monit/merb.rb +7 -12
- data/lib/recipes/monit/mysql.rb +3 -19
- data/lib/recipes/monit/nginx.rb +2 -16
- data/lib/recipes/monit/sphinx.rb +20 -11
- data/lib/recipes/mysql.rb +13 -53
- data/lib/recipes/nginx.rb +9 -65
- data/lib/recipes/rails.rb +0 -58
- data/lib/recipes/sphinx.rb +20 -46
- data/lib/recipes/sshd.rb +6 -15
- data/lib/recipes/syslogd.rb +3 -43
- data/lib/templates/backgroundjob/backgroundjob.initd.centos.erb +4 -4
- data/lib/templates/merb/merb-no-http.monitrc.erb +13 -0
- data/lib/templates/merb/merb.initd.centos.erb +3 -3
- metadata +5 -12
- data/docs/nginx.README +0 -12
- data/website/index.html +0 -154
- data/website/index.txt +0 -69
- data/website/javascripts/code_highlighter.js +0 -188
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/javascripts/ruby.js +0 -18
- data/website/stylesheets/screen.css +0 -265
- data/website/template.rhtml +0 -69
- data/website/template_recipe.rhtml +0 -44
data/lib/recipes/centos/merb.rb
CHANGED
@@ -4,42 +4,16 @@ namespace :merb do
|
|
4
4
|
desc <<-DESC
|
5
5
|
Setup merb.
|
6
6
|
|
7
|
-
<dl>
|
8
|
-
<dt>merb_command_path</dt>
|
9
|
-
<dd>The path for merb startup command</dd>
|
10
|
-
<dd class="default">Defaults to @merb@</dd>
|
11
|
-
|
12
|
-
<dt>merb_nodes</dt>
|
13
|
-
<dd>Number of merb daemons to run</dd>
|
14
|
-
<dd>@set :merb_nodes, 3@</dd>
|
15
|
-
|
16
|
-
<dt>merb_port</dt>
|
17
|
-
<dd>Starting port for merb nodes. If there are 3 merb nodes with port 9000,
|
18
|
-
then instances will be at 9000, 9001, and 9002</dd>
|
19
|
-
<dd>@set :merb_port, 9000@</dd>
|
20
|
-
|
21
|
-
<dt>merb_root</dt>
|
22
|
-
<dd>Directory for merb root</dd>
|
23
|
-
<dd class="default">Defaults to @\#{current_path}@</dd>
|
24
|
-
|
25
|
-
<dt>merb_pid_path</dt>
|
26
|
-
<dd>Path for merb pids</dd>
|
27
|
-
<dd class="default">Defaults to @\#{shared_path}/pids/merb.pid@</dd>
|
28
|
-
</dl>
|
29
7
|
"Source":#{link_to_source(__FILE__)}
|
30
8
|
DESC
|
9
|
+
task_arg(:merb_nodes, "Number of merb daemons to run")
|
10
|
+
task_arg(:merb_port, "Starting port for merb nodes. If there are 3 merb nodes with port 9000, then instances will be at 9000, 9001, and 9002")
|
11
|
+
task_arg(:merb_command_path, "The path for merb startup command", :default => "merb")
|
12
|
+
task_arg(:merb_pid_path, "Path for merb pids", :default => Proc.new{"#{shared_path}/pids/merb.pid"}, :default_desc => "\#{shared_path}/pids/merb.pid")
|
13
|
+
task_arg(:merb_root, "Directory for merb root", :set => :current_path)
|
14
|
+
task_arg(:merb_application, "Merb application name", :default => Proc.new{"merb_#{application}"}, :default_desc => "merb_\#{application}")
|
15
|
+
task_arg(:merb_initscript_name, "Initscript name", :default => Proc.new{"merb_#{application}"}, :default_desc => "merb_\#{application}")
|
31
16
|
task :setup do
|
32
|
-
|
33
|
-
# Settings
|
34
|
-
fetch(:merb_nodes)
|
35
|
-
fetch(:merb_port)
|
36
|
-
fetch_or_default(:merb_command_path, "merb")
|
37
|
-
fetch_or_default(:merb_pid_path, "#{shared_path}/pids/merb.pid")
|
38
|
-
fetch_or_default(:merb_root, current_path)
|
39
|
-
fetch_or_default(:merb_application, "merb_#{application}")
|
40
|
-
|
41
|
-
fetch_or_default(:merb_initscript_name, "merb_#{application}")
|
42
|
-
|
43
17
|
utils.install_template("merb/merb.initd.centos.erb", "/etc/init.d/#{merb_initscript_name}")
|
44
18
|
run_via "/sbin/chkconfig --level 345 #{merb_initscript_name} on"
|
45
19
|
end
|
@@ -7,55 +7,21 @@ namespace :mongrel do
|
|
7
7
|
desc <<-DESC
|
8
8
|
Create mongrel cluster.
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
<dd>Name of mongrel application</dd>
|
13
|
-
<dd>@set :mongrel_application, "mongrel_cluster_\#{application}"@</dd>
|
14
|
-
|
15
|
-
<dt>mongrel_size</dt><dd>Number of mongrels</dd>
|
16
|
-
<dd>@set :mongrel_size, 3@</dd>
|
17
|
-
|
18
|
-
<dt>mongrel_port</dt><dd>Starting port for mongrels. If there are 3 mongrels with port 9000,
|
19
|
-
then instances will be at 9000, 9001, and 9002</dd>
|
20
|
-
<dd>@set :mongrel_port, 9000@</dd>
|
21
|
-
|
22
|
-
<dt>mongrel_config_dir</dt>
|
23
|
-
<dd>Directory for mongrel config.</dd>
|
24
|
-
<dd class="default">Defaults to @\#{shared_path}/config/mongrel@</dd>
|
25
|
-
|
26
|
-
<dt>mongrel_pid_dir</dt><dd>Directory for mongrel pids</dd>
|
27
|
-
<dd class="default">Defaults to @\#{shared_path}/pids@</dd>
|
28
|
-
|
29
|
-
<dt>mongrel_config_script</dt><dd>Config script to load with mongrel</dd>
|
30
|
-
<dd class="default">Defaults to @nil@</dd>
|
31
|
-
<dd>@set :mongrel_config_script, "config/mongrel_handler.rb"@</dd>
|
32
|
-
|
33
|
-
<dt>mongrel_cluster_command</dt>
|
34
|
-
<dd>Mongrel cluster command.</dd>
|
35
|
-
<dd class="default">Defaults to @mongrel_cluster_ctl@</dd>
|
10
|
+
"Source":#{link_to_source(__FILE__)}
|
11
|
+
DESC
|
36
12
|
|
37
|
-
|
38
|
-
|
13
|
+
task_arg(:mongrel_application, "Name of mongrel application")
|
14
|
+
task_arg(:mongrel_size, "Number of mongrels")
|
15
|
+
task_arg(:mongrel_port, "Starting port for mongrels. If there are 3 mongrels with port 9000, then instances will be at 9000, 9001, and 9002")
|
16
|
+
task_arg(:mongrel_config_dir, "Directory for mongrel config", :default => Proc.new{"#{shared_path}/config/mongrel"}, :default_desc => "\#{shared_path}/config/mongrel")
|
17
|
+
task_arg(:mongrel_pid_dir, "Directory for mongrel pids", :default => Proc.new{"#{shared_path}/pids"}, :default_desc => "\#{shared_path}/pids")
|
18
|
+
task_arg(:mongrel_config_script, "Config script to load with mongrel", :default => nil)
|
39
19
|
|
40
|
-
|
41
|
-
|
42
|
-
|
20
|
+
task_arg(:mongrel_cluster_command, "Mongrel cluster command", :default => "mongrel_cluster_ctl")
|
21
|
+
task_arg(:mongrel_initscript_name, "Mongrel initscript name", :default => Proc.new{"mongrel_cluster_#{application}"}, :default_desc => "mongrel_cluster_\#{application}")
|
22
|
+
task_arg(:mongrel_config_options, "Config options appended to cluster yml", :default => {})
|
43
23
|
|
44
|
-
</dl>
|
45
|
-
"Source":#{link_to_source(__FILE__)}
|
46
|
-
DESC
|
47
24
|
task :setup do
|
48
|
-
|
49
|
-
# Settings
|
50
|
-
fetch(:mongrel_size)
|
51
|
-
fetch(:mongrel_port)
|
52
|
-
fetch_or_default(:mongrel_config_dir, "#{shared_path}/config/mongrel")
|
53
|
-
fetch_or_default(:mongrel_pid_dir, "#{shared_path}/pids")
|
54
|
-
fetch_or_default(:mongrel_config_script, nil)
|
55
|
-
|
56
|
-
fetch_or_default(:mongrel_cluster_command, "mongrel_cluster_ctl")
|
57
|
-
fetch_or_default(:mongrel_initscript_name, "mongrel_cluster_#{application}")
|
58
|
-
fetch_or_default(:mongrel_config_options, {})
|
59
25
|
|
60
26
|
unless mongrel_config_script.blank?
|
61
27
|
mongrel_config_options["config_script"] = mongrel_config_script
|
@@ -72,13 +38,11 @@ namespace :mongrel do
|
|
72
38
|
end
|
73
39
|
|
74
40
|
desc "Mongrel cluster setup initscript for application"
|
41
|
+
task_arg(:mongrel_config_dir, "Directory for mongrel config", :default => Proc.new{"#{shared_path}/config/mongrel"}, :default_desc => "\#{shared_path}/config/mongrel")
|
42
|
+
task_arg(:mongrel_pid_dir, "Directory for mongrel pids", :default => Proc.new{"#{shared_path}/pids"}, :default_desc => "\#{shared_path}/pids")
|
43
|
+
task_arg(:mongrel_cluster_command, "Mongrel cluster command", :default => "mongrel_cluster_ctl")
|
44
|
+
task_arg(:mongrel_initscript_name, "Mongrel initscript name", :default => Proc.new{"mongrel_cluster_#{application}"}, :default_desc => "mongrel_cluster_\#{application}")
|
75
45
|
task :initscript do
|
76
|
-
|
77
|
-
fetch_or_default(:mongrel_config_dir, "#{shared_path}/config/mongrel")
|
78
|
-
fetch_or_default(:mongrel_pid_dir, "#{shared_path}/pids")
|
79
|
-
fetch_or_default(:mongrel_cluster_command, "mongrel_cluster_ctl")
|
80
|
-
fetch_or_default(:mongrel_initscript_name, "mongrel_cluster_#{application}")
|
81
|
-
|
82
46
|
utils.install_template("mongrel/mongrel_cluster.initd.centos.erb", "/etc/init.d/#{mongrel_initscript_name}")
|
83
47
|
run_via "/sbin/chkconfig --level 345 #{mongrel_initscript_name} on"
|
84
48
|
end
|
data/lib/recipes/centos/monit.rb
CHANGED
@@ -5,49 +5,23 @@ namespace :monit do
|
|
5
5
|
desc <<-DESC
|
6
6
|
Install monit.
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
"Source":#{link_to_source(__FILE__)}
|
9
|
+
DESC
|
10
|
+
task_arg(:monit_port, "Monit port", :default => 2812)
|
11
|
+
task_arg(:monit_password, "Monit password", :default => Proc.new{prompt.password('Monit admin password (to set): ', :verify => true)}, :default_desc => "password prompt")
|
12
|
+
task_arg(:monit_conf_dir, :default => "/etc/monit")
|
13
|
+
task_arg(:monit_pid_path, "Path to monit pid", :default => "/var/run/monit.pid")
|
14
|
+
task_arg(:monit_log_path, "Path to monit log file", :default => "/var/log/monit.log")
|
15
|
+
task_arg(:monit_build_options, <<-EOS)
|
16
|
+
Monit build options
|
12
17
|
<pre>
|
13
18
|
<code class="ruby">
|
14
19
|
set :monit_build_options, { :url => "http://www.tildeslash.com/monit/dist/monit-4.10.1.tar.gz" }
|
15
20
|
</code>
|
16
21
|
</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__)}
|
40
|
-
DESC
|
22
|
+
EOS
|
41
23
|
task :install do
|
42
24
|
|
43
|
-
# Settings
|
44
|
-
fetch_or_default(:monit_port, 2812)
|
45
|
-
fetch_or_default(:monit_password, prompt.password('Monit admin password (to set): ', :verify => true))
|
46
|
-
fetch_or_default(:monit_conf_dir, "/etc/monit")
|
47
|
-
fetch_or_default(:monit_pid_path, "/var/run/monit.pid")
|
48
|
-
fetch_or_default(:monit_log_path, "/var/log/monit.log")
|
49
|
-
fetch(:monit_build_options)
|
50
|
-
|
51
25
|
# Install dependencies
|
52
26
|
yum.install([ "flex", "byacc" ])
|
53
27
|
|
data/lib/recipes/centos/mysql.rb
CHANGED
@@ -5,19 +5,10 @@ namespace :mysql do
|
|
5
5
|
desc <<-DESC
|
6
6
|
Install mysql.
|
7
7
|
|
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
8
|
"Source":#{link_to_source(__FILE__)}
|
15
9
|
DESC
|
10
|
+
task_arg(:mysql_admin_password_set, "Mysql admin password (to set)", :default => Proc.new{prompt.password('Mysql admin password (to set): ', :verify => true)}, :default_desc => "password prompt")
|
16
11
|
task :install do
|
17
|
-
|
18
|
-
# Settings
|
19
|
-
fetch_or_default(:mysql_admin_password_set, prompt.password('Mysql admin password (to set): ', :verify => true))
|
20
|
-
|
21
12
|
# Install through package manager
|
22
13
|
yum.install([ "mysql", "mysql-devel", "mysql-server" ])
|
23
14
|
|
data/lib/recipes/centos/nginx.rb
CHANGED
@@ -5,9 +5,10 @@ namespace :nginx do
|
|
5
5
|
desc <<-DESC
|
6
6
|
Install nginx, conf, initscript, nginx user and service.
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
"Source":#{link_to_source(__FILE__)}
|
9
|
+
DESC
|
10
|
+
task_arg(:nginx_build_options, <<-EOS)
|
11
|
+
Nginx build options.
|
11
12
|
<pre>
|
12
13
|
<code class="ruby">
|
13
14
|
set :nginx_build_options, {
|
@@ -18,39 +19,12 @@ namespace :nginx do
|
|
18
19
|
}
|
19
20
|
</code>
|
20
21
|
</pre>
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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__)}
|
44
|
-
DESC
|
45
|
-
task :install do
|
46
|
-
|
47
|
-
# Settings
|
48
|
-
fetch(:nginx_build_options)
|
49
|
-
fetch_or_default(:nginx_bin_path, "/sbin/nginx")
|
50
|
-
fetch_or_default(:nginx_conf_path, "/etc/nginx/nginx.conf")
|
51
|
-
fetch_or_default(:nginx_pid_path, "/var/run/nginx.pid")
|
52
|
-
fetch_or_default(:nginx_prefix_path, "/var/nginx")
|
53
|
-
|
22
|
+
EOS
|
23
|
+
task_arg(:nginx_bin_path, "Nginx sbin path", :default => "/sbin/nginx")
|
24
|
+
task_arg(:nginx_conf_path, "Path to nginx conf", :default => "/etc/nginx/nginx.conf")
|
25
|
+
task_arg(:nginx_pid_path, "Path to nginx pid file", :default => "/var/run/nginx.pid")
|
26
|
+
task_arg(:nginx_prefix_path, "Nginx install prefix", :default => "/var/nginx")
|
27
|
+
task :install do
|
54
28
|
# Install dependencies
|
55
29
|
yum.install([ "pcre-devel", "openssl", "openssl-devel" ])
|
56
30
|
|
@@ -71,11 +45,10 @@ namespace :nginx do
|
|
71
45
|
end
|
72
46
|
|
73
47
|
desc "Install nginx initscript"
|
48
|
+
task_arg(:nginx_bin_path, "Nginx sbin path", :default => "/sbin/nginx")
|
49
|
+
task_arg(:nginx_conf_path, "Path to nginx conf", :default => "/etc/nginx/nginx.conf")
|
50
|
+
task_arg(:nginx_pid_path, "Path to nginx pid file", :default => "/var/run/nginx.pid")
|
74
51
|
task :initscript do
|
75
|
-
fetch_or_default(:nginx_bin_path, "/sbin/nginx")
|
76
|
-
fetch_or_default(:nginx_conf_path, "/etc/nginx/nginx.conf")
|
77
|
-
fetch_or_default(:nginx_pid_path, "/var/run/nginx.pid")
|
78
|
-
|
79
52
|
utils.install_template("nginx/nginx.initd.centos.erb", "/etc/init.d/nginx")
|
80
53
|
run_via "/sbin/chkconfig --level 345 nginx on"
|
81
54
|
end
|
@@ -84,8 +57,7 @@ namespace :nginx do
|
|
84
57
|
desc "Restart nginx (service)"
|
85
58
|
task :restart do
|
86
59
|
sudo "/sbin/service nginx restart"
|
87
|
-
end
|
88
|
-
|
60
|
+
end
|
89
61
|
|
90
62
|
end
|
91
63
|
|
data/lib/recipes/centos/ruby.rb
CHANGED
@@ -5,14 +5,10 @@ namespace :ruby do
|
|
5
5
|
desc <<-DESC
|
6
6
|
Install ruby and rubygems.
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
<dt>rubygems_build_options<dt>
|
13
|
-
<dd>Rubygems build options.</dd>
|
14
|
-
</dl>
|
15
|
-
|
8
|
+
"Source":#{link_to_source(__FILE__)}
|
9
|
+
DESC
|
10
|
+
task_arg(:ruby_build_options, <<-EOS)
|
11
|
+
Rubygems build options.
|
16
12
|
<pre>
|
17
13
|
<code class="ruby">
|
18
14
|
set :ruby_build_options, {
|
@@ -23,14 +19,9 @@ namespace :ruby do
|
|
23
19
|
}
|
24
20
|
</code>
|
25
21
|
</pre>
|
26
|
-
|
27
|
-
|
22
|
+
EOS
|
23
|
+
task_arg(:rubygems_build_options, "Rubygems build options")
|
28
24
|
task :install do
|
29
|
-
|
30
|
-
# Settings
|
31
|
-
fetch(:ruby_build_options)
|
32
|
-
fetch(:rubygems_build_options)
|
33
|
-
|
34
25
|
# Install dependencies
|
35
26
|
yum.install([ "zlib", "zlib-devel", "readline-devel" ])
|
36
27
|
|
@@ -5,10 +5,9 @@ namespace :sphinx do
|
|
5
5
|
desc <<-DESC
|
6
6
|
Install sphinx.\n
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
<dd>
|
8
|
+
DESC
|
9
|
+
task_arg(:sphinx_build_options, <<-EOS)
|
10
|
+
Sphinx build options.
|
12
11
|
<pre>
|
13
12
|
<code class="ruby">
|
14
13
|
set :sphinx_build_options, {
|
@@ -18,19 +17,9 @@ namespace :sphinx do
|
|
18
17
|
}
|
19
18
|
</code>
|
20
19
|
</pre>
|
21
|
-
|
22
|
-
|
23
|
-
<dt>sphinx_prefix</dt>
|
24
|
-
<dd>Sphinx install prefix</dd>
|
25
|
-
<dd class="default">Defaults to @/usr/local/sphinx@</dd>
|
26
|
-
</dl>
|
27
|
-
DESC
|
20
|
+
EOS
|
21
|
+
task_arg(:sphinx_prefix, "Sphinx install prefix", :default => "/usr/local/sphinx")
|
28
22
|
task :install do
|
29
|
-
|
30
|
-
# Settings
|
31
|
-
fetch(:sphinx_build_options)
|
32
|
-
fetch_or_default(:sphinx_prefix, "/usr/local/sphinx")
|
33
|
-
|
34
23
|
# Install dependencies
|
35
24
|
yum.install([ "gcc-c++" ])
|
36
25
|
|
@@ -41,37 +30,25 @@ namespace :sphinx do
|
|
41
30
|
desc <<-DESC
|
42
31
|
Setup sphinx for application.
|
43
32
|
|
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
33
|
"Source":#{link_to_source(__FILE__)}
|
51
34
|
DESC
|
35
|
+
task_arg(:sphinx_prefix, "Sphinx install prefix", :default => "/usr/local/sphinx")
|
36
|
+
task_arg(:sphinx_pid_path, "Directory to sphinx pid", :default => Proc.new{"#{shared_path}/pids/searchd.pid"}, :default_desc => "\#{shared_path}/pids/searchd.pid")
|
37
|
+
task_arg(:sphinx_conf_path, "Path to sphinx.conf", :default => Proc.new{"#{shared_path}/config/sphinx.conf"}, :default_desc => "\#{shared_path}/config/sphinx.conf")
|
38
|
+
task_arg(:sphinx_index_root, "Path to sphinx indexes", :default => Proc.new{"#{shared_path}/var/index"}, :default_desc => "\#{shared_path}/var/index")
|
52
39
|
task :setup do
|
53
|
-
|
54
|
-
# Settings
|
55
|
-
fetch_or_default(:sphinx_prefix, "/usr/local/sphinx")
|
56
|
-
fetch_or_default(:sphinx_pid_path, "#{shared_path}/pids/searchd.pid")
|
57
|
-
fetch_or_default(:sphinx_conf_path, "#{shared_path}/config/sphinx.conf")
|
58
|
-
fetch_or_default(:sphinx_index_root, "#{shared_path}/var/index")
|
59
|
-
|
60
40
|
initscript
|
61
|
-
|
62
41
|
# Create app indexes dir
|
63
42
|
run "mkdir -p #{shared_path}/var/index"
|
64
43
|
end
|
65
44
|
|
66
45
|
|
67
46
|
desc "Setup sphinx initscript"
|
47
|
+
task_arg(:sphinx_prefix, "Sphinx install prefix", :default => "/usr/local/sphinx")
|
48
|
+
task_arg(:sphinx_pid_path, "Directory to sphinx pid", :default => Proc.new{"#{shared_path}/pids/searchd.pid"}, :default_desc => "\#{shared_path}/pids/searchd.pid")
|
49
|
+
task_arg(:sphinx_conf_path, "Path to sphinx.conf", :default => Proc.new{"#{shared_path}/config/sphinx.conf"}, :default_desc => "\#{shared_path}/config/sphinx.conf")
|
50
|
+
task_arg(:sphinx_index_root, "Path to sphinx indexes", :default => Proc.new{"#{shared_path}/var/index"}, :default_desc => "\#{shared_path}/var/index")
|
68
51
|
task :initscript do
|
69
|
-
|
70
|
-
fetch_or_default(:sphinx_prefix, "/usr/local/sphinx")
|
71
|
-
fetch_or_default(:sphinx_pid_path, "#{shared_path}/pids/searchd.pid")
|
72
|
-
fetch_or_default(:sphinx_conf_path, "#{shared_path}/config/sphinx.conf")
|
73
|
-
fetch_or_default(:sphinx_index_root, "#{shared_path}/var/index")
|
74
|
-
|
75
52
|
utils.install_template("sphinx/sphinx_app.initd.centos.erb", "/etc/init.d/sphinx_#{application}")
|
76
53
|
run_via "/sbin/chkconfig --level 345 sphinx_#{application} on"
|
77
54
|
|
data/lib/recipes/docs.rb
CHANGED
@@ -5,24 +5,12 @@ namespace :docs do
|
|
5
5
|
|
6
6
|
This recipe generated this documentation.
|
7
7
|
|
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
|
-
|
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
8
|
"Source":#{link_to_source(__FILE__)}
|
19
9
|
DESC
|
10
|
+
task_arg(:docs_recipes_dir, "Destination directory", :default => "docs/recipes")
|
11
|
+
task_arg(:docs_recipes_clear, "Whether to clear destination before generating.", :default => true)
|
20
12
|
task :recipes do
|
21
13
|
|
22
|
-
# Settings
|
23
|
-
fetch_or_default(:docs_recipes_dir, "docs/recipes")
|
24
|
-
fetch_or_default(:docs_recipes_clear, true)
|
25
|
-
|
26
14
|
# Build task tree
|
27
15
|
top_node = capitate.task_tree
|
28
16
|
|
data/lib/recipes/logrotated.rb
CHANGED
@@ -3,23 +3,22 @@ namespace :logrotated do
|
|
3
3
|
|
4
4
|
desc <<-DESC
|
5
5
|
Create logrotated conf. You probably use this in other recipes and not standalone.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
<dd>:copytruncate</dd>
|
6
|
+
|
7
|
+
"Source":#{link_to_source(__FILE__)}
|
8
|
+
DESC
|
9
|
+
task_arg(:logrotate_name, "Name of file in /etc/logrotate.d/")
|
10
|
+
task_arg(:logrotate_log_path, "Path to log file. Can include wildcards, like /var/log/foo_*.log.")
|
11
|
+
task_arg(:logrotate_options, <<-EOS)
|
12
|
+
Log rotate options
|
13
|
+
|
14
|
+
* :rotate (Number of times to rotate before discarding)
|
15
|
+
* :size (Rotate when file hits this size)
|
16
|
+
* :daily, :weekly, :monthly (How often to perform rotate)
|
17
|
+
* :missingok
|
18
|
+
* :compress
|
19
|
+
* :delaycompress
|
20
|
+
* :notifempty
|
21
|
+
* :copytruncate
|
23
22
|
|
24
23
|
See man page for all the options.
|
25
24
|
|
@@ -29,14 +28,9 @@ namespace :logrotated do
|
|
29
28
|
:daily, :missingok, :compress, :delaycompress, :notifempty, :copytruncate ]
|
30
29
|
</code>
|
31
30
|
</pre>
|
32
|
-
|
33
|
-
DESC
|
31
|
+
EOS
|
34
32
|
task :install_conf do
|
35
33
|
|
36
|
-
fetch(:logrotate_name)
|
37
|
-
fetch(:logrotate_log_path)
|
38
|
-
fetch(:logrotate_options)
|
39
|
-
|
40
34
|
text = []
|
41
35
|
logrotate_options.each do |option|
|
42
36
|
if option.is_a?(Hash)
|
@@ -56,26 +50,12 @@ namespace :logrotated do
|
|
56
50
|
desc <<-DESC
|
57
51
|
Force rotate files.
|
58
52
|
|
59
|
-
<dl>
|
60
|
-
<dt>logrotate_prefix</dt>
|
61
|
-
<dd>Path to logrotate</dd>
|
62
|
-
<dd>Defaults to none</dd>
|
63
|
-
|
64
|
-
<dt>logrotate_conf_path</dt>
|
65
|
-
<dd>Path to logrotate conf</dd>
|
66
|
-
<dd>Defaults to @"/etc/logrotate.conf"@</dd>
|
67
|
-
</dl>
|
68
53
|
"Source":#{link_to_source(__FILE__)}
|
69
54
|
DESC
|
55
|
+
task_arg(:logrotate_bin_path, "Logrotate bin path", :default => "logrotate", :example => "/usr/local/bin/logrotate")
|
56
|
+
task_arg(:logrotate_conf_path, "Path to logrotate conf", :default => "/etc/logrotate.conf")
|
70
57
|
task :force do
|
71
|
-
|
72
|
-
fetch_or_default(:logrotate_prefix, "")
|
73
|
-
fetch_or_default(:logrotate_conf_path, "/etc/logrotate.conf")
|
74
|
-
|
75
|
-
command = "logrotate"
|
76
|
-
command = "#{logrotate_prefix}/logrotate" unless logrotate_prefix.blank?
|
77
|
-
|
78
|
-
run_via "#{command} -f #{logrotate_conf_path}"
|
58
|
+
run_via "#{logrotate_bin_path} -f #{logrotate_conf_path}"
|
79
59
|
end
|
80
60
|
|
81
61
|
end
|