capitate 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Manifest.txt +0 -1
- data/docs/recipes/deploy.txt +8 -0
- data/docs/recipes/index.txt +1 -1
- data/docs/recipes/monit-centos.txt +15 -0
- data/docs/recipes/monit.txt +1 -1
- data/docs/recipes/rails.txt +6 -0
- data/lib/capitate/plugins/script.rb +6 -6
- data/lib/capitate/version.rb +1 -1
- data/lib/recipes/centos/monit.rb +17 -0
- data/lib/recipes/centos/nginx.rb +0 -1
- data/lib/recipes/rails.rb +5 -0
- data/lib/templates/monit/monit.initd.centos.erb +1 -1
- data/lib/templates/rails/database.yml.erb +2 -36
- data/website/index.html +1 -1
- metadata +1 -2
- data/lib/recipes/deploy.rb +0 -18
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/docs/recipes/deploy.txt
CHANGED
@@ -89,7 +89,11 @@ Deploy and run pending migrations. This will work similarly to the `deploy'
|
|
89
89
|
|
90
90
|
h3(#deploy:restart). deploy:restart
|
91
91
|
|
92
|
+
Restarts your application. This works by calling the script/process/reaper script under the current path.
|
92
93
|
|
94
|
+
By default, this will be invoked via sudo as the `app' user. If you wish to run it as a different user, set the :runner variable to that user. If you are in an environment where you can't use sudo, set the :use_sudo variable to false:
|
95
|
+
|
96
|
+
set :use_sudo, false
|
93
97
|
|
94
98
|
|
95
99
|
|
@@ -117,13 +121,17 @@ It is safe to run this task on servers that have already been set up; it wil
|
|
117
121
|
|
118
122
|
h3(#deploy:start). deploy:start
|
119
123
|
|
124
|
+
Start the application servers. This will attempt to invoke a script in your application called `script/spin', which must know how to start your application listeners. For Rails applications, you might just have that script invoke `script/process/spawner' with the appropriate arguments.
|
120
125
|
|
126
|
+
By default, the script will be executed via sudo as the `app' user. If you wish to run it as a different user, set the :runner variable to that user. If you are in an environment where you can't use sudo, set the :use_sudo variable to false.
|
121
127
|
|
122
128
|
|
123
129
|
|
124
130
|
h3(#deploy:stop). deploy:stop
|
125
131
|
|
132
|
+
Stop the application servers. This will call script/process/reaper for both the spawner process, and all of the application processes it has spawned. As such, it is fairly Rails specific and may need to be overridden for other systems.
|
126
133
|
|
134
|
+
By default, the script will be executed via sudo as the `app' user. If you wish to run it as a different user, set the :runner variable to that user. If you are in an environment where you can't use sudo, set the :use_sudo variable to false.
|
127
135
|
|
128
136
|
|
129
137
|
|
data/docs/recipes/index.txt
CHANGED
@@ -15,7 +15,7 @@ h2. Namespaces
|
|
15
15
|
* "memcached:centos":memcached-centos.html (1)
|
16
16
|
* "mongrel_cluster":mongrel_cluster.html (1)
|
17
17
|
* "mongrel_cluster:centos":mongrel_cluster-centos.html (1)
|
18
|
-
* "monit:centos":monit-centos.html (
|
18
|
+
* "monit:centos":monit-centos.html (2)
|
19
19
|
* "mysql":mysql.html (2)
|
20
20
|
* "mysql:centos":mysql-centos.html (1)
|
21
21
|
* "nginx":nginx.html (2)
|
@@ -6,6 +6,7 @@ h1. monit:centos
|
|
6
6
|
h2. Tasks
|
7
7
|
|
8
8
|
* "monit:centos:install":#monit:centos:install
|
9
|
+
* "monit:centos:restart":#monit:centos:restart
|
9
10
|
|
10
11
|
|
11
12
|
h2. Task documentation
|
@@ -27,6 +28,20 @@ Install monit.
|
|
27
28
|
*monit_conf_dir*: Directory for monitrc files.
|
28
29
|
|
29
30
|
@set :monit_conf_dir, "/etc/monit"@
|
31
|
+
|
32
|
+
*monit_pid_path*: Path to monit pid.
|
33
|
+
|
34
|
+
@set :monit_pid_path, "/var/run/monit.pid"@
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
h3(#monit:centos:restart). monit:centos:restart
|
39
|
+
|
40
|
+
Monit HUP.
|
41
|
+
|
42
|
+
*monit_pid_path*: Path to monit pid.
|
43
|
+
|
44
|
+
@set :monit_pid_path, "/var/run/monit.pid"@
|
30
45
|
|
31
46
|
|
32
47
|
|
data/docs/recipes/monit.txt
CHANGED
data/docs/recipes/rails.txt
CHANGED
@@ -41,6 +41,12 @@ Create database yaml in shared path.
|
|
41
41
|
*db_pass*: Database password (rails).
|
42
42
|
|
43
43
|
@set :db_pass, "the_password"@
|
44
|
+
|
45
|
+
*db_host*: Database host (can be nil, if you are using socket). _Defaults to nil_
|
46
|
+
|
47
|
+
*db_socket*: Database socket (can be nil, if you are using host). _Defaults to nil_
|
48
|
+
|
49
|
+
@set :db_socket, "/var/lib/mysql/mysql.sock"@
|
44
50
|
|
45
51
|
|
46
52
|
|
@@ -27,9 +27,9 @@ module Capitate::Plugins::Script
|
|
27
27
|
end
|
28
28
|
|
29
29
|
run_all <<-CMDS
|
30
|
-
cd #{dir} && ./configure #{configure_options} #{to_log}
|
31
|
-
cd #{dir} && make #{to_log}
|
32
|
-
cd #{dir} && make install #{to_log}
|
30
|
+
sh -c "cd #{dir} && ./configure #{configure_options} #{to_log}"
|
31
|
+
sh -c "cd #{dir} && make #{to_log}"
|
32
|
+
sh -c "cd #{dir} && make install #{to_log}"
|
33
33
|
CMDS
|
34
34
|
end
|
35
35
|
end
|
@@ -116,7 +116,7 @@ module Capitate::Plugins::Script
|
|
116
116
|
|
117
117
|
run_all <<-CMDS
|
118
118
|
mkdir -p #{dest} && cd #{dest} && #{http_get_method} #{url}
|
119
|
-
cd #{dest} && tar zxf #{file}
|
119
|
+
sh -c "cd #{dest} && tar zxf #{file}"
|
120
120
|
CMDS
|
121
121
|
|
122
122
|
if block_given?
|
@@ -136,8 +136,8 @@ module Capitate::Plugins::Script
|
|
136
136
|
def run_all(cmds, options = {}, &block)
|
137
137
|
cmds.split("\n").each do |cmd|
|
138
138
|
cmd = cmd.gsub(/^\s+/, "")
|
139
|
-
sh_cmd = %{sh -c "#{cmd.gsub("\"", "\"\"")}"}
|
140
|
-
run_via(
|
139
|
+
#sh_cmd = %{sh -c "#{cmd.gsub("\"", "\"\"")}"}
|
140
|
+
run_via(cmd, options, &block)
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
data/lib/capitate/version.rb
CHANGED
data/lib/recipes/centos/monit.rb
CHANGED
@@ -12,6 +12,8 @@ namespace :monit do
|
|
12
12
|
@set :monit_password, prompt.password('Monit admin password (to set): ')@\n
|
13
13
|
*monit_conf_dir*: Directory for monitrc files.\n
|
14
14
|
@set :monit_conf_dir, "/etc/monit"@\n
|
15
|
+
*monit_pid_path*: Path to monit pid.\n
|
16
|
+
@set :monit_pid_path, "/var/run/monit.pid"@\n
|
15
17
|
DESC
|
16
18
|
task :install do
|
17
19
|
|
@@ -19,6 +21,7 @@ namespace :monit do
|
|
19
21
|
fetch_or_default(:monit_port, 2812)
|
20
22
|
fetch_or_default(:monit_password, prompt.password('Monit admin password (to set): ', true))
|
21
23
|
fetch_or_default(:monit_conf_dir, "/etc/monit")
|
24
|
+
fetch_or_default(:monit_pid_path, "/var/run/monit.pid")
|
22
25
|
fetch(:monit_build_options)
|
23
26
|
|
24
27
|
# Install dependencies
|
@@ -42,6 +45,20 @@ namespace :monit do
|
|
42
45
|
put template.load("monit/monit.cnf"), "/tmp/monit.cnf"
|
43
46
|
script.sh("monit/cert.sh")
|
44
47
|
end
|
48
|
+
|
49
|
+
desc <<-DESC
|
50
|
+
Monit HUP.
|
51
|
+
|
52
|
+
*monit_pid_path*: Path to monit pid.\n
|
53
|
+
@set :monit_pid_path, "/var/run/monit.pid"@\n
|
54
|
+
DESC
|
55
|
+
task :restart do
|
56
|
+
|
57
|
+
# Settings
|
58
|
+
fetch_or_default(:monit_pid_path, "/var/run/monit.pid")
|
59
|
+
|
60
|
+
sudo "kill -HUP `cat #{monit_pid_path}`"
|
61
|
+
end
|
45
62
|
|
46
63
|
end
|
47
64
|
|
data/lib/recipes/centos/nginx.rb
CHANGED
data/lib/recipes/rails.rb
CHANGED
@@ -10,6 +10,9 @@ namespace :rails do
|
|
10
10
|
@set :db_user, "app_db_user"@\n
|
11
11
|
*db_pass*: Database password (rails).\n
|
12
12
|
@set :db_pass, "the_password"@\n
|
13
|
+
*db_host*: Database host (can be nil, if you are using socket). _Defaults to nil_\n
|
14
|
+
*db_socket*: Database socket (can be nil, if you are using host). _Defaults to nil_\n
|
15
|
+
@set :db_socket, "/var/lib/mysql/mysql.sock"@\n
|
13
16
|
DESC
|
14
17
|
task :setup do
|
15
18
|
|
@@ -17,6 +20,8 @@ namespace :rails do
|
|
17
20
|
fetch(:db_name)
|
18
21
|
fetch(:db_user)
|
19
22
|
fetch(:db_pass)
|
23
|
+
fetch_or_default(:db_host, nil)
|
24
|
+
fetch_or_default(:db_socket, nil)
|
20
25
|
|
21
26
|
run "mkdir -p #{shared_path}/config"
|
22
27
|
put template.load("rails/database.yml.erb"), "#{shared_path}/config/database.yml"
|
@@ -1,42 +1,8 @@
|
|
1
|
-
# MySQL (default setup). Versions 4.1 and 5.0 are recommended.
|
2
|
-
#
|
3
|
-
# Install the MySQL driver:
|
4
|
-
# gem install mysql
|
5
|
-
# On Mac OS X:
|
6
|
-
# sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
|
7
|
-
# On Mac OS X Leopard:
|
8
|
-
# sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
|
9
|
-
# This sets the ARCHFLAGS environment variable to your native architecture
|
10
|
-
# On Windows:
|
11
|
-
# gem install mysql
|
12
|
-
# Choose the win32 build.
|
13
|
-
# Install MySQL and put its /bin directory on your path.
|
14
|
-
#
|
15
|
-
# And be sure to use new-style password hashing:
|
16
|
-
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
|
17
|
-
development:
|
18
|
-
adapter: mysql
|
19
|
-
encoding: utf8
|
20
|
-
database: <%= db_name %>_development
|
21
|
-
username: root
|
22
|
-
password:
|
23
|
-
socket: /tmp/mysql.sock
|
24
|
-
|
25
|
-
# Warning: The database defined as 'test' will be erased and
|
26
|
-
# re-generated from your development database when you run 'rake'.
|
27
|
-
# Do not set this db to the same as development or production.
|
28
|
-
test:
|
29
|
-
adapter: mysql
|
30
|
-
encoding: utf8
|
31
|
-
database: <%= db_name %>_test
|
32
|
-
username: root
|
33
|
-
password:
|
34
|
-
socket: /tmp/mysql.sock
|
35
|
-
|
36
1
|
production:
|
37
2
|
adapter: mysql
|
38
3
|
encoding: utf8
|
39
4
|
database: <%= db_name %>
|
40
5
|
username: <%= db_user %>
|
41
6
|
password: <%= db_pass %>
|
42
|
-
|
7
|
+
<%= "host: #{db_host}" unless db_host.blank? %>
|
8
|
+
<%= "socket: #{db_socket}" unless db_socket.blank? %>
|
data/website/index.html
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
|
39
39
|
<div id="version" class="clickable box" onclick='document.location = "http://rubyforge.org/projects/capitate"; return false'>
|
40
40
|
<p>Get Version</p>
|
41
|
-
<a href="http://rubyforge.org/projects/capitate" class="numbers">0.2.
|
41
|
+
<a href="http://rubyforge.org/projects/capitate" class="numbers">0.2.3</a>
|
42
42
|
</div>
|
43
43
|
|
44
44
|
<div id="recipes">
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capitate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ""
|
6
6
|
authors:
|
7
7
|
- Gabriel Handford
|
@@ -117,7 +117,6 @@ files:
|
|
117
117
|
- lib/recipes/centos/nginx.rb
|
118
118
|
- lib/recipes/centos/ruby.rb
|
119
119
|
- lib/recipes/centos/sphinx.rb
|
120
|
-
- lib/recipes/deploy.rb
|
121
120
|
- lib/recipes/docs.rb
|
122
121
|
- lib/recipes/memcached.rb
|
123
122
|
- lib/recipes/mongrel_cluster.rb
|
data/lib/recipes/deploy.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# Override default deploy tasks here (using Monit).
|
2
|
-
# If not using monit, use service start/stop:
|
3
|
-
# sudo "/sbin/service mongrel_cluster_#{application} restart"
|
4
|
-
namespace :deploy do
|
5
|
-
|
6
|
-
task :restart, :roles => :web do
|
7
|
-
sudo "/usr/local/bin/monit -g mongrel_cluster_#{application} restart all"
|
8
|
-
end
|
9
|
-
|
10
|
-
task :start, :roles => :web do
|
11
|
-
sudo "/usr/local/bin/monit -g mongrel_cluster_#{application} start all"
|
12
|
-
end
|
13
|
-
|
14
|
-
task :stop, :roles => :web do
|
15
|
-
sudo "/usr/local/bin/monit -g mongrel_cluster_#{application} stop all"
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|