le1t0-deprec 2.1.6.001
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +444 -0
- data/COPYING +19 -0
- data/LICENSE +339 -0
- data/README +154 -0
- data/THANKS +17 -0
- data/bin/depify +139 -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/deprec-1.x/deprec-1.x.quickstart +50 -0
- data/docs/deprec-1.x/notes.txt +12 -0
- 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 +42 -0
- data/lib/deprec/capistrano_extensions.rb +446 -0
- data/lib/deprec/recipes.rb +7 -0
- data/lib/deprec/recipes/aoe.rb +79 -0
- data/lib/deprec/recipes/app/mongrel.rb +213 -0
- data/lib/deprec/recipes/app/passenger.rb +190 -0
- data/lib/deprec/recipes/ar_sendmail.rb +67 -0
- data/lib/deprec/recipes/aspell.rb +22 -0
- data/lib/deprec/recipes/canonical.rb +68 -0
- data/lib/deprec/recipes/cap.rb +39 -0
- data/lib/deprec/recipes/chef.rb +68 -0
- data/lib/deprec/recipes/collectd.rb +112 -0
- data/lib/deprec/recipes/db/couchdb.rb +107 -0
- data/lib/deprec/recipes/db/mysql.rb +194 -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 +167 -0
- data/lib/deprec/recipes/deprecated.rb +71 -0
- data/lib/deprec/recipes/drbd.rb +137 -0
- data/lib/deprec/recipes/dummy.rb +22 -0
- data/lib/deprec/recipes/example.rb +115 -0
- data/lib/deprec/recipes/git.rb +97 -0
- data/lib/deprec/recipes/gitosis.rb.disabled +55 -0
- data/lib/deprec/recipes/glusterfs.rb +176 -0
- data/lib/deprec/recipes/god.rb +70 -0
- data/lib/deprec/recipes/haproxy.rb +115 -0
- data/lib/deprec/recipes/heartbeat.rb +138 -0
- data/lib/deprec/recipes/imagemagick/imagemagick_bin.rb +24 -0
- data/lib/deprec/recipes/imagemagick/imagemagick_src.rb +39 -0
- data/lib/deprec/recipes/integrity.rb +108 -0
- data/lib/deprec/recipes/iptables.rb +94 -0
- data/lib/deprec/recipes/java.rb +23 -0
- data/lib/deprec/recipes/keepalived.rb +78 -0
- data/lib/deprec/recipes/ldap.rb +52 -0
- data/lib/deprec/recipes/logrotate.rb +56 -0
- data/lib/deprec/recipes/lvm.rb +20 -0
- data/lib/deprec/recipes/memcache.rb +49 -0
- data/lib/deprec/recipes/mongodb.rb +94 -0
- data/lib/deprec/recipes/monit.rb +135 -0
- data/lib/deprec/recipes/mysql_proxy.rb +67 -0
- data/lib/deprec/recipes/nagios.rb +361 -0
- data/lib/deprec/recipes/network.rb +116 -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/profiles.rb +125 -0
- data/lib/deprec/recipes/raid/amcc_3ware.rb +21 -0
- data/lib/deprec/recipes/rails.rb +330 -0
- data/lib/deprec/recipes/redhat_cluster.rb +228 -0
- data/lib/deprec/recipes/redis.rb +90 -0
- data/lib/deprec/recipes/ruby/mri.rb +55 -0
- data/lib/deprec/recipes/ruby/ree.rb +40 -0
- data/lib/deprec/recipes/rvm.rb +32 -0
- data/lib/deprec/recipes/s3utils.rb +63 -0
- data/lib/deprec/recipes/sphinx/thinking_sphinx.rb +105 -0
- data/lib/deprec/recipes/sphinx/ultrasphinx.rb +86 -0
- data/lib/deprec/recipes/ssh.rb +147 -0
- data/lib/deprec/recipes/ssl.rb +56 -0
- data/lib/deprec/recipes/starling.rb +119 -0
- data/lib/deprec/recipes/svn.rb +171 -0
- data/lib/deprec/recipes/syslog.rb +63 -0
- data/lib/deprec/recipes/trac.rb.disabled +277 -0
- data/lib/deprec/recipes/tsung.rb +74 -0
- data/lib/deprec/recipes/ubuntu.rb +90 -0
- 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 +143 -0
- data/lib/deprec/recipes/web/nginx.rb +172 -0
- data/lib/deprec/recipes/wordpress.rb.notworking +96 -0
- data/lib/deprec/recipes/wpmu.rb +103 -0
- data/lib/deprec/recipes/xen.rb +364 -0
- data/lib/deprec/recipes/xentools.rb +101 -0
- data/lib/deprec/recipes_minus_rails.rb +125 -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/apache/ports.conf.erb +5 -0
- data/lib/deprec/templates/apache/status.conf.erb +17 -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/chef/chef.json.erb +1 -0
- data/lib/deprec/templates/chef/solo.rb +2 -0
- data/lib/deprec/templates/collectd/collectd-init.d +153 -0
- data/lib/deprec/templates/collectd/collectd.conf.erb +686 -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/drbd/drbd.conf.erb +531 -0
- data/lib/deprec/templates/glusterfs/glusterfsd-init.erb +95 -0
- data/lib/deprec/templates/gnbd_client/cluster.conf.erb +21 -0
- data/lib/deprec/templates/gnbd_client/clvm-default.erb +3 -0
- data/lib/deprec/templates/gnbd_client/cman-default.erb +6 -0
- data/lib/deprec/templates/gnbd_client/gnbdimports.conf.erb +1 -0
- data/lib/deprec/templates/gnbd_server/cluster.conf.erb +20 -0
- data/lib/deprec/templates/gnbd_server/clvm-default.erb +3 -0
- data/lib/deprec/templates/gnbd_server/cman-default.erb +6 -0
- data/lib/deprec/templates/gnbd_server/gnbd-server-default.erb +1 -0
- data/lib/deprec/templates/gnbd_server/gnbdexports.conf.erb +1 -0
- data/lib/deprec/templates/god/god-conf.erb +2 -0
- data/lib/deprec/templates/god/god-init.erb +47 -0
- data/lib/deprec/templates/haproxy/haproxy-init.d +120 -0
- data/lib/deprec/templates/haproxy/haproxy.cfg.erb +31 -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/integrity/apache_vhost.erb +4 -0
- data/lib/deprec/templates/integrity/config.ru.erb +21 -0
- data/lib/deprec/templates/integrity/config.yml.erb +43 -0
- data/lib/deprec/templates/iptables/firewall-default.erb +13 -0
- data/lib/deprec/templates/iptables/firewall-init.erb +171 -0
- data/lib/deprec/templates/keepalived/keepalived.conf.erb +18 -0
- data/lib/deprec/templates/logrotate/logrotate.conf.erb +32 -0
- data/lib/deprec/templates/mongodb/mongodb-init.d +88 -0
- data/lib/deprec/templates/mongrel/apache_vhost.conf.erb +148 -0
- data/lib/deprec/templates/mongrel/logrotate.conf.erb +11 -0
- data/lib/deprec/templates/mongrel/mongrel_cluster-init-script +54 -0
- 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.conf.erb +41 -0
- data/lib/deprec/templates/monit/monit-init-script +104 -0
- data/lib/deprec/templates/monit/monitrc.erb +250 -0
- data/lib/deprec/templates/monit/nothing.monitrc +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/mysql_proxy/mysql-proxy-default.erb +4 -0
- data/lib/deprec/templates/nagios/README +32 -0
- data/lib/deprec/templates/nagios/cgi.cfg.erb +357 -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/htpasswd.users +1 -0
- data/lib/deprec/templates/nagios/mrtg.cfg +180 -0
- data/lib/deprec/templates/nagios/nagios.cfg.erb +1325 -0
- data/lib/deprec/templates/nagios/nrpe.cfg.erb +222 -0
- data/lib/deprec/templates/nagios/nrpe.xinetd.erb +16 -0
- data/lib/deprec/templates/nagios/objects/commands.cfg.erb +265 -0
- data/lib/deprec/templates/nagios/objects/contacts.cfg.erb +89 -0
- data/lib/deprec/templates/nagios/objects/hosts.cfg.erb +114 -0
- data/lib/deprec/templates/nagios/objects/localhost.cfg.erb +116 -0
- data/lib/deprec/templates/nagios/objects/services.cfg.erb +165 -0
- data/lib/deprec/templates/nagios/objects/timeperiods.cfg.erb +94 -0
- data/lib/deprec/templates/nagios/resource.cfg.erb +34 -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 +29 -0
- data/lib/deprec/templates/passenger/logrotate.conf.erb +12 -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.cf.erb +36 -0
- data/lib/deprec/templates/postfix/master.cf.erb +77 -0
- data/lib/deprec/templates/redis/redis-conf.erb +132 -0
- data/lib/deprec/templates/redis/redis-init.erb +50 -0
- data/lib/deprec/templates/s3utils/s3cfg +35 -0
- data/lib/deprec/templates/s3utils/s3config.yml +3 -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/syslog/syslog.conf.erb +71 -0
- data/lib/deprec/templates/syslog/syslogd.erb +13 -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/tsung/tsung.xml.erb +47 -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/100-ubuntu-setup +26 -0
- data/lib/deprec/templates/xentools/15-disable-hwclock +40 -0
- data/lib/deprec/templates/xentools/30-disable-gettys +57 -0
- data/lib/deprec/templates/xentools/31-ubuntu-setup +32 -0
- data/lib/deprec/templates/xentools/40-setup-networking +145 -0
- data/lib/deprec/templates/xentools/98-custom +17 -0
- data/lib/deprec/templates/xentools/xen-tools.conf.erb +278 -0
- data/lib/deprec/templates/xentools/xm.tmpl.erb +138 -0
- data/lib/deprec_cmd_completion.sh +26 -0
- data/lib/deprec_minus_rails.rb +12 -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/vmbuilder_plugins/gem.rb +100 -0
- data/lib/vmbuilder_plugins/std.rb +203 -0
- metadata +304 -0
@@ -0,0 +1,7 @@
|
|
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
|
+
|
6
|
+
require "#{File.dirname(__FILE__)}/recipes_minus_rails"
|
7
|
+
require "#{File.dirname(__FILE__)}/recipes/rails"
|
@@ -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.conf.erb',
|
65
|
+
:path => "nginx_vhost.conf",
|
66
|
+
:mode => 0644,
|
67
|
+
:owner => 'root:root'},
|
68
|
+
|
69
|
+
{:template => 'apache_vhost.conf.erb',
|
70
|
+
:path => "apache_vhost.conf",
|
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.conf #{apache_vhost_dir}/#{application}"
|
115
|
+
end
|
116
|
+
|
117
|
+
task :symlink_nginx_vhost, :roles => :app do
|
118
|
+
sudo "ln -sf #{deploy_to}/mongrel/nginx_vhost.conf #{nginx_vhost_dir}/#{application}.conf"
|
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
|
@@ -0,0 +1,190 @@
|
|
1
|
+
# Copyright 2006-2010 by Mike Bailey, le1t0@github. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :passenger do
|
5
|
+
|
6
|
+
set(:passenger_install_dir) {
|
7
|
+
|
8
|
+
if ruby_vm_type == :ree
|
9
|
+
base_dir = "#{ree_install_dir}/lib/ruby/gems/1.8/gems/"
|
10
|
+
latest_passenger_version = capture("ls -d #{base_dir + 'passenger-*'} | tail -1").chomp
|
11
|
+
else
|
12
|
+
"/usr/local/lib/ruby/gems/1.8/gems/passenger-#{passenger_version}"
|
13
|
+
end
|
14
|
+
}
|
15
|
+
|
16
|
+
set(:passenger_document_root) { "#{current_path}/public" }
|
17
|
+
set :passenger_rails_allow_mod_rewrite, 'off'
|
18
|
+
# Default settings for Passenger config files
|
19
|
+
set :passenger_log_level, 0
|
20
|
+
set(:passenger_log_dir) { "#{shared_path}/log"}
|
21
|
+
set :passenger_user_switching, 'on'
|
22
|
+
set :passenger_default_user, 'nobody'
|
23
|
+
set :passenger_max_pool_size, 6
|
24
|
+
set :passenger_max_instances_per_app, 0
|
25
|
+
set :passenger_pool_idle_time, 300
|
26
|
+
set :passenger_rails_autodetect, 'on'
|
27
|
+
set :passenger_rails_spawn_method, 'smart' # smart | conservative
|
28
|
+
set :passenger_version, '2.2.11'
|
29
|
+
|
30
|
+
desc "Install passenger"
|
31
|
+
task :install, :roles => :app do
|
32
|
+
install_deps
|
33
|
+
gem2.install 'passenger', passenger_version
|
34
|
+
sudo "passenger-install-apache2-module -a"
|
35
|
+
initial_config_push
|
36
|
+
activate_system
|
37
|
+
end
|
38
|
+
|
39
|
+
# Install dependencies for Passenger
|
40
|
+
task :install_deps, :roles => :app do
|
41
|
+
apt.install( {:base => %w(apache2-mpm-prefork apache2-prefork-dev rsync)}, :stable )
|
42
|
+
gem2.install 'fastthread'
|
43
|
+
gem2.install 'rack'
|
44
|
+
gem2.install 'rake'
|
45
|
+
end
|
46
|
+
|
47
|
+
task :initial_config_push, :roles => :web do
|
48
|
+
# XXX Non-standard!
|
49
|
+
# We need to push out the .load and .conf files for Passenger
|
50
|
+
SYSTEM_CONFIG_FILES[:passenger].each do |file|
|
51
|
+
deprec2.render_template(:passenger, file.merge(:remote => true))
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
SYSTEM_CONFIG_FILES[:passenger] = [
|
56
|
+
|
57
|
+
{:template => 'passenger.load.erb',
|
58
|
+
:path => '/etc/apache2/mods-available/passenger.load',
|
59
|
+
:mode => 0755,
|
60
|
+
:owner => 'root:root'},
|
61
|
+
|
62
|
+
{:template => 'passenger.conf.erb',
|
63
|
+
:path => '/etc/apache2/mods-available/passenger.conf',
|
64
|
+
:mode => 0755,
|
65
|
+
:owner => 'root:root'}
|
66
|
+
|
67
|
+
]
|
68
|
+
|
69
|
+
PROJECT_CONFIG_FILES[:passenger] = [
|
70
|
+
|
71
|
+
{ :template => 'apache_vhost.erb',
|
72
|
+
:path => "apache_vhost",
|
73
|
+
:mode => 0755,
|
74
|
+
:owner => 'root:root'},
|
75
|
+
|
76
|
+
{:template => 'logrotate.conf.erb',
|
77
|
+
:path => "logrotate.conf",
|
78
|
+
:mode => 0644,
|
79
|
+
:owner => 'root:root'}
|
80
|
+
|
81
|
+
]
|
82
|
+
|
83
|
+
desc "Generate Passenger apache configs (system & project level)."
|
84
|
+
task :config_gen do
|
85
|
+
config_gen_system
|
86
|
+
config_gen_project
|
87
|
+
end
|
88
|
+
|
89
|
+
desc "Generate Passenger apache configs (system level) from template."
|
90
|
+
task :config_gen_system do
|
91
|
+
SYSTEM_CONFIG_FILES[:passenger].each do |file|
|
92
|
+
deprec2.render_template(:passenger, file)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
desc "Generate Passenger apache configs (project level) from template."
|
97
|
+
task :config_gen_project do
|
98
|
+
PROJECT_CONFIG_FILES[:passenger].each do |file|
|
99
|
+
deprec2.render_template(:passenger, file)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
desc "Push Passenger config files (system & project level) to server"
|
104
|
+
task :config, :roles => :app do
|
105
|
+
config_system
|
106
|
+
config_project
|
107
|
+
end
|
108
|
+
|
109
|
+
desc "Push Passenger configs (system level) to server"
|
110
|
+
task :config_system, :roles => :app do
|
111
|
+
deprec2.push_configs(:passenger, SYSTEM_CONFIG_FILES[:passenger])
|
112
|
+
activate_system
|
113
|
+
end
|
114
|
+
|
115
|
+
desc "Push Passenger configs (project level) to server"
|
116
|
+
task :config_project, :roles => :app do
|
117
|
+
deprec2.push_configs(:passenger, PROJECT_CONFIG_FILES[:passenger])
|
118
|
+
symlink_apache_vhost
|
119
|
+
activate_project
|
120
|
+
symlink_logrotate_config
|
121
|
+
end
|
122
|
+
|
123
|
+
task :symlink_logrotate_config, :roles => :app do
|
124
|
+
sudo "ln -sf #{deploy_to}/passenger/logrotate.conf /etc/logrotate.d/passenger-#{application}"
|
125
|
+
end
|
126
|
+
|
127
|
+
# Passenger runs Rails as the owner of this file.
|
128
|
+
task :set_owner_of_environment_rb, :roles => :app do
|
129
|
+
sudo "chown #{app_user} #{current_path}/config/environment.rb"
|
130
|
+
end
|
131
|
+
|
132
|
+
task :symlink_apache_vhost, :roles => :app do
|
133
|
+
sudo "ln -sf #{deploy_to}/passenger/apache_vhost #{apache_vhost_dir}/#{application}"
|
134
|
+
end
|
135
|
+
|
136
|
+
task :activate, :roles => :app do
|
137
|
+
activate_system
|
138
|
+
activate_project
|
139
|
+
end
|
140
|
+
|
141
|
+
task :activate_system, :roles => :app do
|
142
|
+
sudo "a2enmod passenger"
|
143
|
+
top.deprec.web.reload
|
144
|
+
end
|
145
|
+
|
146
|
+
task :activate_project, :roles => :app do
|
147
|
+
sudo "a2ensite #{application}"
|
148
|
+
top.deprec.web.reload
|
149
|
+
end
|
150
|
+
|
151
|
+
task :deactivate do
|
152
|
+
puts
|
153
|
+
puts "******************************************************************"
|
154
|
+
puts
|
155
|
+
puts "Danger!"
|
156
|
+
puts
|
157
|
+
puts "Do you want to deactivate just this project or all Passenger"
|
158
|
+
puts "projects on this server? Try a more granular command:"
|
159
|
+
puts
|
160
|
+
puts "cap deprec:passenger:deactivate_system # disable Passenger"
|
161
|
+
puts "cap deprec:passenger:deactivate_project # disable only this project"
|
162
|
+
puts
|
163
|
+
puts "******************************************************************"
|
164
|
+
puts
|
165
|
+
end
|
166
|
+
|
167
|
+
task :deactivate_system, :roles => :app do
|
168
|
+
sudo "a2dismod passenger"
|
169
|
+
top.deprec.web.reload
|
170
|
+
end
|
171
|
+
|
172
|
+
task :deactivate_project, :roles => :app do
|
173
|
+
sudo "a2dissite #{application}"
|
174
|
+
top.deprec.web.reload
|
175
|
+
end
|
176
|
+
|
177
|
+
desc "Restart Application"
|
178
|
+
task :restart, :roles => :app do
|
179
|
+
run "#{sudo} touch #{current_path}/tmp/restart.txt"
|
180
|
+
end
|
181
|
+
|
182
|
+
desc "Restart Apache"
|
183
|
+
task :restart_apache, :roles => :passenger do
|
184
|
+
run "#{sudo} /etc/init.d/apache2 restart"
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
188
|
+
|
189
|
+
end
|
190
|
+
end
|