Empact-deprec 1.99.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +170 -0
- data/COPYING +19 -0
- data/LICENSE +339 -0
- data/README +136 -0
- data/THANKS +5 -0
- data/bin/depify +133 -0
- data/docs/ANNOUNCE.deprec2 +47 -0
- data/docs/README.install +88 -0
- data/docs/README.nagios +28 -0
- data/docs/README.rails +20 -0
- data/docs/README.svn +31 -0
- data/docs/ROADMAP.txt +74 -0
- data/docs/deprec-1.x/deprec-1.x.quickstart +50 -0
- data/docs/deprec-1.x/notes.txt +12 -0
- data/docs/deprec_banner.gif +0 -0
- data/lib/deprec.rb +8 -0
- data/lib/deprec/capistrano_extensions.rb +378 -0
- data/lib/deprec/recipes.rb +40 -0
- data/lib/deprec/recipes/aoe.rb +117 -0
- data/lib/deprec/recipes/apache.rb +179 -0
- data/lib/deprec/recipes/ar_sendmail.rb +65 -0
- data/lib/deprec/recipes/canonical.rb +57 -0
- data/lib/deprec/recipes/deprec.rb +155 -0
- data/lib/deprec/recipes/deprecated.rb +71 -0
- data/lib/deprec/recipes/example.rb +115 -0
- data/lib/deprec/recipes/git.rb +168 -0
- data/lib/deprec/recipes/gitosis.rb +47 -0
- data/lib/deprec/recipes/god.rb +107 -0
- data/lib/deprec/recipes/heartbeat.rb +138 -0
- data/lib/deprec/recipes/iptables.rb +53 -0
- data/lib/deprec/recipes/logrotate.rb +51 -0
- data/lib/deprec/recipes/lvm.rb +20 -0
- data/lib/deprec/recipes/memcached.rb +102 -0
- data/lib/deprec/recipes/mongrel.rb +209 -0
- data/lib/deprec/recipes/monit.rb +130 -0
- data/lib/deprec/recipes/mysql.rb +115 -0
- data/lib/deprec/recipes/nagios.rb +302 -0
- data/lib/deprec/recipes/network.rb +84 -0
- data/lib/deprec/recipes/nginx.rb +154 -0
- data/lib/deprec/recipes/ntp.rb +96 -0
- data/lib/deprec/recipes/php.rb +99 -0
- data/lib/deprec/recipes/postfix.rb +105 -0
- data/lib/deprec/recipes/rails.rb +302 -0
- data/lib/deprec/recipes/ruby.rb +66 -0
- data/lib/deprec/recipes/sphinx.rb +83 -0
- data/lib/deprec/recipes/ssh.rb +93 -0
- data/lib/deprec/recipes/svn.rb +169 -0
- data/lib/deprec/recipes/swiftiply.rb +108 -0
- data/lib/deprec/recipes/thin.rb +201 -0
- data/lib/deprec/recipes/trac.rb +277 -0
- data/lib/deprec/recipes/ubuntu.rb +20 -0
- data/lib/deprec/recipes/users.rb +90 -0
- data/lib/deprec/recipes/utils.rb +39 -0
- data/lib/deprec/recipes/xen.rb +259 -0
- data/lib/deprec/templates/aoe/aoe-init +55 -0
- data/lib/deprec/templates/aoe/fence_aoemask +351 -0
- data/lib/deprec/templates/apache/httpd-vhost-app.conf.erb +144 -0
- data/lib/deprec/templates/apache/httpd.conf +465 -0
- data/lib/deprec/templates/apache/index.html.erb +37 -0
- data/lib/deprec/templates/apache/master.css +72 -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/coraid/aoe-init +55 -0
- data/lib/deprec/templates/deprec/caprc.erb +14 -0
- data/lib/deprec/templates/god/god-init-script +71 -0
- data/lib/deprec/templates/god/god-notifications +0 -0
- data/lib/deprec/templates/god/god_mongrel.erb +81 -0
- data/lib/deprec/templates/god/god_mysql.erb +50 -0
- data/lib/deprec/templates/god/god_nginx.erb +61 -0
- data/lib/deprec/templates/god/god_thin.erb +80 -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/iptables/iptables.up.erb +41 -0
- data/lib/deprec/templates/logrotate/logrotate.conf.erb +32 -0
- data/lib/deprec/templates/memcached/memcached-init-script +65 -0
- data/lib/deprec/templates/memcached/memcached.conf.erb +46 -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.logrotate.d +14 -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/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/commands.cfg.erb +240 -0
- data/lib/deprec/templates/nagios/contacts.cfg.erb +75 -0
- data/lib/deprec/templates/nagios/hosts.cfg.erb +70 -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 +208 -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 +7 -0
- data/lib/deprec/templates/nagios/templates.cfg.erb +190 -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/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 +53 -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 +45 -0
- data/lib/deprec/templates/ntp/ntp.conf.erb +42 -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 +41 -0
- data/lib/deprec/templates/postfix/master.cf.erb +77 -0
- data/lib/deprec/templates/rails/database.yml.erb +6 -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/subversion/svn.apache.vhost.erb +43 -0
- data/lib/deprec/templates/swiftiply/swiftiply-init-script +61 -0
- data/lib/deprec/templates/swiftiply/swiftiply.yml.erb +11 -0
- data/lib/deprec/templates/thin/thin-init-script +51 -0
- data/lib/deprec/templates/thin/thin.yml.erb +11 -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/xen/15-disable-hwclock +40 -0
- data/lib/deprec/templates/xen/network-bridge-wrapper +3 -0
- data/lib/deprec/templates/xen/xen-tools.conf.erb +220 -0
- data/lib/deprec/templates/xen/xend-config.sxp.erb +195 -0
- data/lib/deprec/templates/xen/xend-init.erb +69 -0
- data/lib/deprec/templates/xen/xendomains.erb +137 -0
- data/lib/deprec/templates/xen/xm.tmpl.erb +85 -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 +90 -0
- data/lib/vmbuilder_plugins/std.rb +203 -0
- metadata +207 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
|
3
|
+
namespace :deprec do
|
|
4
|
+
namespace :gitosis do
|
|
5
|
+
|
|
6
|
+
# ref: http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
|
|
7
|
+
|
|
8
|
+
set :gitosis_user, 'git'
|
|
9
|
+
|
|
10
|
+
desc "Install git"
|
|
11
|
+
task :install do
|
|
12
|
+
deprec2.create_src_dir
|
|
13
|
+
install_deps
|
|
14
|
+
run <<-SUDO
|
|
15
|
+
cd #{src_dir} && test -d gitosis || #{sudo} git clone git://eagain.net/gitosis.git; exit 0
|
|
16
|
+
SUDO
|
|
17
|
+
run "cd #{src_dir}/gitosis && #{sudo} python setup.py install"
|
|
18
|
+
create_user
|
|
19
|
+
init
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# install dependencies for nginx
|
|
23
|
+
task :install_deps do
|
|
24
|
+
apt.install( {:base => %w(python-setuptools)}, :stable )
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Create user for gitosis to run as
|
|
28
|
+
# This will also be the account you use for ssh access to git
|
|
29
|
+
task :create_user do
|
|
30
|
+
run "grep '^#{gitosis_user}:' /etc/passwd || #{sudo} adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /home/#{gitosis_user} #{gitosis_user}"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
task :init do
|
|
34
|
+
sudo "sudo -H -u #{git_user} gitosis-init < ~/.ssh/authorized_keys"
|
|
35
|
+
sudo "chmod 0755 /home/git/repositories/gitosis-admin.git/hooks/post-update"
|
|
36
|
+
puts
|
|
37
|
+
puts "Now check out the gitosis-admin repos, edit configs and push changes back"
|
|
38
|
+
puts "Your changes with update gitosis as soon as they are checked in."
|
|
39
|
+
puts
|
|
40
|
+
puts "git clone git@YOUR_SERVER_HOSTNAME:gitosis-admin.git"
|
|
41
|
+
puts "cd gitosis-admin"
|
|
42
|
+
puts ""
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
|
3
|
+
namespace :deprec do namespace :god do
|
|
4
|
+
|
|
5
|
+
set :god_user, 'god'
|
|
6
|
+
set :god_group, 'god'
|
|
7
|
+
set :god_confd_dir, '/home/techimp/testing/etc/god'
|
|
8
|
+
|
|
9
|
+
set :god_check_interval, 60
|
|
10
|
+
set :god_log, 'syslog facility log_daemon'
|
|
11
|
+
set :god_mailserver, nil
|
|
12
|
+
set :god_mail_from, 'god@deprec.enabled.slice'
|
|
13
|
+
set :god_alert_recipients, %w(root@localhost)
|
|
14
|
+
set :god_timeout_recipients, %w(root@localhost)
|
|
15
|
+
set :god_webserver_enabled, true
|
|
16
|
+
set :god_webserver_port, 2812
|
|
17
|
+
set :god_webserver_address, 'localhost'
|
|
18
|
+
set :god_webserver_allowed_hosts_and_networks, %w(localhost)
|
|
19
|
+
set :god_webserver_auth_user, 'admin'
|
|
20
|
+
set :god_webserver_auth_pass, 'god'
|
|
21
|
+
|
|
22
|
+
desc "Install god"
|
|
23
|
+
task :install do
|
|
24
|
+
# install_deps
|
|
25
|
+
gem2.install 'god'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
task :install_deps do
|
|
29
|
+
# there are no dependencies for god
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
SYSTEM_CONFIG_FILES[:god] = [
|
|
33
|
+
|
|
34
|
+
{:template => 'god-init-script',
|
|
35
|
+
:path => '/home/techimp/testing/etc/init.d/god',
|
|
36
|
+
:mode => 0755,
|
|
37
|
+
:owner => 'root:root'},
|
|
38
|
+
|
|
39
|
+
{:template => 'nothing',
|
|
40
|
+
:path => "/home/techimp/testing/etc/god/nothing",
|
|
41
|
+
:mode => 0700,
|
|
42
|
+
:owner => 'root:root'}
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
desc <<-DESC
|
|
46
|
+
Generate nginx config from template. Note that this does not
|
|
47
|
+
push the config to the server, it merely generates required
|
|
48
|
+
configuration files. These should be kept under source control.
|
|
49
|
+
The can be pushed to the server with the :config task.
|
|
50
|
+
DESC
|
|
51
|
+
task :config_gen do
|
|
52
|
+
SYSTEM_CONFIG_FILES[:god].each do |file|
|
|
53
|
+
deprec2.render_template(:god, file)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
desc "Push god config files to server"
|
|
58
|
+
task :config do
|
|
59
|
+
deprec2.push_configs(:god, SYSTEM_CONFIG_FILES[:god])
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
desc "Start god"
|
|
63
|
+
task :start, :roles => :app do
|
|
64
|
+
send(run_method, "/home/techimp/testing/etc/init.d/god start")
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
desc "Stop god"
|
|
68
|
+
task :stop, :roles => :app do
|
|
69
|
+
send(run_method, "/home/techimp/testing/etc/init.d/god stop")
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
desc "Restart god"
|
|
73
|
+
task :restart, :roles => :app do
|
|
74
|
+
send(run_method, "/home/techimp/testing/etc/init.d/god restart")
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
desc "Reload god"
|
|
78
|
+
task :reload, :roles => :app do
|
|
79
|
+
send(run_method, "/home/techimp/testing/etc/init.d/god reload")
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
desc <<-DESC
|
|
83
|
+
Activate god start scripts on server.
|
|
84
|
+
Setup server to start god on boot.
|
|
85
|
+
DESC
|
|
86
|
+
task :activate do
|
|
87
|
+
send(run_method, "update-rc.d god defaults")
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
desc <<-DESC
|
|
91
|
+
Dectivate god start scripts on server.
|
|
92
|
+
Setup server to start god on boot.
|
|
93
|
+
DESC
|
|
94
|
+
task :deactivate do
|
|
95
|
+
send(run_method, "update-rc.d -f god remove")
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
task :backup do
|
|
99
|
+
# there's nothing to backup for god
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
task :restore do
|
|
103
|
+
# there's nothing to restore for god
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
end end
|
|
107
|
+
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
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
|
3
|
+
namespace :deprec do
|
|
4
|
+
namespace :iptables do
|
|
5
|
+
|
|
6
|
+
set(:ssh_port) {
|
|
7
|
+
Capistrano::CLI.ui.ask "ssh port"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
set(:port_list) {(Capistrano::CLI.ui.ask "Enter a comma separated list of ports to ALLOW").split(',')}
|
|
11
|
+
|
|
12
|
+
set(:iptables_rules) {'/etc/iptables.up.rules'}
|
|
13
|
+
set(:interfaces) {'/etc/network/interfaces'}
|
|
14
|
+
|
|
15
|
+
SYSTEM_CONFIG_FILES[:iptables] = [
|
|
16
|
+
|
|
17
|
+
{:template => "iptables.up.erb",
|
|
18
|
+
:path => '/etc/iptables.up.rules',
|
|
19
|
+
:mode => 0644,
|
|
20
|
+
:owner => 'root:root'}
|
|
21
|
+
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
desc "Generate configuration file(s) for memcached"
|
|
25
|
+
task :config_gen do
|
|
26
|
+
SYSTEM_CONFIG_FILES[:iptables].each do |file|
|
|
27
|
+
deprec2.render_template(:iptables, file)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
desc 'Deploy configuration files(s) for iptables configuration'
|
|
32
|
+
task :config do
|
|
33
|
+
deprec2.push_configs(:iptables, SYSTEM_CONFIG_FILES[:iptables])
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
desc "Generate configuration file(s) for tables"
|
|
37
|
+
task :config_gen do
|
|
38
|
+
SYSTEM_CONFIG_FILES[:iptables].each do |file|
|
|
39
|
+
deprec2.render_template(:iptables, file)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
desc "Load iptables rules and restart networking"
|
|
44
|
+
task :activate_system do
|
|
45
|
+
deprec2.append_to_file_if_missing(interfaces, "pre-up iptables-restore #{iptables_rules}")
|
|
46
|
+
sudo "/etc/init.d/networking restart"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
|
3
|
+
namespace :deprec do
|
|
4
|
+
namespace :logrotate do
|
|
5
|
+
|
|
6
|
+
# Install
|
|
7
|
+
|
|
8
|
+
desc "Install logrotate"
|
|
9
|
+
task :install do
|
|
10
|
+
install_deps
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# install dependencies for nginx
|
|
14
|
+
task :install_deps do
|
|
15
|
+
apt.install( {:base => %w(logrotate)}, :stable )
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Configure
|
|
19
|
+
|
|
20
|
+
SYSTEM_CONFIG_FILES[:logrotate] = [
|
|
21
|
+
|
|
22
|
+
{:template => 'logrotate.conf.erb',
|
|
23
|
+
:path => '/etc/logrotate.conf',
|
|
24
|
+
:mode => 0755,
|
|
25
|
+
:owner => 'root:root'}
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
desc "Generate logrotate config from template."
|
|
29
|
+
task :config_gen do
|
|
30
|
+
SYSTEM_CONFIG_FILES[:logrotate].each do |file|
|
|
31
|
+
deprec2.render_template(:logrotate, file)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
desc "Push logrotate config files to server"
|
|
36
|
+
task :config do
|
|
37
|
+
deprec2.push_configs(:logrotate, SYSTEM_CONFIG_FILES[:logrotate])
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Control
|
|
41
|
+
#
|
|
42
|
+
# logrotate is run via cron with a script in /etc/cron.daily/logrotate
|
|
43
|
+
|
|
44
|
+
desc "Force logrotate to run"
|
|
45
|
+
task :force do
|
|
46
|
+
sudo "logrotate -f /etc/logrotate.conf"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
|
3
|
+
namespace :deprec do
|
|
4
|
+
namespace :lvm do
|
|
5
|
+
|
|
6
|
+
task :pvdisplay do
|
|
7
|
+
sudo "pvdisplay"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
task :vgdisplay do
|
|
11
|
+
sudo "vgdisplay"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
task :lvdisplay do
|
|
15
|
+
sudo "lvdisplay"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
|
3
|
+
namespace :deprec do
|
|
4
|
+
namespace :memcached do
|
|
5
|
+
set :memcached_port, 11211
|
|
6
|
+
set :memcached_address, "127.0.0.1"
|
|
7
|
+
set :memcached_cache_size, 64
|
|
8
|
+
set :memcached_user, "memcached"
|
|
9
|
+
set :memcached_group, "memcached"
|
|
10
|
+
set :memcached_pid_file, "/var/run/memcached.pid"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
SRC_PACKAGES[:memcached] = {
|
|
14
|
+
:filename => "memcached-1.2.5.tar.gz",
|
|
15
|
+
:md5sum => "8ac0d1749ded88044f0f850fad979e4d memcached-1.2.5.tar.gz",
|
|
16
|
+
:dir => "memcached-1.2.5",
|
|
17
|
+
:url => "http://danga.com/memcached/dist/memcached-1.2.5.tar.gz",
|
|
18
|
+
:unpack => "tar zxf memcached-1.2.5.tar.gz;",
|
|
19
|
+
:configure => %w(
|
|
20
|
+
./configure
|
|
21
|
+
--prefix=/usr/local
|
|
22
|
+
;
|
|
23
|
+
).reject{|arg| arg.match '#'}.join(' '),
|
|
24
|
+
:make => 'make;',
|
|
25
|
+
:install => 'make install;',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
desc "Install memcached"
|
|
29
|
+
task :install, :roles => :db do
|
|
30
|
+
install_deps
|
|
31
|
+
deprec2.download_src(SRC_PACKAGES[:memcached], src_dir)
|
|
32
|
+
deprec2.install_from_src(SRC_PACKAGES[:memcached], src_dir)
|
|
33
|
+
|
|
34
|
+
deprec2.groupadd(memcached_group)
|
|
35
|
+
deprec2.useradd(memcached_user, :group => memcached_group, :homedir => false)
|
|
36
|
+
# Set the primary group for the thin user (in case user already existed
|
|
37
|
+
# when previous command was run)
|
|
38
|
+
sudo "usermod --gid #{memcached_group} #{memcached_user}"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
task :install_deps do
|
|
42
|
+
apt.install( {:base => %w(libevent-dev)}, :stable )
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
SYSTEM_CONFIG_FILES[:memcached] = [
|
|
46
|
+
|
|
47
|
+
{:template => "memcached-init-script",
|
|
48
|
+
:path => '/etc/init.d/memcached',
|
|
49
|
+
:mode => 0755,
|
|
50
|
+
:owner => 'root:root'},
|
|
51
|
+
|
|
52
|
+
{:template => "memcached.conf.erb",
|
|
53
|
+
:path => '/etc/memcached/memcached.conf',
|
|
54
|
+
:mode => 0755,
|
|
55
|
+
:owner => 'root:root'}
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
desc "Generate configuration file(s) for memcached"
|
|
59
|
+
task :config_gen do
|
|
60
|
+
SYSTEM_CONFIG_FILES[:memcached].each do |file|
|
|
61
|
+
deprec2.render_template(:memcached, file)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
desc 'Deploy configuration files(s) for memcached'
|
|
66
|
+
task :config, :roles => [:db, :app] do
|
|
67
|
+
deprec2.push_configs(:memcached, SYSTEM_CONFIG_FILES[:memcached])
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
task :start, :roles => :db do
|
|
71
|
+
send(run_method, "/etc/init.d/memcached start")
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
task :stop, :roles => :db do
|
|
75
|
+
send(run_method, "/etc/init.d/memcached stop")
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
task :restart, :roles => :db do
|
|
79
|
+
send(run_method, "/etc/init.d/memcached restart")
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
task :reload, :roles => :db do
|
|
83
|
+
send(run_method, "/etc/init.d/memcached reload")
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
task :activate, :roles => :db do
|
|
87
|
+
send(run_method, "update-rc.d memcached defaults")
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
task :deactivate, :roles => :db do
|
|
91
|
+
send(run_method, "update-rc.d -f memcached remove")
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
task :backup, :roles => :db do
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
task :restore, :roles => :db do
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|