capitate 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/docs/recipes/centos.txt +2 -2
- data/docs/recipes/mongrel_cluster-centos.txt +6 -0
- data/docs/recipes/mysql.txt +2 -2
- data/docs/recipes/nginx.txt +8 -7
- data/docs/recipes/rails.txt +4 -4
- data/docs/recipes/sphinx.txt +2 -0
- data/lib/capitate/cap_ext/connections.rb +7 -6
- data/lib/capitate/plugins/prompt.rb +6 -3
- data/lib/capitate/plugins/script.rb +21 -7
- data/lib/capitate/plugins/templates.rb +1 -2
- data/lib/capitate/version.rb +1 -1
- data/lib/deployment/install-centos-rubyweb.rb +6 -9
- data/lib/recipes/centos/centos.rb +17 -24
- data/lib/recipes/centos/mongrel_cluster.rb +9 -8
- data/lib/recipes/mysql.rb +15 -7
- data/lib/recipes/nginx.rb +11 -21
- data/lib/recipes/rails.rb +6 -12
- data/lib/recipes/sphinx.rb +6 -17
- data/lib/templates/mongrel/mongrel_cluster.initd.erb +2 -2
- data/lib/templates/mongrel/mongrel_cluster.yml.erb +2 -2
- data/lib/templates/mysql/install_db.sql.erb +2 -2
- data/website/index.html +5 -5
- data/website/index.txt +3 -3
- metadata +4 -4
data/History.txt
CHANGED
data/docs/recipes/centos.txt
CHANGED
@@ -14,9 +14,9 @@ h3(#centos:add_user). centos:add_user
|
|
14
14
|
|
15
15
|
Add user and set user password for application. Adds user to specified groups.
|
16
16
|
|
17
|
-
*
|
17
|
+
*user_add*: User to add.
|
18
18
|
|
19
|
-
@set :
|
19
|
+
@set :user_add, "app_user"@
|
20
20
|
*groups*: Groups for user to be in. _Defaults to none_
|
21
21
|
|
22
22
|
@set :groups, "admin,foo"@
|
@@ -22,6 +22,12 @@ Create mongrel cluster.
|
|
22
22
|
then instances will be at 9000, 9001, and 9002
|
23
23
|
|
24
24
|
@set :mongrel_port, 9000@
|
25
|
+
|
26
|
+
*mongrel_config_dir*: Directory for mongrel config. _Defaults to "[shared_path]/config/mongrel"_
|
27
|
+
*mongrel_pid_dir*: Directory for mongrel pids. _Defaults to "[shared_path]/pids"
|
28
|
+
*mongrel_config_script*: Config script to load with mongrel. _Defaults to nil_
|
29
|
+
|
30
|
+
@set :mongrel_config_script, "config/mongrel_handler.rb"@
|
25
31
|
|
26
32
|
|
27
33
|
|
data/docs/recipes/mysql.txt
CHANGED
@@ -42,11 +42,11 @@ Create database, database user, and set grant permissions.
|
|
42
42
|
|
43
43
|
*db_pass*: Database password (application).
|
44
44
|
|
45
|
-
*
|
45
|
+
*mysql_grant_locations*: Grant locations. _Defaults to localhost_
|
46
46
|
|
47
47
|
@set :grant_locations, [ "localhost", "192.168.1.111" ]@
|
48
48
|
|
49
|
-
*
|
49
|
+
*mysql_grant_priv_type*: Grant privilege types. _Defaults to ALL_
|
50
50
|
|
51
51
|
@set :grant_priv_type, "ALL"@
|
52
52
|
|
data/docs/recipes/nginx.txt
CHANGED
@@ -34,18 +34,19 @@ h3(#nginx:setup_mongrel). nginx:setup_mongrel
|
|
34
34
|
|
35
35
|
Create and update the nginx vhost include.
|
36
36
|
|
37
|
-
mongrel_size
|
37
|
+
*mongrel_size*: Number of mongrels.
|
38
38
|
|
39
|
-
|
39
|
+
@set :mongrel_size, 3@
|
40
40
|
|
41
|
-
mongrel_port
|
42
|
-
If there are 3 mongrels with port 9000, then instances will be at 9000, 9001, and 9002
|
41
|
+
*mongrel_port*: Starting port for mongrels.
|
43
42
|
|
44
|
-
|
43
|
+
If there are 3 mongrels with port 9000, then instances will be at 9000, 9001, and 9002
|
45
44
|
|
46
|
-
|
45
|
+
@set :mongrel_port, 9000@
|
47
46
|
|
48
|
-
|
47
|
+
*domain_name*: Domain name for nginx virtual host, (without www prefix).
|
48
|
+
|
49
|
+
@set :domain_name, "foo.com"@
|
49
50
|
|
50
51
|
|
51
52
|
|
data/docs/recipes/rails.txt
CHANGED
@@ -30,15 +30,15 @@ h3(#rails:setup). rails:setup
|
|
30
30
|
|
31
31
|
Create database yaml in shared path.
|
32
32
|
|
33
|
-
*db_name*: Database name (rails).
|
34
|
-
|
33
|
+
*db_name*: Database name (rails).
|
34
|
+
|
35
35
|
@set :db_name, "app_db_name"@
|
36
36
|
|
37
|
-
*db_user*: Database user (rails).
|
37
|
+
*db_user*: Database user (rails).
|
38
38
|
|
39
39
|
@set :db_user, "app_db_user"@
|
40
40
|
|
41
|
-
*db_pass*: Database password (rails).
|
41
|
+
*db_pass*: Database password (rails).
|
42
42
|
|
43
43
|
@set :db_pass, "the_password"@
|
44
44
|
|
data/docs/recipes/sphinx.txt
CHANGED
@@ -12,10 +12,10 @@ module Capistrano::Configuration::Connections
|
|
12
12
|
# # Do something as user nginx
|
13
13
|
#
|
14
14
|
def set_user(new_user)
|
15
|
-
|
15
|
+
previous_user = fetch(:user)
|
16
16
|
|
17
|
-
return if
|
18
|
-
|
17
|
+
return if previous_user == new_user
|
18
|
+
set :previous_user, previous_user
|
19
19
|
|
20
20
|
set :user, new_user
|
21
21
|
clear_sessions
|
@@ -32,8 +32,9 @@ module Capistrano::Configuration::Connections
|
|
32
32
|
# # User is now root
|
33
33
|
#
|
34
34
|
def reset_user
|
35
|
-
|
36
|
-
|
35
|
+
return unless exists?(:previous_user)
|
36
|
+
set :user, fetch(:previous_user)
|
37
|
+
unset :previous_user
|
37
38
|
clear_sessions
|
38
39
|
end
|
39
40
|
|
@@ -51,7 +52,7 @@ module Capistrano::Configuration::Connections
|
|
51
52
|
def with_user(new_user, &block)
|
52
53
|
begin
|
53
54
|
set_user(new_user)
|
54
|
-
yield
|
55
|
+
yield exists?(:previous_user) ? fetch(:previous_user) : nil
|
55
56
|
ensure
|
56
57
|
reset_user
|
57
58
|
end
|
@@ -5,18 +5,21 @@ module Capitate::Plugins::Prompt
|
|
5
5
|
Capistrano::CLI.ui.ask(label, &block)
|
6
6
|
end
|
7
7
|
|
8
|
-
def password(label, verify = false)
|
8
|
+
def password(label, verify = false, lazy = true)
|
9
9
|
# Lazy
|
10
|
-
Proc.new {
|
10
|
+
password_prompt = Proc.new {
|
11
11
|
password = Capistrano::CLI.password_prompt(label)
|
12
12
|
|
13
13
|
if verify
|
14
|
-
password_verify = Capistrano::CLI.password_prompt("[
|
14
|
+
password_verify = Capistrano::CLI.password_prompt("[VERIFY] #{label}")
|
15
15
|
raise "Passwords do not match" if password != password_verify
|
16
16
|
end
|
17
17
|
|
18
18
|
password
|
19
19
|
}
|
20
|
+
|
21
|
+
return password_prompt if lazy
|
22
|
+
password_prompt.call
|
20
23
|
end
|
21
24
|
|
22
25
|
end
|
@@ -9,6 +9,7 @@ module Capitate::Plugins::Script
|
|
9
9
|
# - +url+:: URL to download package from
|
10
10
|
# - +configure_options+:: Options for ./configure
|
11
11
|
# - +unpack_dir+:: Directory that is unpacked from tgz (if not matching the file name)
|
12
|
+
# - +to_log+:: If specified, will redirect output to this path
|
12
13
|
#
|
13
14
|
# ==== Examples (in capistrano task)
|
14
15
|
# script.make_install("nginx", { :url => "http://sysoev.ru/nginx/nginx-0.5.35.tar.gz", ... })
|
@@ -17,10 +18,18 @@ module Capitate::Plugins::Script
|
|
17
18
|
install(name, options) do |dir|
|
18
19
|
configure_options = options[:configure_options] || ""
|
19
20
|
|
21
|
+
# Whether to capture build output
|
22
|
+
unless options.has_key?(:to_log)
|
23
|
+
to_log = ">> debug.log"
|
24
|
+
else
|
25
|
+
to_log = ""
|
26
|
+
to_log = ">> #{options[:to_log]}" unless options[:to_log].blank?
|
27
|
+
end
|
28
|
+
|
20
29
|
run_all <<-CMDS
|
21
|
-
|
22
|
-
|
23
|
-
|
30
|
+
cd #{dir} && ./configure #{configure_options} #{to_log}
|
31
|
+
cd #{dir} && make #{to_log}
|
32
|
+
cd #{dir} && make install #{to_log}
|
24
33
|
CMDS
|
25
34
|
end
|
26
35
|
end
|
@@ -103,9 +112,11 @@ module Capitate::Plugins::Script
|
|
103
112
|
|
104
113
|
unpack_dir ||= file.gsub(/\.tar\.gz|\.tgz/, "")
|
105
114
|
|
115
|
+
http_get_method = fetch(:http_get_method, "wget -nv")
|
116
|
+
|
106
117
|
run_all <<-CMDS
|
107
|
-
|
108
|
-
|
118
|
+
mkdir -p #{dest} && cd #{dest} && #{http_get_method} #{url}
|
119
|
+
cd #{dest} && tar zxf #{file}
|
109
120
|
CMDS
|
110
121
|
|
111
122
|
if block_given?
|
@@ -115,7 +126,8 @@ module Capitate::Plugins::Script
|
|
115
126
|
end
|
116
127
|
end
|
117
128
|
|
118
|
-
# Run all commands (separated by newlines)
|
129
|
+
# Run all commands (separated by newlines).
|
130
|
+
# Runs with <tt>sh -c</tt>, so sudo can work with any command
|
119
131
|
#
|
120
132
|
# ==== Options
|
121
133
|
# +cmds+:: Commands (separated by newlines)
|
@@ -123,7 +135,9 @@ module Capitate::Plugins::Script
|
|
123
135
|
#
|
124
136
|
def run_all(cmds, options = {}, &block)
|
125
137
|
cmds.split("\n").each do |cmd|
|
126
|
-
|
138
|
+
cmd = cmd.gsub(/^\s+/, "")
|
139
|
+
sh_cmd = %{sh -c "#{cmd.gsub("\"", "\"\"")}"}
|
140
|
+
run_via(sh_cmd, options, &block)
|
127
141
|
end
|
128
142
|
end
|
129
143
|
|
@@ -21,7 +21,6 @@ module Capitate::Plugins::Templates
|
|
21
21
|
# put template.load("memcached/memcached.monitrc.erb"), "/tmp/memcached.monitrc"
|
22
22
|
#
|
23
23
|
def load(path, override_binding = nil)
|
24
|
-
|
25
24
|
template_dirs_found = template_dirs.select { |dir| File.exist?("#{dir}/#{path}") }
|
26
25
|
|
27
26
|
# Not found anywhere, throw error
|
@@ -75,7 +74,7 @@ protected
|
|
75
74
|
@template_dir ||= begin
|
76
75
|
template_dirs = []
|
77
76
|
template_dirs += fetch(:templates_dirs) if exists?(:templates_dirs)
|
78
|
-
template_dirs <<
|
77
|
+
template_dirs << "."
|
79
78
|
template_dirs << project_root if exists?(:project_root)
|
80
79
|
template_dirs << gem_templates_root
|
81
80
|
template_dirs
|
data/lib/capitate/version.rb
CHANGED
@@ -26,7 +26,7 @@ task :install do
|
|
26
26
|
egrep "^admin" /etc/group || /usr/sbin/groupadd admin
|
27
27
|
sed -i -e 's/^id:5:initdefault:/id:3:initdefault:/g' /etc/inittab
|
28
28
|
mkdir -p /var/www/apps
|
29
|
-
egrep "^%admin" /etc/sudoers || echo "%admin ALL=(ALL) ALL"
|
29
|
+
egrep "^%admin" /etc/sudoers || echo "%admin ALL=(ALL) ALL" >> /etc/sudoers
|
30
30
|
CMDS
|
31
31
|
|
32
32
|
# Package installs
|
@@ -65,14 +65,6 @@ task :install do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
|
68
|
-
# For mysql:install
|
69
|
-
set :mysql_pid_path, "/var/run/mysqld/mysqld.pid"
|
70
|
-
set :db_port, 3306
|
71
|
-
|
72
|
-
# For sphinx:install
|
73
|
-
set :sphinx_prefix, "/usr/local/sphinx"
|
74
|
-
|
75
|
-
|
76
68
|
#
|
77
69
|
# Install options
|
78
70
|
#
|
@@ -118,12 +110,17 @@ set :nginx_build_options, {
|
|
118
110
|
}
|
119
111
|
|
120
112
|
# Sphinx install
|
113
|
+
set :sphinx_prefix, "/usr/local/sphinx"
|
121
114
|
set :sphinx_build_options, {
|
122
115
|
:url => "http://www.sphinxsearch.com/downloads/sphinx-0.9.7.tar.gz",
|
123
116
|
:configure_options => "--with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib/mysql \
|
124
117
|
--prefix=#{sphinx_prefix}"
|
125
118
|
}
|
126
119
|
|
120
|
+
# Mysql install
|
121
|
+
set :mysql_pid_path, "/var/run/mysqld/mysqld.pid"
|
122
|
+
set :db_port, 3306
|
123
|
+
|
127
124
|
# Imagemagick install
|
128
125
|
set :imagemagick_build_options, {
|
129
126
|
:url => "ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz",
|
@@ -5,8 +5,8 @@ namespace :centos do
|
|
5
5
|
desc <<-DESC
|
6
6
|
Add user and set user password for application. Adds user to specified groups.
|
7
7
|
|
8
|
-
*
|
9
|
-
@set :
|
8
|
+
*user_add*: User to add.\n
|
9
|
+
@set :user_add, "app_user"@
|
10
10
|
*groups*: Groups for user to be in. _Defaults to none_\n
|
11
11
|
@set :groups, "admin,foo"@\n
|
12
12
|
*home*: Home directory for user. _Defaults to <tt>:deploy_to</tt> setting_\n
|
@@ -17,35 +17,28 @@ namespace :centos do
|
|
17
17
|
task :add_user do
|
18
18
|
|
19
19
|
# Settings
|
20
|
-
fetch(:
|
20
|
+
fetch(:user_add)
|
21
21
|
fetch_or_default(:groups, nil)
|
22
22
|
fetch_or_default(:home, deploy_to)
|
23
23
|
fetch_or_default(:home_readable, true)
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
with_user(install_user) do
|
29
|
-
|
30
|
-
adduser_options = []
|
31
|
-
adduser_options << "-d #{home}" unless home.blank?
|
32
|
-
adduser_options << "-G #{groups}" unless groups.blank?
|
33
|
-
|
34
|
-
run "id sick || /usr/sbin/adduser #{adduser_options.join(" ")} #{user}"
|
35
|
-
|
36
|
-
run "chmod a+rx #{home}" if home_readable
|
25
|
+
adduser_options = []
|
26
|
+
adduser_options << "-d #{home}" unless home.blank?
|
27
|
+
adduser_options << "-G #{groups}" unless groups.blank?
|
37
28
|
|
38
|
-
|
29
|
+
run "id #{user_add} || /usr/sbin/adduser #{adduser_options.join(" ")} #{user_add}"
|
30
|
+
|
31
|
+
run "chmod a+rx #{home}" if home_readable
|
39
32
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
33
|
+
new_password = prompt.password("Password to set for #{user_add}: ", true, false)
|
34
|
+
|
35
|
+
run "passwd #{user_add}" do |channel, stream, data|
|
36
|
+
logger.info data
|
37
|
+
|
38
|
+
if data =~ /password:/i
|
39
|
+
channel.send_data "#{new_password}\n"
|
40
|
+
channel.send_data "#{new_password}\n"
|
47
41
|
end
|
48
|
-
|
49
42
|
end
|
50
43
|
|
51
44
|
end
|
@@ -10,23 +10,24 @@ namespace :mongrel_cluster do
|
|
10
10
|
*mongrel_port*: Starting port for mongrels. If there are 3 mongrels with port 9000,
|
11
11
|
then instances will be at 9000, 9001, and 9002\n
|
12
12
|
@set :mongrel_port, 9000@\n
|
13
|
+
*mongrel_config_dir*: Directory for mongrel config. _Defaults to "[shared_path]/config/mongrel"_
|
14
|
+
*mongrel_pid_dir*: Directory for mongrel pids. _Defaults to "[shared_path]/pids"
|
15
|
+
*mongrel_config_script*: Config script to load with mongrel. _Defaults to nil_\n
|
16
|
+
@set :mongrel_config_script, "config/mongrel_handler.rb"@\n
|
13
17
|
DESC
|
14
18
|
task :setup do
|
15
19
|
|
16
20
|
# Settings
|
17
21
|
fetch(:mongrel_size)
|
18
22
|
fetch(:mongrel_port)
|
23
|
+
fetch_or_default(:mongrel_config_dir, "#{shared_path}/config/mongrel")
|
24
|
+
fetch_or_default(:mongrel_pid_dir, "#{shared_path}/pids")
|
25
|
+
fetch_or_default(:mongrel_config_script, nil)
|
19
26
|
|
20
|
-
run "mkdir -p #{
|
21
|
-
|
22
|
-
# Mongrel cluster config needs its own config directory
|
23
|
-
mongrel_config_path = "#{shared_path}/config/mongrel"
|
24
|
-
run "mkdir -p #{mongrel_config_path}"
|
25
|
-
|
26
|
-
pid_path = "#{shared_path}/pids"
|
27
|
+
run "mkdir -p #{mongrel_config_dir}"
|
27
28
|
|
28
29
|
put template.load("mongrel/mongrel_cluster.initd.erb"), "/tmp/mongrel_cluster_#{application}.initd"
|
29
|
-
put template.load("mongrel/mongrel_cluster.yml.erb"), "#{
|
30
|
+
put template.load("mongrel/mongrel_cluster.yml.erb"), "#{mongrel_config_dir}/mongrel_cluster.yml"
|
30
31
|
|
31
32
|
# Setup the mongrel_cluster init script
|
32
33
|
sudo "install -o root /tmp/mongrel_cluster_#{application}.initd /etc/init.d/mongrel_cluster_#{application}"
|
data/lib/recipes/mysql.rb
CHANGED
@@ -27,9 +27,9 @@ namespace :mysql do
|
|
27
27
|
*db_name*: Database name (application).\n
|
28
28
|
*db_user*: Database user (application).\n
|
29
29
|
*db_pass*: Database password (application).\n
|
30
|
-
*
|
30
|
+
*mysql_grant_locations*: Grant locations. _Defaults to localhost_\n
|
31
31
|
@set :grant_locations, [ "localhost", "192.168.1.111" ]@\n
|
32
|
-
*
|
32
|
+
*mysql_grant_priv_type*: Grant privilege types. _Defaults to ALL_\n
|
33
33
|
@set :grant_priv_type, "ALL"@\n
|
34
34
|
*mysql_admin_password*: Mysql admin password (to use to connect). Defaults to password prompt.\n
|
35
35
|
@set :mysql_admin_password, prompt.password('Mysql admin password: '))@
|
@@ -41,12 +41,20 @@ namespace :mysql do
|
|
41
41
|
fetch(:db_user)
|
42
42
|
fetch(:db_pass)
|
43
43
|
fetch_or_default(:mysql_admin_password, prompt.password('Mysql admin password: '))
|
44
|
-
fetch_or_default(:
|
45
|
-
fetch_or_default(:grant_priv_type, "ALL")
|
46
|
-
|
47
|
-
# Add localhost to grant locations
|
48
|
-
set :locations_for_grant, [ "localhost", web_host, db_host ].compact
|
44
|
+
fetch_or_default(:mysql_grant_priv_type, "ALL")
|
49
45
|
|
46
|
+
# Set grant locations to all servers in roles: :search, :db, :app
|
47
|
+
unless exists?(:mysql_grant_locations)
|
48
|
+
mysql_grant_locations = [ "localhost" ]
|
49
|
+
role_names = [ :search, :db, :app ]
|
50
|
+
role_names.each do |role_name|
|
51
|
+
roles[role_name].each do |role|
|
52
|
+
mysql_grant_locations << role.host
|
53
|
+
end unless roles[role_name].blank?
|
54
|
+
end
|
55
|
+
set :mysql_grant_locations, mysql_grant_locations
|
56
|
+
end
|
57
|
+
|
50
58
|
put template.load("mysql/install_db.sql.erb"), "/tmp/install_db_#{application}.sql"
|
51
59
|
run "mysql -u root -p#{mysql_admin_password} < /tmp/install_db_#{application}.sql"
|
52
60
|
end
|
data/lib/recipes/nginx.rb
CHANGED
@@ -4,14 +4,10 @@ namespace :nginx do
|
|
4
4
|
desc <<-DESC
|
5
5
|
Install nginx monit hooks.
|
6
6
|
|
7
|
-
*nginx_pid_path*: Path to nginx pid file. _Defaults to /var/run/nginx.pid_
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
*monit_conf_dir*: Destination for monitrc. _Defaults to "/etc/monit"_
|
12
|
-
|
13
|
-
@set :monit_conf_dir, "/etc/monit"@
|
14
|
-
|
7
|
+
*nginx_pid_path*: Path to nginx pid file. _Defaults to /var/run/nginx.pid_\n
|
8
|
+
@set :nginx_pid_path, "/var/run/nginx.pid"@\n
|
9
|
+
*monit_conf_dir*: Destination for monitrc. _Defaults to "/etc/monit"_\n
|
10
|
+
@set :monit_conf_dir, "/etc/monit"@\n
|
15
11
|
DESC
|
16
12
|
task :install_monit do
|
17
13
|
|
@@ -26,19 +22,13 @@ namespace :nginx do
|
|
26
22
|
desc <<-DESC
|
27
23
|
Create and update the nginx vhost include.
|
28
24
|
|
29
|
-
mongrel_size
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
mongrel_port
|
34
|
-
|
35
|
-
|
36
|
-
set :mongrel_port, 9000
|
37
|
-
|
38
|
-
domain_name: Domain name for nginx virtual host, (without www prefix).
|
39
|
-
|
40
|
-
set :domain_name, "foo.com"
|
41
|
-
|
25
|
+
*mongrel_size*: Number of mongrels.\n
|
26
|
+
@set :mongrel_size, 3@\n
|
27
|
+
*mongrel_port*: Starting port for mongrels.\n
|
28
|
+
If there are 3 mongrels with port 9000, then instances will be at 9000, 9001, and 9002\n
|
29
|
+
@set :mongrel_port, 9000@\n
|
30
|
+
*domain_name*: Domain name for nginx virtual host, (without www prefix).\n
|
31
|
+
@set :domain_name, "foo.com"@
|
42
32
|
DESC
|
43
33
|
task :setup_mongrel do
|
44
34
|
|
data/lib/recipes/rails.rb
CHANGED
@@ -4,18 +4,12 @@ namespace :rails do
|
|
4
4
|
desc <<-DESC
|
5
5
|
Create database yaml in shared path.
|
6
6
|
|
7
|
-
*db_name*: Database name (rails)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
*
|
12
|
-
|
13
|
-
@set :db_user, "app_db_user"@
|
14
|
-
|
15
|
-
*db_pass*: Database password (rails).
|
16
|
-
|
17
|
-
@set :db_pass, "the_password"@
|
18
|
-
|
7
|
+
*db_name*: Database name (rails).\n
|
8
|
+
@set :db_name, "app_db_name"@\n
|
9
|
+
*db_user*: Database user (rails).\n
|
10
|
+
@set :db_user, "app_db_user"@\n
|
11
|
+
*db_pass*: Database password (rails).\n
|
12
|
+
@set :db_pass, "the_password"@\n
|
19
13
|
DESC
|
20
14
|
task :setup do
|
21
15
|
|
data/lib/recipes/sphinx.rb
CHANGED
@@ -30,6 +30,7 @@ namespace :sphinx do
|
|
30
30
|
*sphinx_db_user*: Sphinx DB user. _Defaults to db_user_\n
|
31
31
|
*sphinx_db_pass*: Sphinx DB password. _Defaults to db_pass_\n
|
32
32
|
*sphinx_db_name*: Sphinx DB name. _Defaults to db_name_\n
|
33
|
+
*sphinx_db_port*: Sphinx DB port. _Defaults to db_port_\n
|
33
34
|
|
34
35
|
*sphinx_db_host*: Sphinx DB host. _Defaults to location for primary :db role_\n
|
35
36
|
*sphinx_host*: Sphinx DB host. _Defaults to location for :search role_\n
|
@@ -48,24 +49,12 @@ namespace :sphinx do
|
|
48
49
|
fetch_or_default(:sphinx_db_user, db_user)
|
49
50
|
fetch_or_default(:sphinx_db_pass, db_pass)
|
50
51
|
fetch_or_default(:sphinx_db_name, db_name)
|
52
|
+
fetch_or_default(:sphinx_db_port, db_port)
|
51
53
|
|
52
|
-
unless exists?(:sphinx_db_host)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
else
|
57
|
-
raise "No :db roles, and no :sphinx_db_host setting specified"
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
unless exists?(:sphinx_host)
|
62
|
-
search_servers = roles[:search]
|
63
|
-
unless search_servers.empty?
|
64
|
-
set :sphinx_host, search_servers.first.host
|
65
|
-
else
|
66
|
-
raise "No :search roles, and no :sphinx_host setting specified"
|
67
|
-
end
|
68
|
-
end
|
54
|
+
set :sphinx_db_host, roles[:db].first.host unless roles[:db].empty? || exists?(:sphinx_db_host)
|
55
|
+
set :sphinx_host, roles[:search].first.host unless roles[:search].empty? || exists?(:sphinx_host)
|
56
|
+
raise "No :db roles, and no :sphinx_db_host setting specified" unless exists?(:sphinx_db_host)
|
57
|
+
raise "No :search roles, and no :sphinx_host setting specified" unless exists?(:sphinx_host)
|
69
58
|
|
70
59
|
put template.load(sphinx_conf_template), sphinx_conf_path
|
71
60
|
end
|
@@ -4,8 +4,8 @@ log_file: log/mongrel.log
|
|
4
4
|
port: "<%= mongrel_port %>"
|
5
5
|
environment: production
|
6
6
|
address: 127.0.0.1
|
7
|
-
pid_file: <%=
|
7
|
+
pid_file: <%= mongrel_pid_dir %>/mongrel.pid
|
8
8
|
servers: <%= mongrel_size %>
|
9
9
|
user: <%= user %>
|
10
10
|
group: <%= user %>
|
11
|
-
config_script: <%= mongrel_config_script %>
|
11
|
+
config_script: <%= mongrel_config_script unless mongrel_config_script.blank? %>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<%
|
2
|
-
GRANT <%=
|
1
|
+
<% mysql_grant_locations.each do |location| %>
|
2
|
+
GRANT <%= mysql_grant_priv_type %> ON <%= db_name %>.* TO '<%= db_user %>'@'<%= location %>' IDENTIFIED BY '<%= db_pass %>';
|
3
3
|
<% end %>
|
4
4
|
|
5
5
|
CREATE DATABASE IF NOT EXISTS <%= db_name %>;
|
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.2</a>
|
42
42
|
</div>
|
43
43
|
|
44
44
|
<div id="recipes">
|
@@ -80,8 +80,8 @@
|
|
80
80
|
|
81
81
|
|
82
82
|
<ul>
|
83
|
-
<li>Plugins to help install applications, via yum or manually unpacking, and building. Also to help upload files sanely, prompt for input, install gems,
|
84
|
-
<li>Templates for init scripts
|
83
|
+
<li>Plugins to help install applications, via yum or manually unpacking, and building. Also to help upload files sanely, prompt for input, install gems, run shell scripts, etc.</li>
|
84
|
+
<li>Templates for init scripts, application configuration, etc.</li>
|
85
85
|
<li>Common deployment setup and update_code tasks, such as symlinking in database.yml and more advanced recipes such as sphinx configuration.</li>
|
86
86
|
</ul>
|
87
87
|
|
@@ -104,7 +104,7 @@
|
|
104
104
|
<pre><code>cap HOSTS=x.x.x.x install</code></pre>
|
105
105
|
|
106
106
|
|
107
|
-
<h3>Use
|
107
|
+
<h3>Use recipes</h3>
|
108
108
|
|
109
109
|
|
110
110
|
<p><a href="recipes/index.html">View recipes documentation</a></p>
|
@@ -137,7 +137,7 @@
|
|
137
137
|
<p>Comments are welcome. Send an email to <a href="mailto:gabrielh@gmail.com">Gabriel Handford</a> via the <a href="http://groups.google.com/group/capitate">forum</a></p>
|
138
138
|
</div>
|
139
139
|
<p class="coda">
|
140
|
-
<a href="mailto:gabrielh@gmail.com">Gabriel Handford</a>,
|
140
|
+
<a href="mailto:gabrielh@gmail.com">Gabriel Handford</a>, 25th February 2008<br>
|
141
141
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
142
142
|
</p>
|
143
143
|
</div>
|
data/website/index.txt
CHANGED
@@ -23,8 +23,8 @@ h2. The basics
|
|
23
23
|
|
24
24
|
Capitate has:
|
25
25
|
|
26
|
-
* Plugins to help install applications, via yum or manually unpacking, and building. Also to help upload files sanely, prompt for input, install gems,
|
27
|
-
* Templates for init scripts
|
26
|
+
* Plugins to help install applications, via yum or manually unpacking, and building. Also to help upload files sanely, prompt for input, install gems, run shell scripts, etc.
|
27
|
+
* Templates for init scripts, application configuration, etc.
|
28
28
|
* Common deployment setup and update_code tasks, such as symlinking in database.yml and more advanced recipes such as sphinx configuration.
|
29
29
|
|
30
30
|
|
@@ -41,7 +41,7 @@ and then:
|
|
41
41
|
cap HOSTS=x.x.x.x install
|
42
42
|
|
43
43
|
|
44
|
-
h3. Use
|
44
|
+
h3. Use recipes
|
45
45
|
|
46
46
|
"View recipes documentation":recipes/index.html
|
47
47
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capitate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
platform:
|
4
|
+
version: 0.2.2
|
5
|
+
platform: ""
|
6
6
|
authors:
|
7
7
|
- Gabriel Handford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-02-
|
12
|
+
date: 2008-02-25 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
requirements: []
|
188
188
|
|
189
189
|
rubyforge_project: capitate
|
190
|
-
rubygems_version:
|
190
|
+
rubygems_version: 0.9.5
|
191
191
|
signing_key:
|
192
192
|
specification_version: 2
|
193
193
|
summary: Capistrano recipes, plugins and templates.
|