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,176 @@
|
|
1
|
+
# Copyright 2009-2010 by le1t0@github. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
def glusterfs_generate_volfiles(glusterfs_exports, glusterfs_defaults, &block)
|
4
|
+
temp_dir = Time.now.strftime("/tmp/%Y%m%d%H%M%S.glusterfs.tmp")
|
5
|
+
sudo "mkdir -p #{temp_dir}"
|
6
|
+
glusterfs_exports.each do |name, cfg|
|
7
|
+
opts = [ "-n \"#{name}\"" ]
|
8
|
+
opts << ((cfg[:port] || glusterfs_defaults[:port]) ? "-p #{cfg[:port] || glusterfs_defaults[:port]}" : nil)
|
9
|
+
opts << ((cfg[:transport] || glusterfs_defaults[:transport]) ? "-t #{cfg[:transport] || glusterfs_defaults[:transport]}" : nil)
|
10
|
+
opts << ((cfg[:auth] || glusterfs_defaults[:auth]) ? "-a \"#{cfg[:auth] || glusterfs_defaults[:auth]}\"" : nil)
|
11
|
+
opts << ((cfg[:raid] || glusterfs_defaults[:raid]) ? "-r #{cfg[:raid] || glusterfs_defaults[:raid]}" : nil)
|
12
|
+
[cfg[:servers] || glusterfs_defaults[:servers]].flatten.each do |server| opts << "#{server}:#{cfg[:store_dir] || glusterfs_defaults[:store_dir]}" end
|
13
|
+
sudo "glusterfs-volgen -c #{temp_dir} #{opts.compact.join(" ")}"
|
14
|
+
yield(temp_dir, name, cfg) if block_given?
|
15
|
+
end
|
16
|
+
sudo "rm -f #{temp_dir}/*"
|
17
|
+
sudo "rmdir #{temp_dir}"
|
18
|
+
end
|
19
|
+
|
20
|
+
namespace :deprec do
|
21
|
+
namespace :glusterfs do
|
22
|
+
|
23
|
+
set :glusterfs_defaults, { }
|
24
|
+
set :glusterfs_exports, { }
|
25
|
+
|
26
|
+
SRC_PACKAGES[:glusterfs] = {
|
27
|
+
:md5sum => "e2eaf3d1e7a735ee7e7b262a46bbc75d glusterfs-3.0.4.tar.gz",
|
28
|
+
:url => "http://ftp.gluster.com/pub/gluster/glusterfs/3.0/3.0.4/glusterfs-3.0.4.tar.gz",
|
29
|
+
:configure => './configure --prefix=/usr;',
|
30
|
+
:make => 'make;',
|
31
|
+
:install => 'make install;'
|
32
|
+
}
|
33
|
+
|
34
|
+
SYSTEM_CONFIG_FILES[:glusterfs] = [
|
35
|
+
{:template => "glusterfsd-init.erb",
|
36
|
+
:path => '/etc/init.d/glusterfsd',
|
37
|
+
:mode => 0755,
|
38
|
+
:owner => 'root:root'}
|
39
|
+
]
|
40
|
+
|
41
|
+
desc "Install glusterfs (from source)"
|
42
|
+
task :install, :roles => [ :storage_client, :storage_server ] do
|
43
|
+
install_deps
|
44
|
+
deprec2.download_src(SRC_PACKAGES[:glusterfs], src_dir)
|
45
|
+
deprec2.install_from_src(SRC_PACKAGES[:glusterfs], src_dir)
|
46
|
+
end
|
47
|
+
|
48
|
+
task :install_deps, :roles => [ :storage_client, :storage_server ] do
|
49
|
+
apt.install( {:base => %w(sshfs build-essential flex bison byacc fuse-utils libfuse-dev)}, :stable )
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "Generate configuration file(s) for Glusterfs from template(s)"
|
53
|
+
task :config_gen do
|
54
|
+
SYSTEM_CONFIG_FILES[:glusterfs].each do |file|
|
55
|
+
deprec2.render_template(:glusterfs, file)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "Create glusterfs config files on server"
|
60
|
+
task :config do
|
61
|
+
config_client
|
62
|
+
config_server
|
63
|
+
end
|
64
|
+
|
65
|
+
desc "Create glusterfs client config files on server"
|
66
|
+
task :config_client, :roles => :storage_client do
|
67
|
+
sudo "mkdir -p /etc/glusterfs 2>/dev/null || exit 0"
|
68
|
+
glusterfs_generate_volfiles(glusterfs_exports, glusterfs_defaults) do |temp_dir, name, cfg|
|
69
|
+
sudo "mkdir -p #{cfg[:mount_dir] || glusterfs_defaults[:mount_dir]}"
|
70
|
+
sudo "mv #{temp_dir}/#{name}-#{cfg[:transport] || glusterfs_defaults[:transport] || 'tcp'}.vol /etc/glusterfs/"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
desc "Create glusterfs server config files on server"
|
75
|
+
task :config_server, :roles => :storage_server do
|
76
|
+
sudo "mkdir -p /etc/glusterfs 2>/dev/null || exit 0"
|
77
|
+
deprec2.push_configs(:glusterfs, SYSTEM_CONFIG_FILES[:glusterfs])
|
78
|
+
glusterfs_generate_volfiles(glusterfs_exports, glusterfs_defaults) do |temp_dir, name, cfg|
|
79
|
+
sudo "mkdir -p #{cfg[:store_dir] || glusterfs_defaults[:store_dir]}"
|
80
|
+
sudo "mv #{temp_dir}/$(ip addr | grep -o -e #{(cfg[:servers] || glusterfs_defaults[:servers]).map do |ip| "'#{ip}'" end.join(" -e ")})-#{name}-export.vol /etc/glusterfs/"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
desc "Start Glusterfs"
|
85
|
+
task :start do
|
86
|
+
start_server
|
87
|
+
start_client
|
88
|
+
end
|
89
|
+
|
90
|
+
desc "Start Glusterfs"
|
91
|
+
task :start_client, :roles => :storage_client do
|
92
|
+
glusterfs_exports.each do |name, cfg|
|
93
|
+
send(run_method, "mount #{cfg[:mount_dir] || glusterfs_defaults[:mount_dir]} || exit 0")
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
desc "Start Glusterfs"
|
98
|
+
task :start_server, :roles => :storage_server do
|
99
|
+
send(run_method, "/etc/init.d/glusterfsd start")
|
100
|
+
end
|
101
|
+
|
102
|
+
desc "Stop Glusterfs"
|
103
|
+
task :stop do
|
104
|
+
stop_client
|
105
|
+
stop_server
|
106
|
+
end
|
107
|
+
|
108
|
+
desc "Stop Glusterfs"
|
109
|
+
task :stop_client, :roles => :storage_client do
|
110
|
+
glusterfs_exports.each do |name, cfg|
|
111
|
+
send(run_method, "umount #{cfg[:mount_dir] || glusterfs_defaults[:mount_dir]} || exit 0")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
desc "Stop Glusterfs"
|
116
|
+
task :stop_server, :roles => :storage_server do
|
117
|
+
send(run_method, "/etc/init.d/glusterfsd stop")
|
118
|
+
end
|
119
|
+
|
120
|
+
desc "Restart Glusterfs"
|
121
|
+
task :restart do
|
122
|
+
restart_server
|
123
|
+
restart_client
|
124
|
+
end
|
125
|
+
|
126
|
+
desc "Restart Glusterfs"
|
127
|
+
task :restart_client do
|
128
|
+
stop_client
|
129
|
+
start_client
|
130
|
+
end
|
131
|
+
|
132
|
+
desc "Restart Glusterfs"
|
133
|
+
task :restart_server do
|
134
|
+
stop_server
|
135
|
+
start_server
|
136
|
+
end
|
137
|
+
|
138
|
+
desc "Set Glusterfs to start on boot"
|
139
|
+
task :activate do
|
140
|
+
activate_server
|
141
|
+
activate_client
|
142
|
+
end
|
143
|
+
|
144
|
+
desc "Set Glusterfs to start on boot"
|
145
|
+
task :activate_client, :roles => :storage_client do
|
146
|
+
glusterfs_exports.each do |name, cfg|
|
147
|
+
deprec2.append_to_file_if_missing('/etc/fstab', "/etc/glusterfs/#{name}-#{cfg[:transport] || glusterfs_defaults[:transport] || 'tcp'}.vol #{cfg[:mount_dir] || glusterfs_defaults[:mount_dir]} glusterfs,_netdev defaults 0 0")
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
desc "Set Glusterfs to start on boot"
|
152
|
+
task :activate_server, :roles => :storage_server do
|
153
|
+
send(run_method, "update-rc.d glusterfsd defaults")
|
154
|
+
end
|
155
|
+
|
156
|
+
desc "Set Glusterfs to not start on boot"
|
157
|
+
task :deactivate do
|
158
|
+
deactivate_server
|
159
|
+
deactivate_client
|
160
|
+
end
|
161
|
+
|
162
|
+
desc "Set Glusterfs to not start on boot"
|
163
|
+
task :deactivate_client, :roles => :storage_client do
|
164
|
+
glusterfs_exports.each do |name, cfg|
|
165
|
+
send(run_method, "perl -p -i -e 's#/etc/glusterfs/#{name}-#{cfg[:transport] || glusterfs_defaults[:transport] || 'tcp'}.vol #{cfg[:mount_dir] || glusterfs_defaults[:mount_dir]} glusterfs,_netdev defaults 0 0\\s+##' /etc/fstab")
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
desc "Set Glusterfs to not start on boot"
|
170
|
+
task :deactivate_server, :roles => :storage_server do
|
171
|
+
send(run_method, "update-rc.d -f glusterfsd remove")
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# Copyright 2010 by le1t0@github. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :god do
|
5
|
+
|
6
|
+
desc "install god"
|
7
|
+
task :install do
|
8
|
+
gem2.install 'god'
|
9
|
+
end
|
10
|
+
|
11
|
+
SYSTEM_CONFIG_FILES[:god] = [
|
12
|
+
|
13
|
+
{:template => "god-init.erb",
|
14
|
+
:path => '/etc/init.d/god',
|
15
|
+
:mode => 0755,
|
16
|
+
:owner => 'root:root'},
|
17
|
+
|
18
|
+
{:template => "god-conf.erb",
|
19
|
+
:path => '/etc/god/god.conf',
|
20
|
+
:mode => 0755,
|
21
|
+
:owner => 'root:root'}
|
22
|
+
|
23
|
+
]
|
24
|
+
|
25
|
+
desc <<-DESC
|
26
|
+
Generate god config from template. Note that this does not
|
27
|
+
push the config to the server, it merely generates required
|
28
|
+
configuration files. These should be kept under source control.
|
29
|
+
The can be pushed to the server with the :config task.
|
30
|
+
DESC
|
31
|
+
task :config_gen do
|
32
|
+
SYSTEM_CONFIG_FILES[:god].each do |file|
|
33
|
+
deprec2.render_template(:god, file)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "Push god config files to server"
|
38
|
+
task :config, :roles => :god do
|
39
|
+
sudo "install -d /etc/god/conf.d"
|
40
|
+
deprec2.push_configs(:god, SYSTEM_CONFIG_FILES[:god])
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "Start God"
|
44
|
+
task :start, :roles => :god do
|
45
|
+
send(run_method, "/etc/init.d/god start")
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "Stop God"
|
49
|
+
task :stop, :roles => :god do
|
50
|
+
send(run_method, "/etc/init.d/god stop")
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "Restart God"
|
54
|
+
task :restart, :roles => :god do
|
55
|
+
send(run_method, "/etc/init.d/god restart")
|
56
|
+
end
|
57
|
+
|
58
|
+
desc "Set God to start on boot"
|
59
|
+
task :activate, :roles => :god do
|
60
|
+
send(run_method, "update-rc.d god defaults")
|
61
|
+
end
|
62
|
+
|
63
|
+
desc "Set God to not start on boot"
|
64
|
+
task :deactivate, :roles => :god do
|
65
|
+
send(run_method, "update-rc.d -f god remove")
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# Copyright 2006-2009 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :haproxy do
|
5
|
+
|
6
|
+
SRC_PACKAGES[:haproxy] = {
|
7
|
+
:md5sum => "0d6019b79631048765a7dfd55f1875cd haproxy-1.4.0.tar.gz",
|
8
|
+
:url => "http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.0.tar.gz",
|
9
|
+
:configure => '',
|
10
|
+
:make => "TARGET=linux26"
|
11
|
+
|
12
|
+
}
|
13
|
+
|
14
|
+
desc "Install haproxy"
|
15
|
+
task :install, :roles => :haproxy do
|
16
|
+
install_deps
|
17
|
+
deprec2.download_src(SRC_PACKAGES[:haproxy], src_dir)
|
18
|
+
deprec2.install_from_src(SRC_PACKAGES[:haproxy], src_dir)
|
19
|
+
config
|
20
|
+
activate
|
21
|
+
create_check_file
|
22
|
+
end
|
23
|
+
|
24
|
+
# default config expects this file in web root
|
25
|
+
task :create_check_file, :roles => :haproxy do
|
26
|
+
sudo "test -d /var/www && #{sudo} touch /var/www/check.txt"
|
27
|
+
end
|
28
|
+
|
29
|
+
task :install_deps, :roles => :haproxy do
|
30
|
+
apt.install( {:base => %w(build-essential)}, :stable )
|
31
|
+
end
|
32
|
+
|
33
|
+
SYSTEM_CONFIG_FILES[:haproxy] = [
|
34
|
+
|
35
|
+
{:template => "haproxy.cfg.erb",
|
36
|
+
:path => '/etc/haproxy.cfg',
|
37
|
+
:mode => 0644,
|
38
|
+
:owner => 'root:root'},
|
39
|
+
|
40
|
+
{:template => "haproxy-init.d",
|
41
|
+
:path => '/etc/init.d/haproxy',
|
42
|
+
:mode => 0755,
|
43
|
+
:owner => 'root:root'}
|
44
|
+
|
45
|
+
]
|
46
|
+
|
47
|
+
PROJECT_CONFIG_FILES[:haproxy] = [
|
48
|
+
|
49
|
+
# {:template => "example.conf.erb",
|
50
|
+
# :path => 'conf/example.conf',
|
51
|
+
# :mode => 0755,
|
52
|
+
# :owner => 'root:root'}
|
53
|
+
]
|
54
|
+
|
55
|
+
desc "Generate configuration files for haproxy from template(s)"
|
56
|
+
task :config_gen do
|
57
|
+
config_gen_system
|
58
|
+
config_gen_project
|
59
|
+
end
|
60
|
+
|
61
|
+
task :config_gen_system do
|
62
|
+
SYSTEM_CONFIG_FILES[:haproxy].each do |file|
|
63
|
+
deprec2.render_template(:haproxy, file)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
task :config_gen_project do
|
68
|
+
PROJECT_CONFIG_FILES[:haproxy].each do |file|
|
69
|
+
deprec2.render_template(:haproxy, file)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
desc 'Deploy configuration filess for haproxy'
|
74
|
+
task :config, :roles => :haproxy do
|
75
|
+
config_system
|
76
|
+
# config_project
|
77
|
+
reload
|
78
|
+
end
|
79
|
+
|
80
|
+
task :config_system, :roles => :haproxy do
|
81
|
+
deprec2.push_configs(:haproxy, SYSTEM_CONFIG_FILES[:haproxy])
|
82
|
+
end
|
83
|
+
|
84
|
+
task :config_project, :roles => :haproxy do
|
85
|
+
deprec2.push_configs(:haproxy, PROJECT_CONFIG_FILES[:haproxy])
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
task :start, :roles => :haproxy do
|
90
|
+
run "#{sudo} /etc/init.d/haproxy start"
|
91
|
+
end
|
92
|
+
|
93
|
+
task :stop, :roles => :haproxy do
|
94
|
+
run "#{sudo} /etc/init.d/haproxy stop"
|
95
|
+
end
|
96
|
+
|
97
|
+
task :restart, :roles => :haproxy do
|
98
|
+
run "#{sudo} /etc/init.d/haproxy restart"
|
99
|
+
end
|
100
|
+
|
101
|
+
task :reload, :roles => :haproxy do
|
102
|
+
run "#{sudo} /etc/init.d/haproxy reload"
|
103
|
+
end
|
104
|
+
|
105
|
+
task :activate, :roles => :haproxy do
|
106
|
+
run "#{sudo} update-rc.d haproxy defaults"
|
107
|
+
end
|
108
|
+
|
109
|
+
task :deactivate, :roles => :haproxy do
|
110
|
+
run "#{sudo} update-rc.d -f haproxy remove"
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :heartbeat do
|
5
|
+
set(:heartbeat_nodes) { find_servers_for_task(current_task) }
|
6
|
+
set(:heartbeat_preferred_node) {
|
7
|
+
Capistrano::CLI.ui.choose do |menu|
|
8
|
+
heartbeat_nodes.each {|c| menu.choice(c)}
|
9
|
+
menu.header = "select preferred node"
|
10
|
+
end
|
11
|
+
}
|
12
|
+
set(:heartbeat_resources) {Capistrano::CLI.ui.ask 'Enter resource to share. e.g. an ip address'}
|
13
|
+
set(:heartbeat_auth_key) { Capistrano::CLI.ui.ask 'Enter auth key for heartbeat to use' }
|
14
|
+
set(:heartbeat_ping) { Capistrano::CLI.ui.ask 'Enter IP address nodes will ping to test connectivity. e.g. gateway address' }
|
15
|
+
set(:heartbeat_bcast) {
|
16
|
+
Capistrano::CLI.ui.ask 'Enter ethernet interface(s) Heartbeat sends UDP broadcast traffic on. e.g. eth0' do |q|
|
17
|
+
q.default = 'eth0'
|
18
|
+
end
|
19
|
+
}
|
20
|
+
set(:heartbeat_auto_failback) {
|
21
|
+
Capistrano::CLI.ui.ask 'Should resource(s) automatically fail back to its "primary" node ' do |q|
|
22
|
+
q.default = 'yes'
|
23
|
+
end
|
24
|
+
}
|
25
|
+
|
26
|
+
desc "Install Heartbeat"
|
27
|
+
task :install do
|
28
|
+
install_deps
|
29
|
+
end
|
30
|
+
|
31
|
+
# Install dependencies for heartbeat
|
32
|
+
task :install_deps do
|
33
|
+
apt.install( {:base => %w(heartbeat-2)}, :stable )
|
34
|
+
end
|
35
|
+
|
36
|
+
SYSTEM_CONFIG_FILES[:heartbeat] = [
|
37
|
+
|
38
|
+
{:template => 'ha.cf.erb',
|
39
|
+
:path => '/etc/ha.d/ha.cf',
|
40
|
+
:mode => 0644,
|
41
|
+
:owner => 'root:root'},
|
42
|
+
|
43
|
+
{:template => 'haresources.erb',
|
44
|
+
:path => '/etc/ha.d/haresources',
|
45
|
+
:mode => 0644,
|
46
|
+
:owner => 'root:root'},
|
47
|
+
|
48
|
+
{:template => 'authkeys.erb',
|
49
|
+
:path => '/etc/ha.d/authkeys',
|
50
|
+
:mode => 0600,
|
51
|
+
:owner => 'root:root'}
|
52
|
+
|
53
|
+
]
|
54
|
+
|
55
|
+
desc "Generate configuration file(s) for heartbeat from template(s)"
|
56
|
+
task :config_gen do
|
57
|
+
if ENV['ROLES']
|
58
|
+
SYSTEM_CONFIG_FILES[:heartbeat].each do |file|
|
59
|
+
file.merge!({:path => "#{file[:path]}-#{ENV['ROLES']}"})
|
60
|
+
deprec2.render_template(:heartbeat, file)
|
61
|
+
end
|
62
|
+
else
|
63
|
+
puts
|
64
|
+
puts "Whoops!"
|
65
|
+
puts
|
66
|
+
puts "You need to specify the cluster to work on by defining ROLES env variable."
|
67
|
+
puts "e.g. cap deprec:heartbeat:config ROLES=cluster_web"
|
68
|
+
puts
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
desc "Push heartbeat config files to server"
|
73
|
+
task :config do
|
74
|
+
if ENV['ROLES']
|
75
|
+
config_files = SYSTEM_CONFIG_FILES[:heartbeat].collect{|file| file.merge({:path => "#{file[:path]}-#{ENV['ROLES']}"})}
|
76
|
+
deprec2.push_configs(:heartbeat, config_files)
|
77
|
+
SYSTEM_CONFIG_FILES[:heartbeat].each {|file|
|
78
|
+
sudo "mv #{file[:path]}-#{ENV['ROLES']} #{file[:path]}"
|
79
|
+
}
|
80
|
+
# puts config_files
|
81
|
+
else
|
82
|
+
puts
|
83
|
+
puts "Whoops!"
|
84
|
+
puts
|
85
|
+
puts "You need to specify the cluster to work on by defining ROLES env variable."
|
86
|
+
puts "e.g. cap deprec:heartbeat:config ROLES=cluster_web"
|
87
|
+
puts
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
desc "Set Heartbeat to start on boot"
|
92
|
+
task :activate, :roles => :heartbeat do
|
93
|
+
send(run_method, "update-rc.d heartbeat defaults")
|
94
|
+
end
|
95
|
+
|
96
|
+
desc "Set Heartbeat to not start on boot"
|
97
|
+
task :deactivate, :roles => :heartbeat do
|
98
|
+
send(run_method, "update-rc.d -f heartbeat remove")
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
# Control
|
103
|
+
|
104
|
+
# XXX perhaps define a cluster to work with
|
105
|
+
# XXX e.g. set :cluster, 'rolename'
|
106
|
+
# XXX and then target that rolename with these tasks
|
107
|
+
|
108
|
+
desc "Start Heartbeat"
|
109
|
+
task :start, :roles => :heartbeat do
|
110
|
+
send(run_method, "/etc/init.d/heartbeat start")
|
111
|
+
end
|
112
|
+
|
113
|
+
desc "Stop Heartbeat"
|
114
|
+
task :stop, :roles => :heartbeat do
|
115
|
+
send(run_method, "/etc/init.d/heartbeat stop")
|
116
|
+
end
|
117
|
+
|
118
|
+
desc "Restart Heartbeat"
|
119
|
+
task :restart, :roles => :heartbeat do
|
120
|
+
send(run_method, "/etc/init.d/heartbeat restart")
|
121
|
+
end
|
122
|
+
|
123
|
+
desc "Reload Heartbeat"
|
124
|
+
task :reload, :roles => :heartbeat do
|
125
|
+
send(run_method, "/etc/init.d/heartbeat reload")
|
126
|
+
end
|
127
|
+
|
128
|
+
task :backup, :roles => :web do
|
129
|
+
# not yet implemented
|
130
|
+
end
|
131
|
+
|
132
|
+
task :restore, :roles => :web do
|
133
|
+
# not yet implemented
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|