deprec 1.9.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +280 -0
- data/COPYING +19 -0
- data/LICENSE +339 -0
- data/README +152 -0
- data/THANKS +17 -0
- data/bin/depify +128 -0
- data/docs/EXAMPLE-installing_tracks.txt +41 -0
- data/docs/README.nagios +22 -0
- data/docs/README.rails +17 -0
- data/docs/config_gen_explained.txt +39 -0
- data/docs/{README.quickstart → deprec-1.x/deprec-1.x.quickstart} +4 -1
- data/docs/{building_edge_capistrano.txt → deprec-1.x/notes.txt} +6 -3
- data/docs/old/deprec_banner.gif +0 -0
- data/docs/windows_linux.txt +350 -0
- data/docs/xen/traffic_monitoring_with_vnstat.txt +95 -0
- data/docs/xen/xen-tools-notes.txt +31 -0
- data/docs/xen/xen_on_hardy.txt +39 -0
- data/lib/deprec.rb +8 -1
- data/lib/deprec/capistrano_extensions.rb +442 -0
- data/lib/deprec/recipes.rb +50 -233
- data/lib/deprec/recipes/aoe.rb +79 -0
- data/lib/deprec/recipes/app/mongrel.rb +213 -0
- data/lib/deprec/recipes/app/passenger.rb +197 -0
- data/lib/deprec/recipes/apt_mirror.rb +99 -0
- data/lib/deprec/recipes/ar_sendmail.rb +67 -0
- data/lib/deprec/recipes/canonical.rb +68 -0
- data/lib/deprec/recipes/db/mysql.rb +144 -0
- data/lib/deprec/recipes/db/postgresql.rb +104 -0
- data/lib/deprec/recipes/db/sqlite.rb +37 -0
- data/lib/deprec/recipes/ddclient.rb +51 -0
- data/lib/deprec/recipes/deprec.rb +199 -0
- data/lib/deprec/recipes/deprecated.rb +71 -0
- data/lib/deprec/recipes/example.rb +115 -0
- data/lib/deprec/recipes/git.rb +97 -0
- data/lib/deprec/recipes/gitosis.rb +48 -0
- data/lib/deprec/recipes/heartbeat.rb +138 -0
- data/lib/deprec/recipes/logrotate.rb +54 -0
- data/lib/deprec/recipes/lvm.rb +20 -0
- data/lib/deprec/recipes/memcache.rb +6 -2
- data/lib/deprec/recipes/monit.rb +143 -0
- data/lib/deprec/recipes/nagios.rb +305 -0
- data/lib/deprec/recipes/network.rb +93 -0
- data/lib/deprec/recipes/ntp.rb +103 -0
- data/lib/deprec/recipes/php.rb +58 -0
- data/lib/deprec/recipes/postfix.rb +115 -0
- data/lib/deprec/recipes/rails.rb +300 -55
- data/lib/deprec/recipes/ruby/mri.rb +55 -0
- data/lib/deprec/recipes/ruby/ree.rb +41 -0
- data/lib/deprec/recipes/sphinx.rb +86 -0
- data/lib/deprec/recipes/ssh.rb +85 -18
- data/lib/deprec/recipes/ssl.rb +55 -0
- data/lib/deprec/recipes/starling.rb +119 -0
- data/lib/deprec/recipes/svn.rb +163 -183
- data/lib/deprec/recipes/trac.rb +239 -62
- data/lib/deprec/recipes/ubuntu.rb +18 -100
- data/lib/deprec/recipes/users.rb +90 -0
- data/lib/deprec/recipes/utils.rb +58 -0
- data/lib/deprec/recipes/vnstat.rb +85 -0
- data/lib/deprec/recipes/web/apache.rb +119 -0
- data/lib/deprec/recipes/web/nginx.rb +172 -0
- data/lib/deprec/recipes/wordpress.rb +96 -0
- data/lib/deprec/recipes/wpmu.rb +103 -0
- data/lib/deprec/recipes/xen.rb +267 -0
- data/lib/deprec/recipes/xentools.rb +75 -0
- data/lib/deprec/templates/aoe/aoe-init +55 -0
- data/lib/deprec/templates/aoe/fence_aoemask +351 -0
- data/lib/deprec/templates/apache/namevirtualhosts.conf +5 -0
- data/lib/deprec/templates/apt/sources.list +18 -0
- data/lib/deprec/templates/apt_mirror/apt-mirror-cron +4 -0
- data/lib/deprec/templates/apt_mirror/mirror.list +33 -0
- data/lib/deprec/templates/ar_sendmail/logrotate.conf.erb +9 -0
- data/lib/deprec/templates/ar_sendmail/monit.conf.erb +5 -0
- data/lib/deprec/templates/ddclient/ddclient.conf.erb +11 -0
- data/lib/deprec/templates/ddclient/ddclient.erb +15 -0
- data/lib/deprec/templates/deprec/caprc.erb +14 -0
- data/lib/deprec/templates/heartbeat/authkeys.erb +2 -0
- data/lib/deprec/templates/heartbeat/ha.cf.erb +15 -0
- data/lib/deprec/templates/heartbeat/haresources.erb +1 -0
- data/lib/deprec/templates/logrotate/logrotate.conf.erb +32 -0
- data/lib/deprec/templates/mongrel/apache_vhost.erb +148 -0
- data/lib/deprec/templates/mongrel/logrotate.conf.erb +11 -0
- data/lib/deprec/{third_party/mongrel_cluster/resources/mongrel_cluster → templates/mongrel/mongrel_cluster-init-script} +19 -6
- data/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb +10 -0
- data/lib/deprec/templates/mongrel/monit.conf.erb +17 -0
- data/lib/deprec/templates/mongrel/nginx_vhost.erb +41 -0
- data/lib/deprec/templates/monit/monit-init-script +104 -0
- data/lib/deprec/templates/monit/monitrc.erb +227 -0
- data/lib/deprec/templates/monit/nothing +0 -0
- data/lib/deprec/templates/mysql/create_databases.sql +20 -0
- data/lib/deprec/templates/mysql/database.yml.prod +6 -0
- data/lib/deprec/templates/mysql/database.yml.stage +6 -0
- data/lib/deprec/templates/mysql/my.cnf.erb +140 -0
- data/lib/deprec/templates/mysql/sphinx.conf.prod +542 -0
- data/lib/deprec/templates/mysql/sphinx.conf.stage +542 -0
- data/lib/deprec/templates/nagios/cgi.cfg.erb +321 -0
- data/lib/deprec/templates/nagios/check_linux_free_memory.pl +118 -0
- data/lib/deprec/templates/nagios/check_mongrel_cluster.rb +82 -0
- data/lib/deprec/templates/nagios/commands.cfg.erb +240 -0
- data/lib/deprec/templates/nagios/contacts.cfg.erb +57 -0
- data/lib/deprec/templates/nagios/hosts.cfg.erb +143 -0
- data/lib/deprec/templates/nagios/htpasswd.users +1 -0
- data/lib/deprec/templates/nagios/localhost.cfg.erb +157 -0
- data/lib/deprec/templates/nagios/nagios.cfg.erb +1274 -0
- data/lib/deprec/templates/nagios/nagios_apache_vhost.conf.erb +45 -0
- data/lib/deprec/templates/nagios/nrpe.cfg.erb +210 -0
- data/lib/deprec/templates/nagios/nrpe.xinetd.erb +16 -0
- data/lib/deprec/templates/nagios/resource.cfg.erb +34 -0
- data/lib/deprec/templates/nagios/services.cfg.erb +79 -0
- data/lib/deprec/templates/nagios/templates.cfg.erb +9 -0
- data/lib/deprec/templates/nagios/timeperiods.cfg.erb +94 -0
- data/lib/deprec/templates/network/hostname.erb +1 -0
- data/lib/deprec/templates/network/hosts.erb +2 -0
- data/lib/deprec/templates/network/interfaces.erb +18 -0
- data/lib/deprec/templates/network/resolv.conf.erb +6 -0
- data/lib/deprec/templates/nginx/logrotate.conf.erb +13 -0
- data/lib/deprec/templates/nginx/mime.types.erb +70 -0
- data/lib/deprec/templates/nginx/nginx-init-script +62 -0
- data/lib/deprec/templates/nginx/nginx.conf.erb +125 -0
- data/lib/deprec/templates/nginx/nginx.logrotate.d +12 -0
- data/lib/deprec/templates/nginx/nothing.conf +1 -0
- data/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb +41 -0
- data/lib/deprec/templates/ntp/ntp.conf.erb +42 -0
- data/lib/deprec/templates/passenger/apache_vhost.erb +21 -0
- data/lib/deprec/templates/passenger/passenger.conf.erb +21 -0
- data/lib/deprec/templates/passenger/passenger.load.erb +3 -0
- data/lib/deprec/templates/postfix/aliases.erb +3 -0
- data/lib/deprec/templates/postfix/dynamicmaps.cf.erb +8 -0
- data/lib/deprec/templates/{postfix_main.conf → postfix/main.cf.erb} +6 -8
- data/lib/deprec/templates/postfix/master.cf.erb +77 -0
- data/lib/deprec/templates/sphinx/monit.conf.erb +5 -0
- data/lib/deprec/templates/ssh/ssh_config.erb +50 -0
- data/lib/deprec/templates/ssh/sshd_config.erb +78 -0
- data/lib/deprec/templates/ssl/make-ssl-cert +138 -0
- data/lib/deprec/templates/ssl/ssl-cert-snakeoil.key +15 -0
- data/lib/deprec/templates/ssl/ssl-cert-snakeoil.pem +19 -0
- data/lib/deprec/templates/starling/monit.conf.erb +14 -0
- data/lib/deprec/templates/starling/starling-init-script.erb +71 -0
- data/lib/deprec/templates/subversion/svn.apache.vhost.erb +43 -0
- data/lib/deprec/templates/trac/apache_vhost.conf.erb +24 -0
- data/lib/deprec/templates/trac/nginx_vhost.conf.erb +26 -0
- data/lib/deprec/templates/trac/trac.ini.erb +169 -0
- data/lib/deprec/templates/trac/trac_deprec.png +0 -0
- data/lib/deprec/templates/trac/tracd-init.erb +43 -0
- data/lib/deprec/templates/trac/users.htdigest.erb +0 -0
- data/lib/deprec/templates/vnstat/config.php +57 -0
- data/lib/deprec/templates/wordpress/apache2_wordpress_vhost.conf.erb +31 -0
- data/lib/deprec/templates/wordpress/wp-config.php.erb +31 -0
- data/lib/deprec/templates/wpmu/apache_vhost.conf.erb +13 -0
- data/lib/deprec/templates/xen/network-bridge-wrapper +3 -0
- data/lib/deprec/templates/xen/xend-config.sxp.erb +195 -0
- data/lib/deprec/templates/xen/xend-init.erb +57 -0
- data/lib/deprec/templates/xen/xendomains.erb +137 -0
- data/lib/deprec/templates/xentools/15-disable-hwclock +40 -0
- data/lib/deprec/templates/xentools/40-setup-networking +145 -0
- data/lib/deprec/templates/xentools/xen-tools.conf.erb +276 -0
- data/lib/deprec/templates/xentools/xm.tmpl.erb +138 -0
- data/lib/deprec_cmd_completion.sh +26 -0
- data/lib/vmbuilder_plugins/all.rb +20 -0
- data/lib/vmbuilder_plugins/apt.rb +93 -0
- data/lib/vmbuilder_plugins/emerge.rb +76 -0
- data/lib/{deprec/third_party/vmbuilder/plugins → vmbuilder_plugins}/gem.rb +10 -17
- data/lib/{deprec/third_party/vmbuilder/plugins → vmbuilder_plugins}/std.rb +69 -19
- metadata +204 -55
- data/bin/deprec +0 -35
- data/docs/README.slicehost +0 -14
- data/docs/README.svn_trac +0 -19
- data/lib/deprec/capistrano_extensions/actor_extensions.rb +0 -89
- data/lib/deprec/capistrano_extensions/cli_extensions.rb +0 -38
- data/lib/deprec/capistrano_extensions/deprec_extensions.rb +0 -137
- data/lib/deprec/generators/deprec/USAGE +0 -11
- data/lib/deprec/generators/deprec/deprec_generator.rb +0 -24
- data/lib/deprec/generators/deprec/templates/deploy.rb +0 -90
- data/lib/deprec/generators/loader.rb +0 -20
- data/lib/deprec/recipes/apache.rb +0 -91
- data/lib/deprec/recipes/cache_svn.rb +0 -74
- data/lib/deprec/recipes/vmware.rb +0 -114
- data/lib/deprec/templates/trac.ini.erb +0 -106
- data/lib/deprec/third_party/THIRD_PARTY_README +0 -12
- data/lib/deprec/third_party/mongrel_cluster/LICENSE +0 -506
- data/lib/deprec/third_party/mongrel_cluster/recipes.rb +0 -96
- data/lib/deprec/third_party/railsmachine/LICENSE +0 -506
- data/lib/deprec/third_party/railsmachine/recipes/apache.rb +0 -92
- data/lib/deprec/third_party/railsmachine/recipes/mysql.rb +0 -73
- data/lib/deprec/third_party/railsmachine/recipes/templates/httpd-ssl.conf +0 -80
- data/lib/deprec/third_party/railsmachine/recipes/templates/httpd.conf +0 -57
- data/lib/deprec/third_party/vmbuilder/plugins.rb +0 -8
- data/lib/deprec/third_party/vmbuilder/plugins/apt.rb +0 -144
- data/resources/capistrano_include_dotfiles.patch +0 -17
data/lib/deprec/recipes.rb
CHANGED
@@ -1,238 +1,55 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require 'deprec/third_party/mongrel_cluster/recipes'
|
9
|
-
require 'deprec/third_party/vmbuilder/plugins'
|
10
|
-
require 'deprec/third_party/railsmachine/recipes/apache'
|
11
|
-
require 'deprec/third_party/railsmachine/recipes/mysql'
|
12
|
-
require 'deprec/capistrano_extensions/cli_extensions.rb'
|
13
|
-
require 'deprec/capistrano_extensions/deprec_extensions.rb'
|
14
|
-
require 'deprec/capistrano_extensions/actor_extensions.rb'
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
unless Capistrano::Configuration.respond_to?(:instance)
|
3
|
+
abort "deprec2 requires Capistrano 2"
|
4
|
+
end
|
5
|
+
require "#{File.dirname(__FILE__)}/recipes/canonical"
|
6
|
+
require "#{File.dirname(__FILE__)}/recipes/deprec"
|
7
|
+
require "#{File.dirname(__FILE__)}/recipes/deprecated"
|
15
8
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
set :mongrel_group, lambda {mongrel_group_prefix + application}
|
26
|
-
|
27
|
-
desc <<-DESC
|
28
|
-
setup_rails_host takes a stock standard ubuntu 'dapper' 6.06.1 server
|
29
|
-
and installs everything needed to be a rails machine
|
30
|
-
DESC
|
31
|
-
task :install_rails_stack do
|
32
|
-
setup_user_perms
|
33
|
-
enable_universe # we'll need some packages from the 'universe' repository
|
34
|
-
disable_cdrom_install # we don't want to have to insert cdrom
|
35
|
-
install_packages_for_rails # install packages that come with distribution
|
36
|
-
install_rubygems
|
37
|
-
install_gems
|
38
|
-
apache_install
|
39
|
-
end
|
40
|
-
|
41
|
-
desc <<-DESC
|
42
|
-
deprecated: this function has been replaced by :before_setup and :after_setup
|
43
|
-
DESC
|
44
|
-
task :deprec_setup, :except => { :no_release => true } do
|
45
|
-
setup
|
46
|
-
end
|
47
|
-
|
48
|
-
desc "creates paths required by Capistrano's :setup task"
|
49
|
-
task :before_setup, :except => { :no_release => true } do
|
50
|
-
setup_paths
|
51
|
-
end
|
52
|
-
|
53
|
-
desc "sets up and configures servers "
|
54
|
-
task :after_setup, :except => { :no_release => true } do
|
55
|
-
setup_servers
|
56
|
-
end
|
57
|
-
|
58
|
-
desc "setup and configure servers"
|
59
|
-
task :setup_servers do
|
60
|
-
setup_web
|
61
|
-
setup_paths
|
62
|
-
setup_app
|
63
|
-
setup_symlinks
|
64
|
-
setup_db # XXX fails is database already exists
|
65
|
-
end
|
66
|
-
|
67
|
-
task :after_symlink, :roles => :app do
|
68
|
-
set_perms_for_mongrel_dirs
|
69
|
-
end
|
70
|
-
|
71
|
-
desc "set group ownership and permissions on dirs mongrel needs to write to"
|
72
|
-
task :set_perms_for_mongrel_dirs, :roles => :app do
|
73
|
-
tmp_dir = "#{deploy_to}/current/tmp"
|
74
|
-
shared_dir = "#{deploy_to}/shared"
|
75
|
-
files = ["#{deploy_to}/shared/log/mongrel.log", "#{deploy_to}/shared/log/#{rails_env}.log"]
|
76
|
-
|
77
|
-
sudo "chgrp -R #{mongrel_group} #{tmp_dir} #{shared_dir}"
|
78
|
-
sudo "chmod -R g+w #{tmp_dir} #{shared_dir}"
|
79
|
-
# set owner and group of mongrels file (if they exist)
|
80
|
-
files.each { |file|
|
81
|
-
sudo "chown #{mongrel_user} #{file} || exit 0"
|
82
|
-
sudo "chgrp #{mongrel_group} #{file} || exit 0"
|
83
|
-
}
|
84
|
-
end
|
85
|
-
|
86
|
-
desc "Setup web server."
|
87
|
-
task :setup_web, :roles => :web do
|
88
|
-
set :apache_server_name, domain unless apache_server_name
|
89
|
-
setup_apache
|
90
|
-
configure_apache
|
91
|
-
end
|
92
|
-
|
93
|
-
desc "create user and group for mongel to run as"
|
94
|
-
task :create_mongrel_user_and_group do
|
95
|
-
set :mongrel_user, 'mongrel_' + application if mongrel_user.nil?
|
96
|
-
set :mongrel_group, 'app_' + application if mongrel_group.nil?
|
97
|
-
deprec.groupadd(mongrel_group)
|
98
|
-
deprec.useradd(mongrel_user, :group => mongrel_group, :homedir => false)
|
99
|
-
sudo "usermod --gid #{mongrel_group} #{mongrel_user}"
|
100
|
-
end
|
101
|
-
|
102
|
-
desc "Setup application server."
|
103
|
-
task :setup_app, :roles => :app do
|
104
|
-
set :mongrel_environment, rails_env
|
105
|
-
set :mongrel_port, apache_proxy_port
|
106
|
-
set :mongrel_servers, apache_proxy_servers
|
107
|
-
create_mongrel_user_and_group
|
108
|
-
install_mongrel_start_script
|
109
|
-
setup_mongrel_cluster_path
|
110
|
-
configure_mongrel_cluster
|
111
|
-
end
|
112
|
-
|
113
|
-
desc "Restart application server."
|
114
|
-
task :restart_app, :roles => :app do
|
115
|
-
restart_mongrel_cluster
|
116
|
-
end
|
117
|
-
|
118
|
-
desc "Start application server."
|
119
|
-
task :start_app, :roles => :app do
|
120
|
-
start_mongrel_cluster
|
121
|
-
end
|
9
|
+
require "#{File.dirname(__FILE__)}/recipes/app/mongrel"
|
10
|
+
require "#{File.dirname(__FILE__)}/recipes/app/passenger"
|
11
|
+
require "#{File.dirname(__FILE__)}/recipes/db/mysql"
|
12
|
+
require "#{File.dirname(__FILE__)}/recipes/db/postgresql"
|
13
|
+
require "#{File.dirname(__FILE__)}/recipes/db/sqlite"
|
14
|
+
require "#{File.dirname(__FILE__)}/recipes/ruby/mri"
|
15
|
+
require "#{File.dirname(__FILE__)}/recipes/ruby/ree"
|
16
|
+
require "#{File.dirname(__FILE__)}/recipes/web/apache"
|
17
|
+
require "#{File.dirname(__FILE__)}/recipes/web/nginx"
|
122
18
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
desc "Setup public symlink directories"
|
129
|
-
task :setup_symlinks, :roles => [:app, :web] do
|
130
|
-
if app_symlinks
|
131
|
-
app_symlinks.each { |link| run "mkdir -p #{shared_path}/public/#{link}" }
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
desc "Setup database server."
|
136
|
-
task :setup_db, :roles => :db, :only => { :primary => true } do
|
137
|
-
setup_mysql
|
138
|
-
end
|
139
|
-
|
140
|
-
desc "Setup source control server."
|
141
|
-
task :setup_scm, :roles => :scm do
|
142
|
-
svn_create_repos
|
143
|
-
svn_import
|
144
|
-
end
|
145
|
-
|
146
|
-
desc "setup extra paths required for deployment"
|
147
|
-
task :setup_paths, :roles => :app do
|
148
|
-
# XXX make a function to create a group writable dir
|
149
|
-
sudo "test -d #{shared_path}/config || sudo mkdir -p #{shared_path}/config"
|
150
|
-
sudo "chgrp -R #{group} #{deploy_to}"
|
151
|
-
sudo "chmod -R g+w #{deploy_to}"
|
152
|
-
end
|
153
|
-
|
154
|
-
task :install_gems do
|
155
|
-
gem.install 'rails' # gem lib makes installing gems fun
|
156
|
-
gem.install 'fastthread'
|
157
|
-
gem.select 'mongrel' # mongrel requires we select a version
|
158
|
-
gem.install 'mongrel_cluster'
|
159
|
-
gem.install 'builder'
|
160
|
-
end
|
161
|
-
|
162
|
-
desc "create deployment group and add current user to it"
|
163
|
-
task :setup_user_perms do
|
164
|
-
deprec.groupadd(group)
|
165
|
-
deprec.add_user_to_group(user, group)
|
166
|
-
end
|
167
|
-
|
168
|
-
task :install_rubygems do
|
169
|
-
# XXX should check for presence of ruby first!
|
170
|
-
version = 'rubygems-1.1.1'
|
171
|
-
set :src_package, {
|
172
|
-
:file => version + '.tgz',
|
173
|
-
:md5sum => '1a77c5b6b293a3ccd5261dc120641ccc rubygems-1.1.1.tgz',
|
174
|
-
:dir => version,
|
175
|
-
:url => "http://rubyforge.org/frs/download.php/35283/rubygems-1.1.1.tgz",
|
176
|
-
:unpack => "tar zxf #{version}.tgz;",
|
177
|
-
:install => '/usr/bin/ruby1.8 setup.rb;'
|
178
|
-
}
|
179
|
-
deprec.download_src(src_package, src_dir)
|
180
|
-
deprec.install_from_src(src_package, src_dir)
|
181
|
-
gem.upgrade
|
182
|
-
gem.update_system
|
183
|
-
end
|
184
|
-
|
185
|
-
desc "Setup public symlink directories"
|
186
|
-
task :setup_symlinks, :roles => [:app, :web] do
|
187
|
-
if app_symlinks
|
188
|
-
app_symlinks.each { |link| run "mkdir -p #{shared_path}/public/#{link}" }
|
189
|
-
end
|
190
|
-
end
|
19
|
+
require "#{File.dirname(__FILE__)}/recipes/git"
|
20
|
+
require "#{File.dirname(__FILE__)}/recipes/gitosis"
|
21
|
+
require "#{File.dirname(__FILE__)}/recipes/svn"
|
191
22
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
desc "install the rmagic gem, and dependent image-magick library"
|
200
|
-
task :install_rmagick, :roles => [:app, :web] do
|
201
|
-
install_image_magic
|
202
|
-
gem.install 'rmagick'
|
203
|
-
end
|
204
|
-
|
205
|
-
# Craig: I've kept this generic rather than calling the task setup postfix.
|
206
|
-
# if people want other smtp servers, it could be configurable
|
207
|
-
desc "install and configure postfix"
|
208
|
-
task :setup_smtp_server do
|
209
|
-
install_postfix
|
210
|
-
set :postfix_destination_domains, [domain] + apache_server_aliases
|
211
|
-
deprec.render_template_to_file('postfix_main', '/etc/postfix/main.cf')
|
212
|
-
end
|
213
|
-
|
214
|
-
task :setup_admin_account do
|
215
|
-
user = Capistrano::CLI.prompt "Enter userid for new user"
|
216
|
-
deprec.useradd(user, :shell => '/bin/bash')
|
217
|
-
puts "Setting pasword for new account"
|
218
|
-
sudo_with_input("passwd #{user}", /UNIX password/) # ??? how many versions of the prompt are there?
|
219
|
-
deprec.groupadd('admin')
|
220
|
-
deprec.add_user_to_group(user, 'admin')
|
221
|
-
deprec.append_to_file_if_missing('/etc/sudoers', '%admin ALL=(ALL) ALL')
|
222
|
-
end
|
223
|
-
|
224
|
-
task :setup_admin_account_as_root do
|
225
|
-
as_root { setup_admin_account }
|
226
|
-
end
|
227
|
-
|
228
|
-
desc "Change password for the root account"
|
229
|
-
task :change_root_password do
|
230
|
-
sudo_with_input("passwd root", /UNIX password/) # ??? how many versions of the prompt are there?
|
231
|
-
end
|
23
|
+
require "#{File.dirname(__FILE__)}/recipes/users"
|
24
|
+
require "#{File.dirname(__FILE__)}/recipes/ssh"
|
25
|
+
require "#{File.dirname(__FILE__)}/recipes/php"
|
26
|
+
# require "#{File.dirname(__FILE__)}/recipes/scm/trac"
|
232
27
|
|
233
|
-
|
234
|
-
as_root { change_root_password }
|
235
|
-
end
|
28
|
+
require "#{File.dirname(__FILE__)}/recipes/aoe"
|
236
29
|
|
237
|
-
|
238
|
-
|
30
|
+
require "#{File.dirname(__FILE__)}/recipes/xen"
|
31
|
+
require "#{File.dirname(__FILE__)}/recipes/xentools"
|
32
|
+
|
33
|
+
require "#{File.dirname(__FILE__)}/recipes/ddclient"
|
34
|
+
require "#{File.dirname(__FILE__)}/recipes/ntp"
|
35
|
+
require "#{File.dirname(__FILE__)}/recipes/logrotate"
|
36
|
+
require "#{File.dirname(__FILE__)}/recipes/ssl"
|
37
|
+
|
38
|
+
require "#{File.dirname(__FILE__)}/recipes/rails"
|
39
|
+
require "#{File.dirname(__FILE__)}/recipes/postfix"
|
40
|
+
require "#{File.dirname(__FILE__)}/recipes/memcache"
|
41
|
+
require "#{File.dirname(__FILE__)}/recipes/monit"
|
42
|
+
require "#{File.dirname(__FILE__)}/recipes/network"
|
43
|
+
require "#{File.dirname(__FILE__)}/recipes/nagios"
|
44
|
+
require "#{File.dirname(__FILE__)}/recipes/heartbeat"
|
45
|
+
|
46
|
+
require "#{File.dirname(__FILE__)}/recipes/ubuntu"
|
47
|
+
require "#{File.dirname(__FILE__)}/recipes/lvm"
|
48
|
+
require "#{File.dirname(__FILE__)}/recipes/vnstat"
|
49
|
+
require "#{File.dirname(__FILE__)}/recipes/sphinx"
|
50
|
+
require "#{File.dirname(__FILE__)}/recipes/utils"
|
51
|
+
require "#{File.dirname(__FILE__)}/recipes/apt_mirror"
|
52
|
+
# require "#{File.dirname(__FILE__)}/recipes/wordpress" Not working
|
53
|
+
require "#{File.dirname(__FILE__)}/recipes/wpmu"
|
54
|
+
require "#{File.dirname(__FILE__)}/recipes/ar_sendmail"
|
55
|
+
require "#{File.dirname(__FILE__)}/recipes/starling"
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
|
4
|
+
SRC_PACKAGES[:aoe] = {
|
5
|
+
:url => "http://support.coraid.com/support/linux/aoe6-64.tar.gz",
|
6
|
+
:md5sum => "c5e1ebb734e3b29c0a3d886a700ca44a aoe6-64.tar.gz",
|
7
|
+
:configure => ''
|
8
|
+
}
|
9
|
+
|
10
|
+
SRC_PACKAGES[:cec] = {
|
11
|
+
:url => "http://easynews.dl.sourceforge.net/sourceforge/aoetools/cec-8.tgz",
|
12
|
+
:md5sum => "7899dc549f9a368e532f9c39ed819f71 cec-8.tgz",
|
13
|
+
:configure => '',
|
14
|
+
:install => "test -f /usr/sbin/cec && rm /usr/sbin/cec; make install;"
|
15
|
+
}
|
16
|
+
|
17
|
+
SRC_PACKAGES[:ddt] = {
|
18
|
+
:url => "http://support.coraid.com/support/sr/ddt-8.tgz",
|
19
|
+
:md5sum => "256a58aba5e05f9995fb9de6aadadf92 ddt-8.tgz"
|
20
|
+
}
|
21
|
+
|
22
|
+
SRC_PACKAGES[:aoemask] = {
|
23
|
+
:url => "http://support.coraid.com/support/sr/aoemask-1.tgz",
|
24
|
+
:md5sum => "379461a28d511e269f4593b846bd1288 aoemask-1.tgz"
|
25
|
+
}
|
26
|
+
|
27
|
+
namespace :deprec do
|
28
|
+
namespace :aoe do
|
29
|
+
|
30
|
+
desc "Install aoe drivers required to mount Coraid block devices"
|
31
|
+
task :install, :roles => :aoe do
|
32
|
+
install_deps
|
33
|
+
deprec2.download_src(SRC_PACKAGES[:aoe], src_dir)
|
34
|
+
deprec2.install_from_src(SRC_PACKAGES[:aoe], src_dir)
|
35
|
+
end
|
36
|
+
|
37
|
+
task :install_deps, :roles => :aoe do
|
38
|
+
apt.install( {:base => %w(build-essential linux-headers-$(uname -r) vblade aoetools)}, :stable )
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "Install all AoE related software"
|
42
|
+
task :install_all, :roles => :aoe do
|
43
|
+
top.deprec.aoe.install
|
44
|
+
top.deprec.cec.install
|
45
|
+
top.deprec.ddt.install
|
46
|
+
top.deprec.aoemask.install
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
namespace :cec do
|
52
|
+
desc "install CEC (Coraid Ethernet Console)"
|
53
|
+
task :install, :roles => :aoe do
|
54
|
+
deprec2.download_src(SRC_PACKAGES[:cec], src_dir)
|
55
|
+
deprec2.install_from_src(SRC_PACKAGES[:cec], src_dir)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
namespace :ddt do
|
60
|
+
desc "install DDT (tool for testing performance)"
|
61
|
+
task :install, :roles => :aoe do
|
62
|
+
deprec2.download_src(SRC_PACKAGES[:ddt], src_dir)
|
63
|
+
deprec2.install_from_src(SRC_PACKAGES[:ddt], src_dir)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
namespace :aoemask do
|
68
|
+
desc "install aoemask"
|
69
|
+
task :install, :roles => :aoe do
|
70
|
+
deprec2.download_src(SRC_PACKAGES[:aoemask], src_dir)
|
71
|
+
deprec2.install_from_src(SRC_PACKAGES[:aoemask], src_dir)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
|
@@ -0,0 +1,213 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
|
4
|
+
namespace :deprec do
|
5
|
+
namespace :mongrel do
|
6
|
+
|
7
|
+
set :mongrel_servers, 2
|
8
|
+
set :mongrel_port, 8000
|
9
|
+
set :mongrel_address, "127.0.0.1"
|
10
|
+
set(:mongrel_environment) { rails_env }
|
11
|
+
set(:mongrel_log_dir) { "#{deploy_to}/shared/log" }
|
12
|
+
set(:mongrel_pid_dir) { "#{deploy_to}/shared/pids" }
|
13
|
+
set :mongrel_conf_dir, '/etc/mongrel_cluster'
|
14
|
+
set(:mongrel_conf) { "/etc/mongrel_cluster/#{application}.yml" }
|
15
|
+
|
16
|
+
desc "Install mongrel"
|
17
|
+
task :install, :roles => :app do
|
18
|
+
gem2.install 'mongrel'
|
19
|
+
gem2.install 'mongrel_cluster'
|
20
|
+
gem2.install 'swiftiply'
|
21
|
+
symlink_mongrel_rails
|
22
|
+
SYSTEM_CONFIG_FILES[:mongrel].each do |file|
|
23
|
+
deprec2.render_template(:mongrel, file.merge(:remote=>true))
|
24
|
+
end
|
25
|
+
activate_system
|
26
|
+
end
|
27
|
+
|
28
|
+
task :symlink_mongrel_rails, :roles => :app do
|
29
|
+
sudo "ln -sf /usr/local/bin/mongrel_rails /usr/bin/mongrel_rails"
|
30
|
+
end
|
31
|
+
|
32
|
+
task :symlink_logrotate_config, :roles => :app do
|
33
|
+
sudo "ln -sf #{deploy_to}/mongrel/logrotate.conf /etc/logrotate.d/mongrel-#{application}"
|
34
|
+
end
|
35
|
+
|
36
|
+
# Configure
|
37
|
+
|
38
|
+
SYSTEM_CONFIG_FILES[:mongrel] = [
|
39
|
+
|
40
|
+
{:template => 'mongrel_cluster-init-script',
|
41
|
+
:path => '/etc/init.d/mongrel_cluster',
|
42
|
+
:mode => 0755,
|
43
|
+
:owner => 'root:root'}
|
44
|
+
|
45
|
+
]
|
46
|
+
|
47
|
+
PROJECT_CONFIG_FILES[:mongrel] = [
|
48
|
+
|
49
|
+
{:template => 'mongrel_cluster.yml.erb',
|
50
|
+
:path => 'cluster.yml',
|
51
|
+
:mode => 0644,
|
52
|
+
:owner => 'root:root'},
|
53
|
+
|
54
|
+
{:template => 'monit.conf.erb',
|
55
|
+
:path => "monit.conf",
|
56
|
+
:mode => 0600,
|
57
|
+
:owner => 'root:root'},
|
58
|
+
|
59
|
+
{:template => 'logrotate.conf.erb',
|
60
|
+
:path => "logrotate.conf",
|
61
|
+
:mode => 0644,
|
62
|
+
:owner => 'root:root'},
|
63
|
+
|
64
|
+
{:template => 'nginx_vhost.erb',
|
65
|
+
:path => "nginx_vhost.conf",
|
66
|
+
:mode => 0644,
|
67
|
+
:owner => 'root:root'},
|
68
|
+
|
69
|
+
{:template => 'apache_vhost.erb',
|
70
|
+
:path => "apache_vhost",
|
71
|
+
:mode => 0644,
|
72
|
+
:owner => 'root:root'}
|
73
|
+
|
74
|
+
]
|
75
|
+
|
76
|
+
desc "Generate configuration file(s) for mongrel from template(s)"
|
77
|
+
task :config_gen do
|
78
|
+
config_gen_system
|
79
|
+
config_gen_project
|
80
|
+
end
|
81
|
+
|
82
|
+
task :config_gen_system do
|
83
|
+
SYSTEM_CONFIG_FILES[:mongrel].each do |file|
|
84
|
+
deprec2.render_template(:mongrel, file)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
task :config_gen_project do
|
89
|
+
PROJECT_CONFIG_FILES[:mongrel].each do |file|
|
90
|
+
deprec2.render_template(:mongrel, file)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
desc 'Deploy configuration files(s) for mongrel'
|
95
|
+
task :config, :roles => :app do
|
96
|
+
config_system
|
97
|
+
config_project
|
98
|
+
end
|
99
|
+
|
100
|
+
task :config_system, :roles => :app do
|
101
|
+
deprec2.push_configs(:mongrel, SYSTEM_CONFIG_FILES[:mongrel])
|
102
|
+
end
|
103
|
+
|
104
|
+
task :config_project, :roles => :app do
|
105
|
+
deprec2.push_configs(:mongrel, PROJECT_CONFIG_FILES[:mongrel])
|
106
|
+
symlink_mongrel_cluster
|
107
|
+
send("symlink_#{web_server_type}_vhost")
|
108
|
+
symlink_monit_config
|
109
|
+
symlink_logrotate_config
|
110
|
+
activate_project
|
111
|
+
end
|
112
|
+
|
113
|
+
task :symlink_apache_vhost, :roles => :app do
|
114
|
+
sudo "ln -sf #{deploy_to}/mongrel/apache_vhost #{apache_vhost_dir}/#{application}"
|
115
|
+
end
|
116
|
+
|
117
|
+
task :symlink_nginx_vhost, :roles => :app do
|
118
|
+
sudo "ln -sf #{deploy_to}/mongrel/nginx_vhost #{nginx_vhost_dir}/#{application}"
|
119
|
+
end
|
120
|
+
|
121
|
+
task :symlink_monit_config, :roles => :app do
|
122
|
+
deprec2.mkdir(monit_confd_dir, :via => :sudo)
|
123
|
+
sudo "ln -sf #{deploy_to}/mongrel/monit.conf #{monit_confd_dir}/mongrel_#{application}.conf"
|
124
|
+
end
|
125
|
+
|
126
|
+
task :unlink_monit_config, :roles => :app do
|
127
|
+
sudo "test -L #{monit_confd_dir}/mongrel_#{application}.conf && unlink #{monit_confd_dir}/mongrel_#{application}.conf"
|
128
|
+
end
|
129
|
+
|
130
|
+
task :symlink_mongrel_cluster, :roles => :app do
|
131
|
+
deprec2.mkdir(mongrel_conf_dir, :via => :sudo)
|
132
|
+
sudo "ln -sf #{deploy_to}/mongrel/cluster.yml #{mongrel_conf}"
|
133
|
+
end
|
134
|
+
|
135
|
+
task :unlink_mongrel_cluster, :roles => :app do
|
136
|
+
sudo "test -L #{mongrel_conf} && unlink #{mongrel_conf}"
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
# Control
|
141
|
+
|
142
|
+
desc "Start application server."
|
143
|
+
task :start, :roles => :app do
|
144
|
+
send(run_method, "mongrel_rails cluster::start --clean -C #{mongrel_conf}")
|
145
|
+
end
|
146
|
+
|
147
|
+
desc "Stop application server."
|
148
|
+
task :stop, :roles => :app do
|
149
|
+
send(run_method, "mongrel_rails cluster::stop -C #{mongrel_conf}")
|
150
|
+
end
|
151
|
+
|
152
|
+
desc "Stop all mongrel clusters."
|
153
|
+
task :stop_all, :roles => :app do
|
154
|
+
run "#{sudo} /etc/init.d/mongrel_cluster stop"
|
155
|
+
end
|
156
|
+
|
157
|
+
desc "Restart application server."
|
158
|
+
task :restart, :roles => :app do
|
159
|
+
send(run_method, "mongrel_rails cluster::restart --clean -C #{mongrel_conf}")
|
160
|
+
end
|
161
|
+
|
162
|
+
task :activate, :roles => :app do
|
163
|
+
activate_system
|
164
|
+
activate_project
|
165
|
+
end
|
166
|
+
|
167
|
+
task :activate_system, :roles => :app do
|
168
|
+
send(run_method, "update-rc.d mongrel_cluster defaults")
|
169
|
+
end
|
170
|
+
|
171
|
+
task :activate_project, :roles => :app do
|
172
|
+
symlink_mongrel_cluster
|
173
|
+
symlink_monit_config
|
174
|
+
if web_server_type.to_s == 'apache'
|
175
|
+
sudo "a2ensite #{application}"
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
task :deactivate, :roles => :app do
|
180
|
+
puts
|
181
|
+
puts "******************************************************************"
|
182
|
+
puts
|
183
|
+
puts "Danger!"
|
184
|
+
puts
|
185
|
+
puts "Do you want to deactivate just this project or all mongrel"
|
186
|
+
puts "clusters on this server? Try a more granular command:"
|
187
|
+
puts
|
188
|
+
puts "cap deprec:mongrel:deactivate_system # disable all clusters"
|
189
|
+
puts "cap deprec:mongrel:deactivate_project # disable only this project"
|
190
|
+
puts
|
191
|
+
puts "******************************************************************"
|
192
|
+
puts
|
193
|
+
end
|
194
|
+
|
195
|
+
task :deactivate_system, :roles => :app do
|
196
|
+
send(run_method, "update-rc.d -f mongrel_cluster remove")
|
197
|
+
end
|
198
|
+
|
199
|
+
task :deactivate_project, :roles => :app do
|
200
|
+
unlink_mongrel_cluster
|
201
|
+
unlink_monit_config
|
202
|
+
restart
|
203
|
+
end
|
204
|
+
|
205
|
+
task :backup, :roles => :app do
|
206
|
+
end
|
207
|
+
|
208
|
+
task :restore, :roles => :app do
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|