isaac-deprec 1.99.30 → 1.99.32
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 +24 -2
- data/THANKS +12 -0
- data/bin/depify +12 -6
- data/lib/deprec/capistrano_extensions.rb +7 -0
- data/lib/deprec/recipes.rb +7 -2
- data/lib/deprec/recipes/apache.rb +19 -96
- data/lib/deprec/recipes/deprec.rb +32 -29
- data/lib/deprec/recipes/git.rb +3 -3
- data/lib/deprec/recipes/mongrel.rb +6 -35
- data/lib/deprec/recipes/mysql.rb +30 -1
- data/lib/deprec/recipes/network.rb +1 -1
- data/lib/deprec/recipes/nginx.rb +55 -12
- data/lib/deprec/recipes/passenger.rb +147 -27
- data/lib/deprec/recipes/rails.rb +98 -77
- data/lib/deprec/recipes/ree.rb +11 -10
- data/lib/deprec/recipes/ruby.rb +5 -14
- data/lib/deprec/recipes/utils.rb +21 -2
- data/lib/deprec/recipes/wordpress.rb +2 -5
- data/lib/deprec/recipes/xen.rb +38 -40
- data/lib/deprec/templates/apache/index.html.erb +0 -7
- data/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb +3 -3
- data/lib/deprec/templates/passenger/apache_vhost.erb +21 -10
- data/lib/deprec/templates/ssh/ssh_config.erb +1 -1
- data/lib/deprec/templates/xen/xend-config.sxp.erb +1 -1
- metadata +2 -2
- data/lib/deprec/templates/passenger/passenger.erb +0 -20
- data/lib/deprec/templates/xen/15-disable-hwclock +0 -40
- data/lib/deprec/templates/xen/40-setup-networking +0 -145
- data/lib/deprec/templates/xen/xen-tools.conf.erb +0 -220
- data/lib/deprec/templates/xen/xm.tmpl.erb +0 -85
data/README
CHANGED
@@ -2,6 +2,30 @@
|
|
2
2
|
deprec - Deployment Recipes for Capistrano
|
3
3
|
------------------------------------------
|
4
4
|
|
5
|
+
== Update 28 Jan 2009
|
6
|
+
|
7
|
+
Get your app running on a fresh Ubuntu (7.10, 8.04.1) server these commands:
|
8
|
+
|
9
|
+
cd your_rails_app
|
10
|
+
depify .
|
11
|
+
# Edit config/deploy.rb
|
12
|
+
cap deprec:rails:install_stack
|
13
|
+
cap deploy:setup
|
14
|
+
cap deploy
|
15
|
+
cap deploy:migrate
|
16
|
+
|
17
|
+
Recorded times for complete install on Ubuntu hardy server (7.10 amd64)
|
18
|
+
|
19
|
+
* Passenger+REE+Apache : 14m29s
|
20
|
+
* Passenger+ruby-1.8.7+Apache : 17m51s
|
21
|
+
* nginx+mongrel : 16m25s
|
22
|
+
|
23
|
+
Note you can choose combinations of:
|
24
|
+
|
25
|
+
* Ruby Enterprise Edition or ruby-1.8.7
|
26
|
+
* Passenger or mongrel (passenger requires apache option)
|
27
|
+
* Apache or nginx
|
28
|
+
|
5
29
|
== Introduction
|
6
30
|
|
7
31
|
The deprec [1] gem is a set of tasks for Capistrano [2]. These tasks provide
|
@@ -134,5 +158,3 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
134
158
|
[3] http://www.ruby-lang.org/en/
|
135
159
|
[4] http://rubyforge.org/
|
136
160
|
[5] http://rubygems.org/
|
137
|
-
|
138
|
-
test
|
data/THANKS
CHANGED
@@ -3,3 +3,15 @@ Big thanks go to the following people. Apologies to any I have missed! - Mike
|
|
3
3
|
20080226 Chris Turner for an excellent HOWTO http://crackthenut.cracklabs.com/deprec2-your-slice-from-windows/
|
4
4
|
20080206 Eric Harris-Braun for some great testing, bug reports and suggestions.
|
5
5
|
20071004 Gus Gollings for helping restore www.deprec.org
|
6
|
+
|
7
|
+
Seen on github http://github.com/mbailey/deprec/network
|
8
|
+
|
9
|
+
isaac
|
10
|
+
jasherai Pritesh (London)
|
11
|
+
zippy Eric Harris-Braun (NY) <eric@harris-braun.com> http://eric.harris-braun.com
|
12
|
+
kovacs Michael Kovacs (SF) <michael@mkovacs.com> http://javathehutt.blogspot.com
|
13
|
+
robc Rob Caporetto (Melbourne) rcaporetto@gmail.com http://www.rob-caporetto.com
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
data/bin/depify
CHANGED
@@ -74,7 +74,17 @@ files = {
|
|
74
74
|
|
75
75
|
set :application, "set your application name here"
|
76
76
|
set :domain, "set domain name project will be served on here"
|
77
|
-
set :repository, "
|
77
|
+
set :repository, "git://github.com/\#{user}/\#{application}.git"
|
78
|
+
|
79
|
+
# If you aren't using Subversion to manage your source code, specify
|
80
|
+
# your SCM below:
|
81
|
+
set :scm, :git
|
82
|
+
|
83
|
+
set :passenger_use_ree, true
|
84
|
+
set :web_server_type, :apache
|
85
|
+
set :app_server_type, :passenger
|
86
|
+
set :db_server_type, :mysql
|
87
|
+
|
78
88
|
# set :gems_for_project, %w(dr_nic_magic_models swiftiply) # list of gems to be installed
|
79
89
|
|
80
90
|
# Update these if you're not running everything on one host.
|
@@ -87,14 +97,10 @@ files = {
|
|
87
97
|
# servers (which is the deprec default), you can specify the actual location
|
88
98
|
# via the :deploy_to variable:
|
89
99
|
# set :deploy_to, "/var/www/\#{application}"
|
90
|
-
|
91
|
-
# If you aren't using Subversion to manage your source code, specify
|
92
|
-
# your SCM below:
|
93
|
-
# set :scm, :subversion
|
94
100
|
|
95
101
|
namespace :deploy do
|
96
102
|
task :restart, :roles => :app, :except => { :no_release => true } do
|
97
|
-
top.deprec.
|
103
|
+
top.deprec.app.restart
|
98
104
|
end
|
99
105
|
end
|
100
106
|
|
@@ -333,6 +333,13 @@ module Deprec2
|
|
333
333
|
'
|
334
334
|
SUDO
|
335
335
|
end
|
336
|
+
|
337
|
+
def read_database_yml
|
338
|
+
db_config = YAML.load_file('config/database.yml')
|
339
|
+
set :db_user, db_config[rails_env]["username"]
|
340
|
+
set :db_password, db_config[rails_env]["password"]
|
341
|
+
set :db_name, db_config[rails_env]["database"]
|
342
|
+
end
|
336
343
|
|
337
344
|
|
338
345
|
##
|
data/lib/deprec/recipes.rb
CHANGED
@@ -4,7 +4,7 @@ unless Capistrano::Configuration.respond_to?(:instance)
|
|
4
4
|
end
|
5
5
|
require "#{File.dirname(__FILE__)}/recipes/deprec"
|
6
6
|
require "#{File.dirname(__FILE__)}/recipes/deprecated"
|
7
|
-
|
7
|
+
require "#{File.dirname(__FILE__)}/recipes/canonical"
|
8
8
|
require "#{File.dirname(__FILE__)}/recipes/users"
|
9
9
|
require "#{File.dirname(__FILE__)}/recipes/ssh"
|
10
10
|
require "#{File.dirname(__FILE__)}/recipes/nginx"
|
@@ -16,6 +16,8 @@ require "#{File.dirname(__FILE__)}/recipes/ruby"
|
|
16
16
|
require "#{File.dirname(__FILE__)}/recipes/rails"
|
17
17
|
require "#{File.dirname(__FILE__)}/recipes/mongrel"
|
18
18
|
require "#{File.dirname(__FILE__)}/recipes/mysql"
|
19
|
+
require "#{File.dirname(__FILE__)}/recipes/postgresql"
|
20
|
+
require "#{File.dirname(__FILE__)}/recipes/sqlite"
|
19
21
|
require "#{File.dirname(__FILE__)}/recipes/postfix"
|
20
22
|
require "#{File.dirname(__FILE__)}/recipes/memcache"
|
21
23
|
require "#{File.dirname(__FILE__)}/recipes/monit"
|
@@ -25,6 +27,7 @@ require "#{File.dirname(__FILE__)}/recipes/ntp"
|
|
25
27
|
require "#{File.dirname(__FILE__)}/recipes/nagios"
|
26
28
|
require "#{File.dirname(__FILE__)}/recipes/heartbeat"
|
27
29
|
require "#{File.dirname(__FILE__)}/recipes/xen"
|
30
|
+
require "#{File.dirname(__FILE__)}/recipes/xentools"
|
28
31
|
require "#{File.dirname(__FILE__)}/recipes/ubuntu"
|
29
32
|
require "#{File.dirname(__FILE__)}/recipes/lvm"
|
30
33
|
require "#{File.dirname(__FILE__)}/recipes/vnstat"
|
@@ -35,6 +38,8 @@ require "#{File.dirname(__FILE__)}/recipes/git"
|
|
35
38
|
require "#{File.dirname(__FILE__)}/recipes/apt_mirror"
|
36
39
|
# require "#{File.dirname(__FILE__)}/recipes/pdns"
|
37
40
|
require "#{File.dirname(__FILE__)}/recipes/gitosis"
|
38
|
-
require "#{File.dirname(__FILE__)}/recipes/wordpress"
|
41
|
+
# require "#{File.dirname(__FILE__)}/recipes/wordpress" Not working
|
39
42
|
require "#{File.dirname(__FILE__)}/recipes/ar_sendmail"
|
40
43
|
require "#{File.dirname(__FILE__)}/recipes/passenger"
|
44
|
+
require "#{File.dirname(__FILE__)}/recipes/ddclient"
|
45
|
+
require "#{File.dirname(__FILE__)}/recipes/starling"
|
@@ -3,84 +3,15 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
3
3
|
namespace :deprec do
|
4
4
|
namespace :apache do
|
5
5
|
|
6
|
-
# put apache config for site in shared/config/apache2 dir
|
7
|
-
# link it into apps to enable, unlink to disable?
|
8
|
-
# http://times.usefulinc.com/2006/09/15-rails-debian-apache
|
9
|
-
|
10
|
-
# XXX Check this over after a nice sleep
|
11
|
-
#
|
12
|
-
# def set_apache_conf
|
13
|
-
# if apache_default_vhost
|
14
|
-
# set :apache_conf, "/usr/local/apache2/conf/default.conf" unless apache_default_vhost_conf
|
15
|
-
# else
|
16
|
-
# set :apache_conf, "/usr/local/apache2/conf/apps/#{application}.conf" unless apache_conf
|
17
|
-
# end
|
18
|
-
# end
|
19
|
-
|
20
|
-
set(:apache_server_name) { domain }
|
21
|
-
set :apache_user, 'daemon' # XXX this is not yet being inserted into httpd.conf!
|
22
|
-
# I've added it for deprec:nagios:install
|
23
|
-
set :apache_conf, nil
|
24
|
-
set :apache_default_vhost, false
|
25
|
-
set :apache_default_vhost_conf, nil
|
26
|
-
set :apache_ctl, "/usr/local/apache2/bin/apachectl"
|
27
|
-
set(:apache_server_aliases) { web_server_aliases }
|
28
|
-
set :apache_proxy_port, 8000
|
29
|
-
set :apache_proxy_servers, 2
|
30
|
-
set :apache_proxy_address, "127.0.0.1"
|
31
|
-
set :apache_ssl_enabled, false
|
32
|
-
set :apache_ssl_ip, nil
|
33
|
-
set :apache_ssl_forward_all, false
|
34
|
-
set :apache_ssl_chainfile, false
|
35
|
-
set :apache_docroot, '/usr/local/apache2/htdocs'
|
36
|
-
set :apache_vhost_dir, '/usr/local/apache2/conf/apps'
|
37
|
-
set :apache_config_file, '/usr/local/apache2/conf/httpd.conf'
|
38
|
-
|
39
|
-
SRC_PACKAGES[:apache] = {
|
40
|
-
:md5sum => "80d3754fc278338033296f0d41ef2c04 httpd-2.2.9.tar.gz",
|
41
|
-
:url => "http://www.apache.org/dist/httpd/httpd-2.2.9.tar.gz",
|
42
|
-
:configure => %w(
|
43
|
-
./configure
|
44
|
-
--enable-mods-shared=all
|
45
|
-
--enable-proxy
|
46
|
-
--enable-proxy-balancer
|
47
|
-
--enable-proxy-http
|
48
|
-
--enable-rewrite
|
49
|
-
--enable-cache
|
50
|
-
--enable-headers
|
51
|
-
--enable-ssl
|
52
|
-
--enable-deflate
|
53
|
-
--with-included-apr #_so_this_recipe_doesn't_break_when_rerun
|
54
|
-
--enable-dav #_for_subversion_
|
55
|
-
--enable-so #_for_subversion_
|
56
|
-
;
|
57
|
-
).reject{|arg| arg.match '#'}.join(' '),
|
58
|
-
:make => 'make;',
|
59
|
-
:post_install => 'install -b support/apachectl /etc/init.d/httpd;'
|
60
|
-
}
|
61
|
-
|
62
6
|
desc "Install apache"
|
63
7
|
task :install do
|
64
8
|
install_deps
|
65
|
-
|
66
|
-
deprec2.install_from_src(SRC_PACKAGES[:apache], src_dir)
|
67
|
-
setup_vhost_dir
|
68
|
-
# install_index_page
|
69
|
-
activate
|
70
|
-
SYSTEM_CONFIG_FILES[:apache].each do |file|
|
71
|
-
deprec2.render_template(:apache, file.merge(:remote => true))
|
72
|
-
end
|
9
|
+
enable_mod_rewrite
|
73
10
|
end
|
74
11
|
|
75
12
|
# install dependencies for apache
|
76
13
|
task :install_deps do
|
77
|
-
apt.install( {:base => %w(
|
78
|
-
end
|
79
|
-
|
80
|
-
# Create dir for vhost config files
|
81
|
-
task :setup_vhost_dir do
|
82
|
-
deprec2.mkdir(apache_vhost_dir, :owner => 'root', :group => group, :mode => 0775, :via => :sudo)
|
83
|
-
deprec2.append_to_file_if_missing(apache_config_file, 'Include conf/apps/')
|
14
|
+
apt.install( {:base => %w(apache2-mpm-prefork apache2-prefork-dev rsync)}, :stable )
|
84
15
|
end
|
85
16
|
|
86
17
|
SYSTEM_CONFIG_FILES[:apache] = [
|
@@ -89,17 +20,12 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
89
20
|
]
|
90
21
|
|
91
22
|
PROJECT_CONFIG_FILES[:apache] = [
|
92
|
-
|
93
|
-
{:template => "httpd-vhost-app.conf.erb",
|
94
|
-
:path => 'conf/httpd-vhost-app.conf',
|
95
|
-
:mode => 0755,
|
96
|
-
:owner => 'root:root'}
|
23
|
+
# Not required
|
97
24
|
]
|
98
25
|
|
99
26
|
desc "Generate configuration file(s) for apache from template(s)"
|
100
27
|
task :config_gen do
|
101
28
|
config_gen_system
|
102
|
-
config_gen_project
|
103
29
|
end
|
104
30
|
|
105
31
|
task :config_gen_system do
|
@@ -116,47 +42,45 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
116
42
|
|
117
43
|
desc "Push apache config files to server"
|
118
44
|
task :config, :roles => :web do
|
119
|
-
config_system
|
120
|
-
config_project
|
121
|
-
end
|
122
|
-
|
123
|
-
task :config_system, :roles => :web do
|
124
45
|
deprec2.push_configs(:apache, SYSTEM_CONFIG_FILES[:apache])
|
125
46
|
end
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
47
|
+
|
48
|
+
# Stub so generic tasks don't fail (e.g. deprec:web:config_project)
|
49
|
+
task :config_project do
|
50
|
+
end
|
51
|
+
|
52
|
+
task :enable_mod_rewrite, :roles => :web do
|
53
|
+
sudo "a2enmod rewrite"
|
130
54
|
end
|
131
55
|
|
132
56
|
desc "Start Apache"
|
133
57
|
task :start, :roles => :web do
|
134
|
-
send(run_method, "
|
58
|
+
send(run_method, "/etc/init.d/apache2 start")
|
135
59
|
end
|
136
60
|
|
137
61
|
desc "Stop Apache"
|
138
62
|
task :stop, :roles => :web do
|
139
|
-
send(run_method, "
|
63
|
+
send(run_method, "/etc/init.d/apache2 stop")
|
140
64
|
end
|
141
65
|
|
142
66
|
desc "Restart Apache"
|
143
67
|
task :restart, :roles => :web do
|
144
|
-
send(run_method, "
|
68
|
+
send(run_method, "/etc/init.d/apache2 restart")
|
145
69
|
end
|
146
70
|
|
147
71
|
desc "Reload Apache"
|
148
72
|
task :reload, :roles => :web do
|
149
|
-
send(run_method, "
|
73
|
+
send(run_method, "/etc/init.d/apache2 force-reload")
|
150
74
|
end
|
151
75
|
|
152
76
|
desc "Set apache to start on boot"
|
153
|
-
task :activate do
|
154
|
-
send(run_method, "update-rc.d
|
77
|
+
task :activate, :roles => :web do
|
78
|
+
send(run_method, "update-rc.d apache2 defaults")
|
155
79
|
end
|
156
80
|
|
157
81
|
desc "Set apache to not start on boot"
|
158
82
|
task :deactivate, :roles => :web do
|
159
|
-
send(run_method, "update-rc.d -f
|
83
|
+
send(run_method, "update-rc.d -f apache2 remove")
|
160
84
|
end
|
161
85
|
|
162
86
|
task :backup, :roles => :web do
|
@@ -169,9 +93,8 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
169
93
|
|
170
94
|
# Generate an index.html page
|
171
95
|
task :install_index_page do
|
172
|
-
deprec2.
|
173
|
-
std.su_put deprec2.render_template(:apache, :template => '
|
174
|
-
std.su_put deprec2.render_template(:apache, :template => 'master.css'), File.join(apache_docroot, 'master.css')
|
96
|
+
std.su_put deprec2.render_template(:apache, :template => 'index.html.erb'), File.join('/var/www/index.html')
|
97
|
+
std.su_put deprec2.render_template(:apache, :template => 'master.css'), File.join('/var/www/master.css')
|
175
98
|
end
|
176
99
|
|
177
100
|
end
|
@@ -27,35 +27,38 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
27
27
|
|
28
28
|
# Server options
|
29
29
|
CHOICES_WEBSERVER = [:nginx, :apache, :none]
|
30
|
-
CHOICES_APPSERVER = [:mongrel, :webrick, :none]
|
31
|
-
CHOICES_DATABASE = [:mysql, :
|
30
|
+
CHOICES_APPSERVER = [:mongrel, :webrick, :passenger, :none]
|
31
|
+
CHOICES_DATABASE = [:mysql, :postgresql, :sqlite, :none]
|
32
32
|
|
33
|
-
|
34
|
-
#
|
35
|
-
|
33
|
+
# Service defaults
|
34
|
+
#
|
35
|
+
# The defaults below are legacy values to support older deployments.
|
36
|
+
# Newly generated deploy.rb files have use apache, passenger and ree
|
37
|
+
default :passenger_use_ree, false
|
38
|
+
default :web_server_type, :nginx
|
36
39
|
default :app_server_type, :mongrel
|
37
40
|
default :db_server_type, :mysql
|
38
|
-
|
39
|
-
default(:web_server_type) do
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
default(:app_server_type) do
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
default(:db_server_type) do
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
41
|
+
#
|
42
|
+
# default(:web_server_type) do
|
43
|
+
# Capistrano::CLI.ui.choose do |menu|
|
44
|
+
# CHOICES_WEBSERVER.each {|c| menu.choice(c)}
|
45
|
+
# menu.header = "select webserver type"
|
46
|
+
# end
|
47
|
+
# end
|
48
|
+
#
|
49
|
+
# default(:app_server_type) do
|
50
|
+
# Capistrano::CLI.ui.choose do |menu|
|
51
|
+
# CHOICES_APPSERVER.each {|c| menu.choice(c)}
|
52
|
+
# menu.header = "select application server type"
|
53
|
+
# end
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# default(:db_server_type) do
|
57
|
+
# Capistrano::CLI.ui.choose do |menu|
|
58
|
+
# CHOICES_DATABASE.each {|c| menu.choice(c)}
|
59
|
+
# menu.header = "select database server type"
|
60
|
+
# end
|
61
|
+
# end
|
59
62
|
|
60
63
|
default(:application) do
|
61
64
|
Capistrano::CLI.ui.ask "enter name of project(no spaces)" do |q|
|
@@ -99,16 +102,16 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
99
102
|
default(:web_server_aliases) { domain.match(/^www/) ? [] : ["www.#{domain}"] }
|
100
103
|
|
101
104
|
# XXX for some reason this is causing "before deprec:rails:install" to be executed twice
|
102
|
-
|
105
|
+
on :load, 'deprec:connect_canonical_tasks'
|
103
106
|
|
104
107
|
namespace :deprec do
|
105
108
|
|
106
|
-
task :connect_canonical_tasks
|
109
|
+
task :connect_canonical_tasks do
|
107
110
|
# link application specific recipes into canonical task names
|
108
111
|
# e.g. deprec:web:restart => deprec:nginx:restart
|
109
112
|
metaclass = class << self; self; end
|
110
113
|
[:web, :app, :db].each do |server|
|
111
|
-
server_type = send("#{server}_server_type")
|
114
|
+
server_type = send("#{server}_server_type").to_sym
|
112
115
|
if server_type != :none
|
113
116
|
metaclass.send(:define_method, server) { namespaces[server] }
|
114
117
|
self.namespaces[server] = deprec.send(server_type)
|
data/lib/deprec/recipes/git.rb
CHANGED
@@ -10,8 +10,8 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
10
10
|
set :git_root, '/var/git'
|
11
11
|
|
12
12
|
SRC_PACKAGES[:git] = {
|
13
|
-
:url => "http://kernel.org/pub/software/scm/git/git-1.6.
|
14
|
-
:md5sum => "
|
13
|
+
:url => "http://kernel.org/pub/software/scm/git/git-1.6.1.tar.gz",
|
14
|
+
:md5sum => "1f915929d4f54a2e0449a4a08f093118 git-1.6.1.tar.gz"
|
15
15
|
}
|
16
16
|
|
17
17
|
desc "Install git"
|
@@ -25,7 +25,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
25
25
|
|
26
26
|
# install dependencies for nginx
|
27
27
|
task :install_deps do
|
28
|
-
apt.install( {:base => %w(zlib1g-dev gettext)}, :stable )
|
28
|
+
apt.install( {:base => %w(zlib1g-dev gettext libcurl4-gnutls-dev)}, :stable )
|
29
29
|
end
|
30
30
|
|
31
31
|
# "Start git server in local directory"
|
@@ -11,14 +11,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
11
11
|
set(:mongrel_log_dir) { "#{deploy_to}/shared/log" }
|
12
12
|
set(:mongrel_pid_dir) { "#{deploy_to}/shared/pids" }
|
13
13
|
set :mongrel_conf_dir, '/etc/mongrel_cluster'
|
14
|
-
set(:mongrel_conf) { "/etc/mongrel_cluster/#{application}.yml" }
|
15
|
-
set :mongrel_user_prefix, 'mongrel_'
|
16
|
-
set(:mongrel_user) { mongrel_user_prefix + application }
|
17
|
-
set :mongrel_group_prefix, 'app_'
|
18
|
-
set(:mongrel_group) { mongrel_group_prefix + application }
|
19
|
-
|
20
|
-
|
21
|
-
# Install
|
14
|
+
set(:mongrel_conf) { "/etc/mongrel_cluster/#{application}.yml" }
|
22
15
|
|
23
16
|
desc "Install mongrel"
|
24
17
|
task :install, :roles => :app do
|
@@ -99,7 +92,6 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
99
92
|
end
|
100
93
|
|
101
94
|
task :config_project, :roles => :app do
|
102
|
-
create_mongrel_user_and_group
|
103
95
|
deprec2.push_configs(:mongrel, PROJECT_CONFIG_FILES[:mongrel])
|
104
96
|
symlink_mongrel_cluster
|
105
97
|
symlink_monit_config
|
@@ -137,6 +129,11 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
137
129
|
send(run_method, "mongrel_rails cluster::stop -C #{mongrel_conf}")
|
138
130
|
end
|
139
131
|
|
132
|
+
desc "Stop all mongrel clusters."
|
133
|
+
task :stop_all, :roles => :app do
|
134
|
+
run "#{sudo} /etc/init.d/mongrel_cluster stop"
|
135
|
+
end
|
136
|
+
|
140
137
|
desc "Restart application server."
|
141
138
|
task :restart, :roles => :app do
|
142
139
|
send(run_method, "mongrel_rails cluster::restart --clean -C #{mongrel_conf}")
|
@@ -188,32 +185,6 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
188
185
|
task :restore, :roles => :app do
|
189
186
|
end
|
190
187
|
|
191
|
-
desc "create user and group for mongel to run as"
|
192
|
-
task :create_mongrel_user_and_group, :roles => :app do
|
193
|
-
deprec2.groupadd(mongrel_group)
|
194
|
-
deprec2.useradd(mongrel_user, :group => mongrel_group, :homedir => false)
|
195
|
-
# Set the primary group for the mongrel user (in case user already existed
|
196
|
-
# when previous command was run)
|
197
|
-
sudo "usermod --gid #{mongrel_group} #{mongrel_user}"
|
198
|
-
end
|
199
|
-
|
200
|
-
desc "set group ownership and permissions on dirs mongrel needs to write to"
|
201
|
-
task :set_perms_for_mongrel_dirs, :roles => :app do
|
202
|
-
tmp_dir = "#{deploy_to}/current/tmp"
|
203
|
-
shared_dir = "#{deploy_to}/shared"
|
204
|
-
files = ["#{mongrel_log_dir}/mongrel.log", "#{mongrel_log_dir}/#{rails_env}.log"]
|
205
|
-
|
206
|
-
sudo "chgrp -R #{mongrel_group} #{tmp_dir} #{shared_dir}"
|
207
|
-
sudo "chmod -R g+w #{tmp_dir} #{shared_dir}"
|
208
|
-
# set owner and group of log files
|
209
|
-
files.each { |file|
|
210
|
-
sudo "touch #{file}"
|
211
|
-
sudo "chown #{mongrel_user} #{file}"
|
212
|
-
sudo "chgrp #{mongrel_group} #{file}"
|
213
|
-
sudo "chmod g+w #{file}"
|
214
|
-
}
|
215
|
-
end
|
216
|
-
|
217
188
|
end
|
218
189
|
end
|
219
190
|
end
|