le1t0-deprec 2.1.6.001

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. data/CHANGELOG +444 -0
  2. data/COPYING +19 -0
  3. data/LICENSE +339 -0
  4. data/README +154 -0
  5. data/THANKS +17 -0
  6. data/bin/depify +139 -0
  7. data/docs/EXAMPLE-installing_tracks.txt +41 -0
  8. data/docs/README.nagios +22 -0
  9. data/docs/README.rails +17 -0
  10. data/docs/config_gen_explained.txt +39 -0
  11. data/docs/deprec-1.x/deprec-1.x.quickstart +50 -0
  12. data/docs/deprec-1.x/notes.txt +12 -0
  13. data/docs/old/deprec_banner.gif +0 -0
  14. data/docs/windows_linux.txt +350 -0
  15. data/docs/xen/traffic_monitoring_with_vnstat.txt +95 -0
  16. data/docs/xen/xen-tools-notes.txt +31 -0
  17. data/docs/xen/xen_on_hardy.txt +39 -0
  18. data/lib/deprec.rb +42 -0
  19. data/lib/deprec/capistrano_extensions.rb +446 -0
  20. data/lib/deprec/recipes.rb +7 -0
  21. data/lib/deprec/recipes/aoe.rb +79 -0
  22. data/lib/deprec/recipes/app/mongrel.rb +213 -0
  23. data/lib/deprec/recipes/app/passenger.rb +190 -0
  24. data/lib/deprec/recipes/ar_sendmail.rb +67 -0
  25. data/lib/deprec/recipes/aspell.rb +22 -0
  26. data/lib/deprec/recipes/canonical.rb +68 -0
  27. data/lib/deprec/recipes/cap.rb +39 -0
  28. data/lib/deprec/recipes/chef.rb +68 -0
  29. data/lib/deprec/recipes/collectd.rb +112 -0
  30. data/lib/deprec/recipes/db/couchdb.rb +107 -0
  31. data/lib/deprec/recipes/db/mysql.rb +194 -0
  32. data/lib/deprec/recipes/db/postgresql.rb +104 -0
  33. data/lib/deprec/recipes/db/sqlite.rb +37 -0
  34. data/lib/deprec/recipes/ddclient.rb +51 -0
  35. data/lib/deprec/recipes/deprec.rb +167 -0
  36. data/lib/deprec/recipes/deprecated.rb +71 -0
  37. data/lib/deprec/recipes/drbd.rb +137 -0
  38. data/lib/deprec/recipes/dummy.rb +22 -0
  39. data/lib/deprec/recipes/example.rb +115 -0
  40. data/lib/deprec/recipes/git.rb +97 -0
  41. data/lib/deprec/recipes/gitosis.rb.disabled +55 -0
  42. data/lib/deprec/recipes/glusterfs.rb +176 -0
  43. data/lib/deprec/recipes/god.rb +70 -0
  44. data/lib/deprec/recipes/haproxy.rb +115 -0
  45. data/lib/deprec/recipes/heartbeat.rb +138 -0
  46. data/lib/deprec/recipes/imagemagick/imagemagick_bin.rb +24 -0
  47. data/lib/deprec/recipes/imagemagick/imagemagick_src.rb +39 -0
  48. data/lib/deprec/recipes/integrity.rb +108 -0
  49. data/lib/deprec/recipes/iptables.rb +94 -0
  50. data/lib/deprec/recipes/java.rb +23 -0
  51. data/lib/deprec/recipes/keepalived.rb +78 -0
  52. data/lib/deprec/recipes/ldap.rb +52 -0
  53. data/lib/deprec/recipes/logrotate.rb +56 -0
  54. data/lib/deprec/recipes/lvm.rb +20 -0
  55. data/lib/deprec/recipes/memcache.rb +49 -0
  56. data/lib/deprec/recipes/mongodb.rb +94 -0
  57. data/lib/deprec/recipes/monit.rb +135 -0
  58. data/lib/deprec/recipes/mysql_proxy.rb +67 -0
  59. data/lib/deprec/recipes/nagios.rb +361 -0
  60. data/lib/deprec/recipes/network.rb +116 -0
  61. data/lib/deprec/recipes/ntp.rb +103 -0
  62. data/lib/deprec/recipes/php.rb +58 -0
  63. data/lib/deprec/recipes/postfix.rb +115 -0
  64. data/lib/deprec/recipes/profiles.rb +125 -0
  65. data/lib/deprec/recipes/raid/amcc_3ware.rb +21 -0
  66. data/lib/deprec/recipes/rails.rb +330 -0
  67. data/lib/deprec/recipes/redhat_cluster.rb +228 -0
  68. data/lib/deprec/recipes/redis.rb +90 -0
  69. data/lib/deprec/recipes/ruby/mri.rb +55 -0
  70. data/lib/deprec/recipes/ruby/ree.rb +40 -0
  71. data/lib/deprec/recipes/rvm.rb +32 -0
  72. data/lib/deprec/recipes/s3utils.rb +63 -0
  73. data/lib/deprec/recipes/sphinx/thinking_sphinx.rb +105 -0
  74. data/lib/deprec/recipes/sphinx/ultrasphinx.rb +86 -0
  75. data/lib/deprec/recipes/ssh.rb +147 -0
  76. data/lib/deprec/recipes/ssl.rb +56 -0
  77. data/lib/deprec/recipes/starling.rb +119 -0
  78. data/lib/deprec/recipes/svn.rb +171 -0
  79. data/lib/deprec/recipes/syslog.rb +63 -0
  80. data/lib/deprec/recipes/trac.rb.disabled +277 -0
  81. data/lib/deprec/recipes/tsung.rb +74 -0
  82. data/lib/deprec/recipes/ubuntu.rb +90 -0
  83. data/lib/deprec/recipes/users.rb +90 -0
  84. data/lib/deprec/recipes/utils.rb +58 -0
  85. data/lib/deprec/recipes/vnstat.rb +85 -0
  86. data/lib/deprec/recipes/web/apache.rb +143 -0
  87. data/lib/deprec/recipes/web/nginx.rb +172 -0
  88. data/lib/deprec/recipes/wordpress.rb.notworking +96 -0
  89. data/lib/deprec/recipes/wpmu.rb +103 -0
  90. data/lib/deprec/recipes/xen.rb +364 -0
  91. data/lib/deprec/recipes/xentools.rb +101 -0
  92. data/lib/deprec/recipes_minus_rails.rb +125 -0
  93. data/lib/deprec/templates/aoe/aoe-init +55 -0
  94. data/lib/deprec/templates/aoe/fence_aoemask +351 -0
  95. data/lib/deprec/templates/apache/namevirtualhosts.conf +5 -0
  96. data/lib/deprec/templates/apache/ports.conf.erb +5 -0
  97. data/lib/deprec/templates/apache/status.conf.erb +17 -0
  98. data/lib/deprec/templates/ar_sendmail/logrotate.conf.erb +9 -0
  99. data/lib/deprec/templates/ar_sendmail/monit.conf.erb +5 -0
  100. data/lib/deprec/templates/chef/chef.json.erb +1 -0
  101. data/lib/deprec/templates/chef/solo.rb +2 -0
  102. data/lib/deprec/templates/collectd/collectd-init.d +153 -0
  103. data/lib/deprec/templates/collectd/collectd.conf.erb +686 -0
  104. data/lib/deprec/templates/ddclient/ddclient.conf.erb +11 -0
  105. data/lib/deprec/templates/ddclient/ddclient.erb +15 -0
  106. data/lib/deprec/templates/deprec/caprc.erb +14 -0
  107. data/lib/deprec/templates/drbd/drbd.conf.erb +531 -0
  108. data/lib/deprec/templates/glusterfs/glusterfsd-init.erb +95 -0
  109. data/lib/deprec/templates/gnbd_client/cluster.conf.erb +21 -0
  110. data/lib/deprec/templates/gnbd_client/clvm-default.erb +3 -0
  111. data/lib/deprec/templates/gnbd_client/cman-default.erb +6 -0
  112. data/lib/deprec/templates/gnbd_client/gnbdimports.conf.erb +1 -0
  113. data/lib/deprec/templates/gnbd_server/cluster.conf.erb +20 -0
  114. data/lib/deprec/templates/gnbd_server/clvm-default.erb +3 -0
  115. data/lib/deprec/templates/gnbd_server/cman-default.erb +6 -0
  116. data/lib/deprec/templates/gnbd_server/gnbd-server-default.erb +1 -0
  117. data/lib/deprec/templates/gnbd_server/gnbdexports.conf.erb +1 -0
  118. data/lib/deprec/templates/god/god-conf.erb +2 -0
  119. data/lib/deprec/templates/god/god-init.erb +47 -0
  120. data/lib/deprec/templates/haproxy/haproxy-init.d +120 -0
  121. data/lib/deprec/templates/haproxy/haproxy.cfg.erb +31 -0
  122. data/lib/deprec/templates/heartbeat/authkeys.erb +2 -0
  123. data/lib/deprec/templates/heartbeat/ha.cf.erb +15 -0
  124. data/lib/deprec/templates/heartbeat/haresources.erb +1 -0
  125. data/lib/deprec/templates/integrity/apache_vhost.erb +4 -0
  126. data/lib/deprec/templates/integrity/config.ru.erb +21 -0
  127. data/lib/deprec/templates/integrity/config.yml.erb +43 -0
  128. data/lib/deprec/templates/iptables/firewall-default.erb +13 -0
  129. data/lib/deprec/templates/iptables/firewall-init.erb +171 -0
  130. data/lib/deprec/templates/keepalived/keepalived.conf.erb +18 -0
  131. data/lib/deprec/templates/logrotate/logrotate.conf.erb +32 -0
  132. data/lib/deprec/templates/mongodb/mongodb-init.d +88 -0
  133. data/lib/deprec/templates/mongrel/apache_vhost.conf.erb +148 -0
  134. data/lib/deprec/templates/mongrel/logrotate.conf.erb +11 -0
  135. data/lib/deprec/templates/mongrel/mongrel_cluster-init-script +54 -0
  136. data/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb +10 -0
  137. data/lib/deprec/templates/mongrel/monit.conf.erb +17 -0
  138. data/lib/deprec/templates/mongrel/nginx_vhost.conf.erb +41 -0
  139. data/lib/deprec/templates/monit/monit-init-script +104 -0
  140. data/lib/deprec/templates/monit/monitrc.erb +250 -0
  141. data/lib/deprec/templates/monit/nothing.monitrc +0 -0
  142. data/lib/deprec/templates/mysql/create_databases.sql +20 -0
  143. data/lib/deprec/templates/mysql/database.yml.prod +6 -0
  144. data/lib/deprec/templates/mysql/database.yml.stage +6 -0
  145. data/lib/deprec/templates/mysql/my.cnf.erb +140 -0
  146. data/lib/deprec/templates/mysql/sphinx.conf.prod +542 -0
  147. data/lib/deprec/templates/mysql/sphinx.conf.stage +542 -0
  148. data/lib/deprec/templates/mysql_proxy/mysql-proxy-default.erb +4 -0
  149. data/lib/deprec/templates/nagios/README +32 -0
  150. data/lib/deprec/templates/nagios/cgi.cfg.erb +357 -0
  151. data/lib/deprec/templates/nagios/check_linux_free_memory.pl +118 -0
  152. data/lib/deprec/templates/nagios/check_mongrel_cluster.rb +82 -0
  153. data/lib/deprec/templates/nagios/htpasswd.users +1 -0
  154. data/lib/deprec/templates/nagios/mrtg.cfg +180 -0
  155. data/lib/deprec/templates/nagios/nagios.cfg.erb +1325 -0
  156. data/lib/deprec/templates/nagios/nrpe.cfg.erb +222 -0
  157. data/lib/deprec/templates/nagios/nrpe.xinetd.erb +16 -0
  158. data/lib/deprec/templates/nagios/objects/commands.cfg.erb +265 -0
  159. data/lib/deprec/templates/nagios/objects/contacts.cfg.erb +89 -0
  160. data/lib/deprec/templates/nagios/objects/hosts.cfg.erb +114 -0
  161. data/lib/deprec/templates/nagios/objects/localhost.cfg.erb +116 -0
  162. data/lib/deprec/templates/nagios/objects/services.cfg.erb +165 -0
  163. data/lib/deprec/templates/nagios/objects/timeperiods.cfg.erb +94 -0
  164. data/lib/deprec/templates/nagios/resource.cfg.erb +34 -0
  165. data/lib/deprec/templates/network/hostname.erb +1 -0
  166. data/lib/deprec/templates/network/hosts.erb +2 -0
  167. data/lib/deprec/templates/network/interfaces.erb +18 -0
  168. data/lib/deprec/templates/network/resolv.conf.erb +6 -0
  169. data/lib/deprec/templates/nginx/logrotate.conf.erb +13 -0
  170. data/lib/deprec/templates/nginx/mime.types.erb +70 -0
  171. data/lib/deprec/templates/nginx/nginx-init-script +62 -0
  172. data/lib/deprec/templates/nginx/nginx.conf.erb +125 -0
  173. data/lib/deprec/templates/nginx/nginx.logrotate.d +12 -0
  174. data/lib/deprec/templates/nginx/nothing.conf +1 -0
  175. data/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb +41 -0
  176. data/lib/deprec/templates/ntp/ntp.conf.erb +42 -0
  177. data/lib/deprec/templates/passenger/apache_vhost.erb +29 -0
  178. data/lib/deprec/templates/passenger/logrotate.conf.erb +12 -0
  179. data/lib/deprec/templates/passenger/passenger.conf.erb +21 -0
  180. data/lib/deprec/templates/passenger/passenger.load.erb +3 -0
  181. data/lib/deprec/templates/postfix/aliases.erb +3 -0
  182. data/lib/deprec/templates/postfix/dynamicmaps.cf.erb +8 -0
  183. data/lib/deprec/templates/postfix/main.cf.erb +36 -0
  184. data/lib/deprec/templates/postfix/master.cf.erb +77 -0
  185. data/lib/deprec/templates/redis/redis-conf.erb +132 -0
  186. data/lib/deprec/templates/redis/redis-init.erb +50 -0
  187. data/lib/deprec/templates/s3utils/s3cfg +35 -0
  188. data/lib/deprec/templates/s3utils/s3config.yml +3 -0
  189. data/lib/deprec/templates/sphinx/monit.conf.erb +5 -0
  190. data/lib/deprec/templates/ssh/ssh_config.erb +50 -0
  191. data/lib/deprec/templates/ssh/sshd_config.erb +78 -0
  192. data/lib/deprec/templates/ssl/make-ssl-cert +138 -0
  193. data/lib/deprec/templates/ssl/ssl-cert-snakeoil.key +15 -0
  194. data/lib/deprec/templates/ssl/ssl-cert-snakeoil.pem +19 -0
  195. data/lib/deprec/templates/starling/monit.conf.erb +14 -0
  196. data/lib/deprec/templates/starling/starling-init-script.erb +71 -0
  197. data/lib/deprec/templates/subversion/svn.apache.vhost.erb +43 -0
  198. data/lib/deprec/templates/syslog/syslog.conf.erb +71 -0
  199. data/lib/deprec/templates/syslog/syslogd.erb +13 -0
  200. data/lib/deprec/templates/trac/apache_vhost.conf.erb +24 -0
  201. data/lib/deprec/templates/trac/nginx_vhost.conf.erb +26 -0
  202. data/lib/deprec/templates/trac/trac.ini.erb +169 -0
  203. data/lib/deprec/templates/trac/trac_deprec.png +0 -0
  204. data/lib/deprec/templates/trac/tracd-init.erb +43 -0
  205. data/lib/deprec/templates/trac/users.htdigest.erb +0 -0
  206. data/lib/deprec/templates/tsung/tsung.xml.erb +47 -0
  207. data/lib/deprec/templates/vnstat/config.php +57 -0
  208. data/lib/deprec/templates/wordpress/apache2_wordpress_vhost.conf.erb +31 -0
  209. data/lib/deprec/templates/wordpress/wp-config.php.erb +31 -0
  210. data/lib/deprec/templates/wpmu/apache_vhost.conf.erb +13 -0
  211. data/lib/deprec/templates/xen/network-bridge-wrapper +3 -0
  212. data/lib/deprec/templates/xen/xend-config.sxp.erb +195 -0
  213. data/lib/deprec/templates/xen/xend-init.erb +57 -0
  214. data/lib/deprec/templates/xen/xendomains.erb +137 -0
  215. data/lib/deprec/templates/xentools/100-ubuntu-setup +26 -0
  216. data/lib/deprec/templates/xentools/15-disable-hwclock +40 -0
  217. data/lib/deprec/templates/xentools/30-disable-gettys +57 -0
  218. data/lib/deprec/templates/xentools/31-ubuntu-setup +32 -0
  219. data/lib/deprec/templates/xentools/40-setup-networking +145 -0
  220. data/lib/deprec/templates/xentools/98-custom +17 -0
  221. data/lib/deprec/templates/xentools/xen-tools.conf.erb +278 -0
  222. data/lib/deprec/templates/xentools/xm.tmpl.erb +138 -0
  223. data/lib/deprec_cmd_completion.sh +26 -0
  224. data/lib/deprec_minus_rails.rb +12 -0
  225. data/lib/vmbuilder_plugins/all.rb +20 -0
  226. data/lib/vmbuilder_plugins/apt.rb +93 -0
  227. data/lib/vmbuilder_plugins/emerge.rb +76 -0
  228. data/lib/vmbuilder_plugins/gem.rb +100 -0
  229. data/lib/vmbuilder_plugins/std.rb +203 -0
  230. metadata +304 -0
@@ -0,0 +1,24 @@
1
+ # Copyright 2009-2010 by le1t0@github. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :imagemagick_bin do
5
+
6
+ set :imagemagick_include_rmagick, false
7
+
8
+ desc "Install imagemagick & rmagick"
9
+ task :install, :roles => :app do
10
+ uninstall # make sure package is uninstalled (if there is any), before attempting source uninstall, since source
11
+ # uninstall would also remove binary package files
12
+ top.deprec.imagemagick_src.uninstall
13
+ apt.install( {:base => %w(imagemagick libmagick9-dev libmagick10)}, :stable )
14
+ gem2.install 'rmagick' if imagemagick_include_rmagick
15
+ end
16
+
17
+ task :uninstall, :roles => :app do
18
+ gem2.uninstall 'rmagick' if imagemagick_include_rmagick
19
+ apt.install( {:base => %w(imagemagick- libmagick9-dev- libmagick10-)}, :stable )
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,39 @@
1
+ # Copyright 2009-2010 by le1t0@github. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :imagemagick_src do
5
+
6
+ SRC_PACKAGES[:imagemagick] = {
7
+ :md5sum => "46c3e5aa967dcd821bd8de1904ecba52 ImageMagick-6.5.9-10.tar.gz",
8
+ :url => "ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.5.9-10.tar.gz",
9
+ :configure => "./configure --prefix=/usr ;"
10
+ }
11
+
12
+ set :imagemagick_include_rmagick, false
13
+
14
+ desc "Install imagemagick & rmagick"
15
+ task :install, :roles => :app do
16
+ top.deprec.imagemagick_bin.uninstall
17
+ install_deps
18
+ deprec2.download_src(SRC_PACKAGES[:imagemagick], src_dir)
19
+ deprec2.install_from_src(SRC_PACKAGES[:imagemagick], src_dir)
20
+ sudo "ldconfig"
21
+ gem2.install 'rmagick' if imagemagick_include_rmagick
22
+ end
23
+
24
+ task :uninstall, :roles => :app do
25
+ gem2.uninstall 'rmagick' if imagemagick_include_rmagick
26
+ package_dir = File.join(src_dir, File.basename(SRC_PACKAGES[:imagemagick][:url]).sub(/(\.tgz|\.tar\.gz)/,''))
27
+ sudo "sh -c 'cd #{package_dir} ; make uninstall || true'"
28
+ end
29
+
30
+ task :install_deps, :roles => :app do
31
+ # install binary packages, so all needed dependencies are installed
32
+ apt.install( {:base => %w(imagemagick libmagick9-dev libperl-dev libmagick10)}, :stable )
33
+ # remove binary packages, leaving the dependencies
34
+ apt.install( {:base => %w(imagemagick- libmagick9-dev- libmagick10-)}, :stable )
35
+ end
36
+
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,108 @@
1
+ require 'sha1'
2
+
3
+ # Copyright 2006-2009 by Mike Bailey. All rights reserved.
4
+ Capistrano::Configuration.instance(:must_exist).load do
5
+ namespace :deprec do
6
+ namespace :integrity do
7
+
8
+ set :integrity_install_dir, '/opt/apps/integrity'
9
+ set(:integrity_domain) do
10
+ Capistrano::CLI.ui.ask 'Please enter domain name' do |q|
11
+ q.default = 'integrity.failmode.com'
12
+ end
13
+ end
14
+ set :integrity_use_basic_auth, true
15
+ set :integrity_hash_admin_password, true
16
+ set(:integrity_admin_username) do
17
+ Capistrano::CLI.ui.ask 'Please enter admin username' do |q|
18
+ q.default = 'admin'
19
+ end
20
+ end
21
+ set(:integrity_admin_password) { Capistrano::CLI.password_prompt 'Please enter admin password' }
22
+ set :integrity_user, 'integrity'
23
+
24
+
25
+ desc "Install Integrity"
26
+ task :install, :roles => :ci do
27
+ install_deps
28
+ sudo 'gem sources -a http://gems.github.com'
29
+ gem2.install 'integrity'
30
+
31
+ sudo "integrity install --passenger #{integrity_install_dir}"
32
+ deprec2.useradd 'integrity'
33
+ sudo "chown -R #{integrity_user} #{integrity_install_dir}"
34
+ end
35
+
36
+ # Install dependencies for Integrity
37
+ task :install_deps, :roles => :ci do
38
+ apt.install( {:base => %w(postfix sqlite3 libsqlite3-dev git libxslt1-dev libxml2-dev)}, :stable )
39
+ gem2.install 'sqlite3-ruby'
40
+ gem2.install 'do_sqlite3'
41
+ # Gems your tests might need
42
+ gem2.install 'webrat'
43
+ end
44
+
45
+ SYSTEM_CONFIG_FILES[:integrity] = [
46
+
47
+ { :template => 'apache_vhost.erb',
48
+ :path => "/etc/apache2/sites-available/integrity",
49
+ :mode => 0755,
50
+ :owner => 'root:root'},
51
+
52
+ { :template => 'config.ru.erb',
53
+ :path => "/opt/apps/integrity/config.ru", # XXX shouldn't be hard coded
54
+ :mode => 0755,
55
+ :owner => 'root:root'},
56
+
57
+ { :template => 'config.yml.erb',
58
+ :path => "/opt/apps/integrity/config.yml", # XXX shouldn't be hard coded
59
+ :mode => 0755,
60
+ :owner => 'root:root'}
61
+
62
+ ]
63
+
64
+ desc "Generate Integrity apache configs (system & project level)."
65
+ task :config_gen do
66
+ SYSTEM_CONFIG_FILES[:integrity].each do |file|
67
+ deprec2.render_template(:integrity, file)
68
+ end
69
+ end
70
+
71
+ desc "Push Integrity config files (system & project level) to server"
72
+ task :config, :roles => :ci do
73
+ deprec2.push_configs(:integrity, SYSTEM_CONFIG_FILES[:integrity])
74
+ sudo "chown #{integrity_user} #{integrity_install_dir}/config.ru"
75
+ activate
76
+ end
77
+
78
+ # XXX Setup database for testing project
79
+ #
80
+ # $ mysql -uroot p
81
+ # mysql> CREATE USER integrity INDENTIFIED BY PASSWORD 'mypassword123';
82
+ # mysql> CREATE DATABASE my_cool_application_test;
83
+ # mysql> GRANT ALL ON my_cool_application_test.* TO 'integrity'@localhost IDENTIFIED BY 'mypassword123';
84
+
85
+ task :activate, :roles => :ci do
86
+ sudo "a2ensite integrity"
87
+ restart_apache
88
+ end
89
+
90
+ task :deactivate, :roles => :ci do
91
+ sudo "a2dissite integrity"
92
+ restart_apache
93
+ end
94
+
95
+ desc "Restart Application"
96
+ task :restart, :roles => :ci do
97
+ sudo "touch #{integrity_install_dir}/tmp/restart.txt"
98
+ end
99
+
100
+ desc "Restart Apache"
101
+ task :restart_apache, :roles => :ci do
102
+ run "#{sudo} /etc/init.d/apache2 restart"
103
+ end
104
+
105
+ end
106
+
107
+ end
108
+ end
@@ -0,0 +1,94 @@
1
+ # Copyright 2009-2010 by le1t0@github. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :iptables do
5
+
6
+ set :iptables_allowed, "tcp:22,80,443"
7
+ set :iptables_forwards, ""
8
+ set :iptables_binary, "/sbin/iptables"
9
+ set :iptables_save_binary, "/sbin/iptables-save"
10
+
11
+ task :status do
12
+ sudo "iptables -L -v"
13
+ end
14
+
15
+ desc "Install iptables"
16
+ task :install do
17
+ install_deps
18
+ end
19
+
20
+ task :install_deps do
21
+ apt.install( {:base => %w(iptables)}, :stable )
22
+ end
23
+
24
+ SYSTEM_CONFIG_FILES[:iptables] = [
25
+
26
+ {:template => 'firewall-init.erb',
27
+ :path => '/etc/init.d/firewall',
28
+ :mode => 0755,
29
+ :owner => 'root:root'},
30
+ {:template => 'firewall-default.erb',
31
+ :path => '/etc/default/firewall',
32
+ :mode => 0755,
33
+ :owner => 'root:root'}
34
+ ]
35
+
36
+ desc "Generate iptables config from template."
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 "Push iptables config files to server"
44
+ task :config do
45
+ sudo "test -e /etc/default/firewall && cp /etc/default/firewall /etc/default/firewall.bak || true"
46
+ sudo "test -e /etc/init.d/firewall && cp /etc/init.d/firewall /etc/init.d/firewall.bak || true"
47
+ deprec2.push_configs(:iptables, SYSTEM_CONFIG_FILES[:iptables])
48
+ deprec2.append_to_file_if_missing('/etc/services', 'vrrp 112/raw # vrrpd daemon')
49
+ end
50
+
51
+ desc "Generate new iptables configs, upload them and restart iptables, revert if failing"
52
+ task :reconfig do
53
+ transaction do
54
+ on_rollback {
55
+ puts `git checkout config/#{stage}/iptables/etc`
56
+ sudo "test -e /etc/default/firewall.bak && mv /etc/default/firewall.bak /etc/default/firewall || true"
57
+ sudo "test -e /etc/init.d/firewall.bak && mv /etc/init.d/firewall.bak /etc/init.d/firewall || true"
58
+ sudo "/etc/init.d/firewall start &"
59
+ }
60
+ config_gen
61
+ config
62
+ restart
63
+ end
64
+ activate
65
+ end
66
+
67
+ desc "Revert iptables config on server"
68
+ task :revert do
69
+ sudo "test -e /etc/default/firewall.bak && mv /etc/default/firewall.bak /etc/default/firewall || true"
70
+ sudo "test -e /etc/init.d/firewall.bak && mv /etc/init.d/firewall.bak /etc/init.d/firewall || true"
71
+ end
72
+
73
+ desc 'Enable iptables start scripts on server.'
74
+ task :activate do
75
+ send(run_method, "update-rc.d firewall start 99 S .")
76
+ end
77
+
78
+ desc 'Disable iptables start scripts on server.'
79
+ task :deactivate do
80
+ send(run_method, "update-rc.d -f firewall remove")
81
+ end
82
+
83
+ desc "Start iptables"
84
+ task :start do
85
+ send(run_method, "/etc/init.d/firewall start &")
86
+ end
87
+
88
+ desc "Restart iptables"
89
+ task :restart do
90
+ send(run_method, "/etc/init.d/firewall start &")
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,23 @@
1
+ # Copyright 2010 by le1t0@github. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :java do
5
+
6
+ set :java_include_jdk, false
7
+
8
+ desc "Install Java"
9
+ task :install do
10
+ packages = %w(sun-java6-bin sun-java6-jre)
11
+ packages << "sun-java6-jdk" if java_include_jdk
12
+ apt.install( {:base => packages}, :stable )
13
+ end
14
+
15
+ desc "Config java"
16
+ task :config do
17
+ deprec2.append_to_file_if_missing('/etc/profile', 'export JAVA_HOME=/usr/lib/jvm/java-6-sun')
18
+ deprec2.append_to_file_if_missing('/etc/profile', 'export PATH=$PATH:${JAVA_HOME}/bin')
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,78 @@
1
+ # Copyright 2009-2010 by le1t0@github. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :keepalived do
5
+
6
+ set :keepalived_script, 'killall -0 haproxy'
7
+ set :keepalived_virtual_ipaddress, '192.168.0.99'
8
+ set :keepalived_virtual_router_id, '51'
9
+ set :keepalived_interface, 'eth0'
10
+ set :keepalived_interval, '2' # check every 2 seconds
11
+ set :keepalived_weight, '2' # add 2 points of prio if OK
12
+ set :keepalived_priority, '101' # 101 on master, 100 on backup
13
+ set :keepalived_state, 'MASTER'
14
+
15
+ desc "Install keepalived on server"
16
+ task :install, :roles => :failover do
17
+ install_deps
18
+ update_sysctl
19
+ end
20
+
21
+ task :install_deps, :roles => :failover do
22
+ apt.install( {:base => %w(keepalived)}, :stable )
23
+ end
24
+
25
+ SYSTEM_CONFIG_FILES[:keepalived] = [
26
+ {:template => 'keepalived.conf.erb',
27
+ :path => '/etc/keepalived/keepalived.conf',
28
+ :mode => 0644,
29
+ :owner => 'root:root'}
30
+ ]
31
+
32
+ desc "Generate config files for keepalived"
33
+ task :config_gen do
34
+ SYSTEM_CONFIG_FILES[:keepalived].each do |file|
35
+ deprec2.render_template(:keepalived, file)
36
+ end
37
+ end
38
+
39
+ desc "Push keepalived config files to server"
40
+ task :config, :roles => :failover do
41
+ deprec2.push_configs(:keepalived, SYSTEM_CONFIG_FILES[:keepalived])
42
+ reactivate
43
+ end
44
+
45
+ task :update_sysctl, :roles => :failover do
46
+ deprec2.append_to_file_if_missing('/etc/sysctl.conf', 'net.ipv4.ip_nonlocal_bind=1')
47
+ sudo 'sysctl -p'
48
+ end
49
+
50
+ task :start, :roles => :failover do
51
+ sudo "/etc/init.d/keepalived start"
52
+ end
53
+
54
+ task :stop, :roles => :failover do
55
+ sudo "/etc/init.d/keepalived stop"
56
+ end
57
+
58
+ task :restart do
59
+ stop
60
+ start
61
+ end
62
+
63
+ task :activate, :roles => :failover do
64
+ sudo "update-rc.d keepalived start 50 S . stop 9 0 6 ."
65
+ end
66
+
67
+ task :deactivate, :roles => :failover do
68
+ sudo "update-rc.d -f keepalived remove"
69
+ end
70
+
71
+ task :reactivate do
72
+ deactivate
73
+ activate
74
+ end
75
+
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,52 @@
1
+ # Copyright 2009-2010 by le1t0@github. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :ldap do
5
+
6
+ # set(:ldap_base_dn) { 'dc='+domain.split('.').join(',dc=') }
7
+ # set(:ldap_organization_name) { domain }
8
+ # set :ldap_password, '{SSHA}eO3vX5G/dpiSIrPye8oJAz2DOcgy5N3f' # 'admin' encrypted
9
+
10
+ desc "Install ldap"
11
+ task :install, :roles => :db do
12
+ install_deps
13
+ config
14
+ activate
15
+ end
16
+
17
+ task :install_deps, :roles => :db do
18
+ apt.install( {:base => %w(slapd phpldapadmin ldap-utils)}, :stable )
19
+ end
20
+
21
+ desc 'Enable ldap start scripts on server.'
22
+ task :activate, :roles => :db do
23
+ send(run_method, "update-rc.d slapd defaults")
24
+ end
25
+
26
+ desc 'Disable ldap start scripts on server.'
27
+ task :deactivate, :roles => :db do
28
+ send(run_method, "update-rc.d -f slapd remove")
29
+ end
30
+
31
+ desc "Start ldap"
32
+ task :start, :roles => :db do
33
+ send(run_method, "/etc/init.d/slapd start")
34
+ end
35
+
36
+ desc "Stop ldap"
37
+ task :stop, :roles => :db do
38
+ send(run_method, "/etc/init.d/slapd stop")
39
+ end
40
+
41
+ desc "Restart ldap"
42
+ task :restart, :roles => :db do
43
+ send(run_method, "/etc/init.d/slapd restart")
44
+ end
45
+
46
+ desc "Reload ldap"
47
+ task :reload, :roles => :db do
48
+ top.deprec.ldap.restart
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,56 @@
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
+ set :use_logrotate, true # FIXME: should be generic namespace logrotation, with :none option
7
+
8
+ # Install
9
+
10
+ desc "Install logrotate"
11
+ task :install do
12
+ install_deps
13
+ SYSTEM_CONFIG_FILES[:logrotate].each do |file|
14
+ deprec2.render_template(:logrotate, file.merge(:remote => true))
15
+ end
16
+ end
17
+
18
+ # install dependencies for nginx
19
+ task :install_deps do
20
+ apt.install( {:base => %w(logrotate)}, :stable )
21
+ end
22
+
23
+ # Configure
24
+
25
+ SYSTEM_CONFIG_FILES[:logrotate] = [
26
+
27
+ {:template => 'logrotate.conf.erb',
28
+ :path => '/etc/logrotate.conf',
29
+ :mode => 0755,
30
+ :owner => 'root:root'}
31
+ ]
32
+
33
+ desc "Generate logrotate config from template."
34
+ task :config_gen do
35
+ SYSTEM_CONFIG_FILES[:logrotate].each do |file|
36
+ deprec2.render_template(:logrotate, file)
37
+ end
38
+ end
39
+
40
+ desc "Push logrotate config files to server"
41
+ task :config do
42
+ deprec2.push_configs(:logrotate, SYSTEM_CONFIG_FILES[:logrotate])
43
+ end
44
+
45
+ # Control
46
+ #
47
+ # logrotate is run via cron with a script in /etc/cron.daily/logrotate
48
+
49
+ desc "Force logrotate to run"
50
+ task :force do
51
+ sudo "logrotate -f /etc/logrotate.conf"
52
+ end
53
+
54
+ end
55
+ end
56
+ end