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,67 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :ar_sendmail do
|
5
|
+
|
6
|
+
desc "Install ar_mailer"
|
7
|
+
task :install, :roles => :app do
|
8
|
+
gem2.install 'ar_mailer'
|
9
|
+
end
|
10
|
+
|
11
|
+
# install dependencies for ar_sendmail
|
12
|
+
task :install_deps, :roles => :app do
|
13
|
+
#pass
|
14
|
+
end
|
15
|
+
|
16
|
+
PROJECT_CONFIG_FILES[:ar_sendmail] = [
|
17
|
+
|
18
|
+
{:template => 'monit.conf.erb',
|
19
|
+
:path => "monit.conf",
|
20
|
+
:mode => 0600,
|
21
|
+
:owner => 'root:root'},
|
22
|
+
|
23
|
+
{:template => 'logrotate.conf.erb',
|
24
|
+
:path => "logrotate.conf",
|
25
|
+
:mode => 0644,
|
26
|
+
:owner => 'root:root'}
|
27
|
+
]
|
28
|
+
|
29
|
+
task :config_gen do
|
30
|
+
config_gen_project
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Generate configuration file(s) for ar_sendmail from template(s)"
|
34
|
+
task :config_gen_project do
|
35
|
+
PROJECT_CONFIG_FILES[:ar_sendmail].each do |file|
|
36
|
+
deprec2.render_template(:ar_sendmail, file)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "Push ar_sendmail config files to server"
|
41
|
+
task :config, :roles => :app do
|
42
|
+
config_project
|
43
|
+
end
|
44
|
+
|
45
|
+
task :config_project, :roles => :app do
|
46
|
+
deprec2.push_configs(:ar_sendmail, PROJECT_CONFIG_FILES[:ar_sendmail])
|
47
|
+
symlink_monit_config
|
48
|
+
symlink_logrotate_config
|
49
|
+
end
|
50
|
+
|
51
|
+
task :symlink_monit_config, :roles => :app do
|
52
|
+
deprec2.mkdir(monit_confd_dir, :via => :sudo)
|
53
|
+
sudo "ln -sf #{deploy_to}/ar_sendmail/monit.conf #{monit_confd_dir}/ar_sendmail_#{application}.conf"
|
54
|
+
end
|
55
|
+
|
56
|
+
task :unlink_monit_config, :roles => :app do
|
57
|
+
link = "#{monit_confd_dir}/ar_sendmail_#{application}.conf"
|
58
|
+
sudo "test -L #{link} && unlink #{link}"
|
59
|
+
end
|
60
|
+
|
61
|
+
task :symlink_logrotate_config, :roles => :app do
|
62
|
+
sudo "ln -sf #{deploy_to}/ar_sendmail/logrotate.conf /etc/logrotate.d/ar_sendmail-#{application}"
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Copyright 2009-2010 by le1t0@github. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :aspell do
|
5
|
+
|
6
|
+
set :aspell_languages, [ :en, :fr, :de, :es ]
|
7
|
+
|
8
|
+
desc "Install ASpell"
|
9
|
+
task :install do
|
10
|
+
install_deps
|
11
|
+
end
|
12
|
+
|
13
|
+
# Install dependencies for aspell
|
14
|
+
task :install_deps do
|
15
|
+
apt.install( {:base => %w(aspell libaspell-dev libaspell15)}, :stable )
|
16
|
+
aspell_languages.each do |lang|
|
17
|
+
apt.install( {:base => "aspell-#{lang}"}, :stable )
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# Copyright 2006-2008 by Mike Bailey. All rights reserved.
|
2
|
+
# canonical.rb
|
3
|
+
#
|
4
|
+
# Running deprec:web:stop will be the same as running deprec:apache:stop or
|
5
|
+
# deprec:nginx:stop depending what you have chosen.
|
6
|
+
#
|
7
|
+
# generic namespaces are linked up to chosen applications at runtime but these
|
8
|
+
# stubs are so they'll be included in the output of "cap -T"
|
9
|
+
#
|
10
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
11
|
+
|
12
|
+
%w(ruby).each do |package|
|
13
|
+
namespace "deprec:#{package}" do
|
14
|
+
|
15
|
+
desc "Install #{package.capitalize}"
|
16
|
+
task :install do
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
%w(web app db).each do |server|
|
23
|
+
namespace "deprec:#{server}" do
|
24
|
+
|
25
|
+
desc "Install #{server.capitalize} server"
|
26
|
+
task :install, :roles => server do
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Generate config file(s) for #{server} server from template(s)"
|
30
|
+
task :config_gen do
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "Deploy configuration files(s) for #{server} server"
|
34
|
+
task :config, :roles => server do
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "Start #{server} server"
|
38
|
+
task :start, :roles => server do
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "Stop #{server} server"
|
42
|
+
task :stop, :roles => server do
|
43
|
+
end
|
44
|
+
|
45
|
+
desc "Stop #{server} server"
|
46
|
+
task :restart, :roles => server do
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "Enable startup script for #{server} server"
|
50
|
+
task :activate, :roles => server do
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "Disable startup script for #{server} server"
|
54
|
+
task :deactivate, :roles => server do
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "Backup data for #{server} server"
|
58
|
+
task :backup, :roles => server do
|
59
|
+
end
|
60
|
+
|
61
|
+
desc "Restore data for #{server} server from backup"
|
62
|
+
task :restore, :roles => server do
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Copyright 2009-2010 by le1t0@github. All rights reserved.
|
2
|
+
|
3
|
+
# might be used in other scripts as well for checking differences with deployed configs for example
|
4
|
+
# (if someone edited server configs by mistake, instead of editing inside the project)
|
5
|
+
def compare_files(local_file, remote_file)
|
6
|
+
tmp_file = File.join('/', 'tmp', "capistrano_compare_#{Time.now.strftime("%Y%m%d%H%M%S")}.tmp")
|
7
|
+
File.open(tmp_file, 'w') do |f|
|
8
|
+
run "cat #{remote_file}" do |channel, stream, data|
|
9
|
+
f.write(data)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
puts `diff #{local_file} #{tmp_file} && echo "files are the same!"`
|
14
|
+
FileUtils.rm_f(tmp_file)
|
15
|
+
end
|
16
|
+
|
17
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
18
|
+
namespace :deprec do
|
19
|
+
namespace :cap do
|
20
|
+
|
21
|
+
task :compare do
|
22
|
+
compare_files(ENV["LOCAL"], ENV["REMOTE"])
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Show Capistrano variables"
|
26
|
+
task :vars do
|
27
|
+
y variables
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "Identify which servers are going to be touched, by which user"
|
31
|
+
task :ident do
|
32
|
+
run 'whoami'
|
33
|
+
run 'ifconfig eth0 | grep "inet addr" | cut -d ":" -f 2 | cut -d " " -f 1'
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# Copyright 2006-2009 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :chef do
|
5
|
+
|
6
|
+
set(:server_fqdn) { Capistrano::CLI.ui.ask 'Enter Chef server hostname' }
|
7
|
+
set(:recipes) { "chef::#{install_type}" }
|
8
|
+
|
9
|
+
default(:install_type) do
|
10
|
+
Capistrano::CLI.ui.choose do |menu|
|
11
|
+
%w(client server).each {|c| menu.choice(c)}
|
12
|
+
menu.header = "Select Chef version to install"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Install Chef"
|
17
|
+
task :install do
|
18
|
+
config # Do this first so we can ensure we have any user input
|
19
|
+
install_deps
|
20
|
+
run_solo
|
21
|
+
top.deprec.apache.restart if install_type == 'server'
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "Run chef-solo to setup on server"
|
25
|
+
task :run_solo do
|
26
|
+
sudo 'chef-solo -c /etc/chef/solo.rb -j /etc/chef/chef.json -r http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz'
|
27
|
+
end
|
28
|
+
|
29
|
+
# Install dependencies for Chef
|
30
|
+
task :install_deps, :roles => :chef do
|
31
|
+
top.deprec.couchdb.install if install_type == 'server'
|
32
|
+
# apt.install( {:base => %w(ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb)}, :stable )
|
33
|
+
top.deprec.ruby.install
|
34
|
+
top.deprec.rubygems.install
|
35
|
+
sudo "gem sources -a http://gems.opscode.com"
|
36
|
+
sudo "gem install ohai chef --no-rdoc --no-ri"
|
37
|
+
end
|
38
|
+
|
39
|
+
SYSTEM_CONFIG_FILES[:chef] = [
|
40
|
+
|
41
|
+
{:template => "solo.rb",
|
42
|
+
:path => '/etc/chef/solo.rb',
|
43
|
+
:mode => 0644,
|
44
|
+
:owner => 'root:root'},
|
45
|
+
|
46
|
+
{:template => "chef.json.erb",
|
47
|
+
:path => '/etc/chef/chef.json',
|
48
|
+
:mode => 0644,
|
49
|
+
:owner => 'root:root'}
|
50
|
+
|
51
|
+
]
|
52
|
+
|
53
|
+
desc "Generate Chef configs (system & project level)."
|
54
|
+
task :config_gen do
|
55
|
+
SYSTEM_CONFIG_FILES[:chef].each do |file|
|
56
|
+
deprec2.render_template(:chef, file)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
desc "Push Chef config files (system & project level) to server"
|
61
|
+
task :config, :roles => :chef do
|
62
|
+
deprec2.push_configs(:chef, SYSTEM_CONFIG_FILES[:chef])
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# Copyright 2006-2009 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :collectd do
|
5
|
+
|
6
|
+
set(:collectd_server) { Capistrano::CLI.ui.ask 'Enter Collectd server hostname' }
|
7
|
+
|
8
|
+
# XXX master only
|
9
|
+
# Update libdir for libcollectdclient.so.0
|
10
|
+
# collectd-nagios is not finding it in /usr/local/lib
|
11
|
+
#
|
12
|
+
# Copy collection-php to /var/www/collectd
|
13
|
+
|
14
|
+
SRC_PACKAGES[:collectd] = {
|
15
|
+
:url => "http://collectd.org/files/collectd-4.8.1.tar.gz",
|
16
|
+
:md5sum => "7e85183a129b566383e65332d2b863c5 collectd-4.8.1.tar.gz",
|
17
|
+
:configure => "./configure --prefix=/usr/local;"
|
18
|
+
}
|
19
|
+
|
20
|
+
desc "Install collectd"
|
21
|
+
task :install, :roles => :all_hosts do
|
22
|
+
install_deps
|
23
|
+
deprec2.download_src(SRC_PACKAGES[:collectd], src_dir)
|
24
|
+
deprec2.install_from_src(SRC_PACKAGES[:collectd], src_dir)
|
25
|
+
config
|
26
|
+
activate
|
27
|
+
end
|
28
|
+
|
29
|
+
# install dependencies for sysklogd
|
30
|
+
task :install_deps, :roles => :all_hosts do
|
31
|
+
apt.install( {:base => %w(liboping-dev libcurl4-openssl-dev libperl-dev libdbi0-dev libesmtp-dev libganglia1-dev libmemcache-dev libnet1-dev libnotify-dev libopenipmi-dev liboping-dev libpcap-dev libperl-dev librrd2-dev libsensors-dev libstatgrab-dev libvirt-dev
|
32
|
+
rrdtool librrd2-dev librrds-perl libconfig-general-perl libhtml-parser-perl libregexp-common-perl)}, :stable )
|
33
|
+
end
|
34
|
+
|
35
|
+
SYSTEM_CONFIG_FILES[:collectd] = [
|
36
|
+
|
37
|
+
{:template => "collectd.conf.erb",
|
38
|
+
:path => '/usr/local/etc/collectd.conf',
|
39
|
+
:mode => 0640,
|
40
|
+
:owner => 'root:root'},
|
41
|
+
|
42
|
+
{:template => "collectd-init.d",
|
43
|
+
:path => '/etc/init.d/collectd',
|
44
|
+
:mode => 0755,
|
45
|
+
:owner => 'root:root'}
|
46
|
+
|
47
|
+
]
|
48
|
+
|
49
|
+
desc "Generate Collectd configs"
|
50
|
+
task :config_gen do
|
51
|
+
SYSTEM_CONFIG_FILES[:collectd].each do |file|
|
52
|
+
deprec2.render_template(:collectd, file)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
desc "Push Chef config files (system & project level) to server"
|
57
|
+
task :config, :roles => :all_hosts, :except => {:collectd_master => true} do
|
58
|
+
deprec2.push_configs(:collectd, SYSTEM_CONFIG_FILES[:collectd])
|
59
|
+
reload
|
60
|
+
end
|
61
|
+
|
62
|
+
desc "Start collectd"
|
63
|
+
task :start, :roles => :all_hosts, :except => { :collectd_master => true } do
|
64
|
+
run "#{sudo} /etc/init.d/collectd start"
|
65
|
+
end
|
66
|
+
|
67
|
+
desc "Stop collectd"
|
68
|
+
task :stop, :roles => :all_hosts, :except => { :collectd_master => true } do
|
69
|
+
run "#{sudo} /etc/init.d/collectd stop"
|
70
|
+
end
|
71
|
+
|
72
|
+
desc "Restart collectd"
|
73
|
+
task :restart, :roles => :all_hosts, :except => { :collectd_master => true } do
|
74
|
+
run "#{sudo} /etc/init.d/collectd restart"
|
75
|
+
end
|
76
|
+
|
77
|
+
desc "Reload collectd"
|
78
|
+
task :reload, :roles => :all_hosts, :except => { :collectd_master => true } do
|
79
|
+
run "#{sudo} /etc/init.d/collectd force-reload"
|
80
|
+
end
|
81
|
+
|
82
|
+
task :activate, :roles => :all_hosts, :except => { :collectd_master => true } do
|
83
|
+
run "#{sudo} update-rc.d collectd defaults"
|
84
|
+
end
|
85
|
+
|
86
|
+
task :deactivate, :roles => :all_hosts, :except => { :collectd_master => true }do
|
87
|
+
run "#{sudo} update-rc.d -f collectd remove"
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# latest rrdtool
|
96
|
+
# apt-get install intltool
|
97
|
+
# wget http://oss.oetiker.ch/rrdtool/pub/rrdtool.tar.gz
|
98
|
+
# tar zxf rrdtool.tar.gz
|
99
|
+
# cd rrdtool
|
100
|
+
# ./configure --prefix=/usr/local
|
101
|
+
# make
|
102
|
+
# sudo make install
|
103
|
+
#
|
104
|
+
# wget http://oss.oetiker.ch/rrdtool/pub/contrib/ruby-rrd-1.1.tar.gz
|
105
|
+
# tar zxf ruby-rrd-1.1.tar.gz
|
106
|
+
# cd ruby-rrd-1.1
|
107
|
+
# ruby extconf.rb
|
108
|
+
# make
|
109
|
+
# make install
|
110
|
+
|
111
|
+
# Ruby bindings
|
112
|
+
# RRD.so
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# Copyright 2006-2009 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :couchdb do
|
5
|
+
|
6
|
+
set :couchdb_user, 'couchdb'
|
7
|
+
|
8
|
+
SRC_PACKAGES[:couchdb] = {
|
9
|
+
:url => "http://mirror.public-internet.co.uk/ftp/apache/incubator/couchdb/0.8.0-incubating/apache-couchdb-0.8.0-incubating.tar.gz",
|
10
|
+
:md5sum => "1f915929d4f54a2e0449a4a08f093118 git-1.6.1.tar.gz"
|
11
|
+
}
|
12
|
+
|
13
|
+
desc "Install CouchDB"
|
14
|
+
task :install do
|
15
|
+
install_deps
|
16
|
+
deprec2.download_src(SRC_PACKAGES[:couchdb], src_dir)
|
17
|
+
deprec2.install_from_src(SRC_PACKAGES[:couchdb], src_dir)
|
18
|
+
create_user
|
19
|
+
setup_filepaths
|
20
|
+
activate
|
21
|
+
start
|
22
|
+
end
|
23
|
+
|
24
|
+
task :create_user, :roles => :couchdb do
|
25
|
+
deprec2.useradd(couchdb_user)
|
26
|
+
end
|
27
|
+
|
28
|
+
task :setup_filepaths, :roles => :couchdb do
|
29
|
+
sudo "mkdir -p /usr/local/var/lib/couchdb"
|
30
|
+
sudo "chown -R couchdb /usr/local/var/lib/couchdb"
|
31
|
+
sudo "mkdir -p /usr/local/var/log/couchdb"
|
32
|
+
sudo "chown -R couchdb /usr/local/var/log/couchdb"
|
33
|
+
sudo "mkdir -p /usr/local/var/run"
|
34
|
+
sudo "chown -R couchdb /usr/local/var/run"
|
35
|
+
sudo "cp /usr/local/etc/init.d/couchdb /etc/init.d/"
|
36
|
+
end
|
37
|
+
|
38
|
+
# Install dependencies for CouchDB
|
39
|
+
task :install_deps, :roles => :couchdb do
|
40
|
+
apt.install( {:base => %w(automake autoconf libtool subversion-tools help2man erlang libicu38 libicu-dev libreadline5-dev checkinstall libmozjs-dev)}, :stable )
|
41
|
+
end
|
42
|
+
|
43
|
+
SYSTEM_CONFIG_FILES[:couchdb] = []
|
44
|
+
|
45
|
+
desc "Generate CouchDB configs (system & project level)."
|
46
|
+
task :config_gen do
|
47
|
+
SYSTEM_CONFIG_FILES[:couchdb].each do |file|
|
48
|
+
deprec2.render_template(:couchdb, file)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "Push CouchDB config files (system & project level) to server"
|
53
|
+
task :config, :roles => :couchdb do
|
54
|
+
deprec2.push_configs(:couchdb, SYSTEM_CONFIG_FILES[:couchdb])
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "Set CouchDB to start on boot"
|
58
|
+
task :activate, :roles => :couchdb do
|
59
|
+
send(run_method, "update-rc.d couchdb defaults")
|
60
|
+
end
|
61
|
+
|
62
|
+
desc "Set CouchDB to not start on boot"
|
63
|
+
task :deactivate, :roles => :couchdb do
|
64
|
+
send(run_method, "update-rc.d -f couchdb remove")
|
65
|
+
end
|
66
|
+
|
67
|
+
desc "Start CouchDB"
|
68
|
+
task :start, :roles => :web do
|
69
|
+
send(run_method, "/etc/init.d/couchdb start")
|
70
|
+
end
|
71
|
+
|
72
|
+
desc "Stop CouchDB"
|
73
|
+
task :stop, :roles => :web do
|
74
|
+
send(run_method, "/etc/init.d/couchdb stop")
|
75
|
+
end
|
76
|
+
|
77
|
+
desc "Restart CouchDB"
|
78
|
+
task :restart, :roles => :web do
|
79
|
+
send(run_method, "/etc/init.d/couchdb restart")
|
80
|
+
end
|
81
|
+
|
82
|
+
desc "Reload CouchDB"
|
83
|
+
task :reload, :roles => :web do
|
84
|
+
send(run_method, "/etc/init.d/couchdb force-reload")
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# sudo apt-get install automake autoconf libtool subversion-tools help2man build-essential erlang libicu38 libicu-dev libreadline5-dev checkinstall libmozjs-dev wget
|
93
|
+
# wget http://mirror.public-internet.co.uk/ftp/apache/incubator/couchdb/0.8.0-incubating/apache-couchdb-0.8.0-incubating.tar.gz
|
94
|
+
# tar -xzvf apache-couchdb-0.8.0-incubating.tar.gz
|
95
|
+
# cd apache-couchdb-0.8.0-incubating
|
96
|
+
# ./configure
|
97
|
+
# make && sudo make install
|
98
|
+
# sudo useradd couchdb
|
99
|
+
# sudo mkdir -p /usr/local/var/lib/couchdb
|
100
|
+
# sudo chown -R couchdb /usr/local/var/lib/couchdb
|
101
|
+
# sudo mkdir -p /usr/local/var/log/couchdb
|
102
|
+
# sudo chown -R couchdb /usr/local/var/log/couchdb
|
103
|
+
# sudo mkdir -p /usr/local/var/run
|
104
|
+
# sudo chown -R couchdb /usr/local/var/run
|
105
|
+
# sudo cp /usr/local/etc/init.d/couchdb /etc/init.d/
|
106
|
+
# sudo update-rc.d couchdb defaults
|
107
|
+
# sudo /etc/init.d/couchdb start
|