deprec 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -53,8 +53,11 @@ module Deprec
|
|
53
53
|
|
54
54
|
|
55
55
|
# create new user account on target system
|
56
|
-
def useradd(user)
|
57
|
-
|
56
|
+
def useradd(user, options={})
|
57
|
+
switches = ''
|
58
|
+
switches += ' --create-home ' unless options[:homedir] == false
|
59
|
+
switches += " --gid #{options[:group]} " unless options[:group].nil?
|
60
|
+
send(run_method, "grep '^#{user}:' /etc/passwd || sudo /usr/sbin/useradd #{switches} #{user}")
|
58
61
|
end
|
59
62
|
|
60
63
|
# create a new group on target system
|
@@ -39,8 +39,8 @@ set :rails_env, "production"
|
|
39
39
|
set :apache_server_name, domain
|
40
40
|
# set :apache_server_aliases, %w{alias1 alias2}
|
41
41
|
# set :apache_default_vhost, true # force use of apache_default_vhost_config
|
42
|
-
# set :apache_default_vhost_conf, "/
|
43
|
-
# set :apache_conf, "/
|
42
|
+
# set :apache_default_vhost_conf, "/usr/local/apache2/conf/default.conf"
|
43
|
+
# set :apache_conf, "/usr/local/apache2/conf/apps/#{application}.conf"
|
44
44
|
# set :apache_ctl, "/etc/init.d/httpd"
|
45
45
|
# set :apache_proxy_port, 8000
|
46
46
|
# set :apache_proxy_servers, 2
|
@@ -59,8 +59,8 @@ set :apache_server_name, domain
|
|
59
59
|
set :mongrel_address, apache_proxy_address
|
60
60
|
# set :mongrel_environment, "production"
|
61
61
|
# set :mongrel_config, "/etc/mongrel_cluster/#{application}.conf"
|
62
|
-
|
63
|
-
|
62
|
+
set :mongrel_user, "mongrel_#{application}"
|
63
|
+
set :mongrel_group, "app_#{application}"
|
64
64
|
|
65
65
|
# =============================================================================
|
66
66
|
# MYSQL OPTIONS
|
data/lib/deprec/recipes.rb
CHANGED
@@ -29,10 +29,20 @@ Capistrano.configuration(:must_exist).load do
|
|
29
29
|
install_apache
|
30
30
|
end
|
31
31
|
|
32
|
-
desc
|
32
|
+
desc <<-DESC
|
33
|
+
deprecated: this function has been replaced by :before_setup and :after_setup
|
34
|
+
DESC
|
33
35
|
task :deprec_setup, :except => { :no_release => true } do
|
34
|
-
setup_paths
|
35
36
|
setup
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "creates paths required by Capistrano's :setup task"
|
40
|
+
task :before_setup, :except => { :no_release => true } do
|
41
|
+
setup_paths
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "sets up and configures servers "
|
45
|
+
task :after_setup, :except => { :no_release => true } do
|
36
46
|
setup_servers
|
37
47
|
end
|
38
48
|
|
@@ -42,7 +52,23 @@ Capistrano.configuration(:must_exist).load do
|
|
42
52
|
setup_paths
|
43
53
|
setup_app
|
44
54
|
setup_symlinks
|
45
|
-
setup_db
|
55
|
+
setup_db # XXX fails is database already exists
|
56
|
+
end
|
57
|
+
|
58
|
+
task :after_update, :roles => :app do
|
59
|
+
set_perms_for_mongrel_dirs
|
60
|
+
end
|
61
|
+
|
62
|
+
desc "set group ownership and permissions on dirs mongrel needs to write to"
|
63
|
+
task :set_perms_for_mongrel_dirs, :roles => :app do
|
64
|
+
tmp_dir = "#{deploy_to}/current/tmp"
|
65
|
+
shared_dir = "#{deploy_to}/shared"
|
66
|
+
files = ["#{deploy_to}/shared/log/mongrel.log", "#{deploy_to}/shared/log/#{rails_env}.log"]
|
67
|
+
|
68
|
+
sudo "chgrp -R #{mongrel_group} #{tmp_dir} #{shared_dir}"
|
69
|
+
sudo "chmod 0775 #{tmp_dir} #{shared_dir}"
|
70
|
+
sudo "chown #{mongrel_user} #{files.join(' ')}"
|
71
|
+
sudo "chgrp #{mongrel_group} #{files.join(' ')}"
|
46
72
|
end
|
47
73
|
|
48
74
|
desc "Setup web server."
|
@@ -52,11 +78,21 @@ Capistrano.configuration(:must_exist).load do
|
|
52
78
|
configure_apache
|
53
79
|
end
|
54
80
|
|
81
|
+
desc "create user and group for mongel to run as"
|
82
|
+
task :create_mongrel_user_and_group do
|
83
|
+
set :mongrel_user, 'mongrel_' + application if mongrel_user.nil?
|
84
|
+
set :mongrel_group, 'app_' + application if mongrel_group.nil?
|
85
|
+
deprec.groupadd(mongrel_group)
|
86
|
+
deprec.useradd(mongrel_user, :group => mongrel_group, :homedir => false)
|
87
|
+
sudo "usermod --gid #{mongrel_group} #{mongrel_user}"
|
88
|
+
end
|
89
|
+
|
55
90
|
desc "Setup application server."
|
56
91
|
task :setup_app, :roles => :app do
|
57
92
|
set :mongrel_environment, rails_env
|
58
93
|
set :mongrel_port, apache_proxy_port
|
59
94
|
set :mongrel_servers, apache_proxy_servers
|
95
|
+
create_mongrel_user_and_group
|
60
96
|
install_mongrel_start_script
|
61
97
|
setup_mongrel_cluster_path
|
62
98
|
configure_mongrel_cluster
|
@@ -117,6 +153,7 @@ Capistrano.configuration(:must_exist).load do
|
|
117
153
|
end
|
118
154
|
|
119
155
|
task :install_rubygems do
|
156
|
+
# XXX should check for presence of ruby first!
|
120
157
|
version = 'rubygems-0.9.2'
|
121
158
|
set :src_package, {
|
122
159
|
:file => version + '.tgz',
|
@@ -128,6 +165,7 @@ Capistrano.configuration(:must_exist).load do
|
|
128
165
|
}
|
129
166
|
deprec.download_src(src_package, src_dir)
|
130
167
|
deprec.install_from_src(src_package, src_dir)
|
168
|
+
gem.upgrade
|
131
169
|
gem.update_system
|
132
170
|
end
|
133
171
|
|
@@ -135,11 +173,11 @@ Capistrano.configuration(:must_exist).load do
|
|
135
173
|
version = 'httpd-2.2.4'
|
136
174
|
set :src_package, {
|
137
175
|
:file => version + '.tar.gz',
|
138
|
-
:md5sum => '3add41e0b924d4bb53c2dee55a38c09e httpd-2.2.
|
176
|
+
:md5sum => '3add41e0b924d4bb53c2dee55a38c09e httpd-2.2.4.tar.gz',
|
139
177
|
:dir => version,
|
140
178
|
:url => "http://www.apache.org/dist/httpd/#{version}.tar.gz",
|
141
179
|
:unpack => "tar zxf #{version}.tar.gz;",
|
142
|
-
:configure => './configure --enable-proxy --enable-proxy-balancer --enable-proxy-http --enable-rewrite --enable-cache --enable-headers --enable-ssl --enable-deflate;',
|
180
|
+
:configure => './configure --enable-proxy --enable-proxy-balancer --enable-proxy-http --enable-rewrite --enable-cache --enable-headers --enable-ssl --enable-deflate --with-included-apr;',
|
143
181
|
:make => 'make;',
|
144
182
|
:install => 'make install;',
|
145
183
|
:post_install => 'install -b support/apachectl /etc/init.d/httpd;'
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: deprec
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.4.
|
7
|
-
date: 2007-03
|
6
|
+
version: 1.4.2
|
7
|
+
date: 2007-05-03 00:00:00 +10:00
|
8
8
|
summary: deployment recipes for capistrano
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
version_requirement:
|
95
95
|
version_requirements: !ruby/object:Gem::Version::Requirement
|
96
96
|
requirements:
|
97
|
-
- - "
|
97
|
+
- - "="
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 1.
|
99
|
+
version: 1.4.1
|
100
100
|
version:
|