deprec 1.9.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. data/CHANGELOG +280 -0
  2. data/COPYING +19 -0
  3. data/LICENSE +339 -0
  4. data/README +152 -0
  5. data/THANKS +17 -0
  6. data/bin/depify +128 -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/{README.quickstart → deprec-1.x/deprec-1.x.quickstart} +4 -1
  12. data/docs/{building_edge_capistrano.txt → deprec-1.x/notes.txt} +6 -3
  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 +8 -1
  19. data/lib/deprec/capistrano_extensions.rb +442 -0
  20. data/lib/deprec/recipes.rb +50 -233
  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 +197 -0
  24. data/lib/deprec/recipes/apt_mirror.rb +99 -0
  25. data/lib/deprec/recipes/ar_sendmail.rb +67 -0
  26. data/lib/deprec/recipes/canonical.rb +68 -0
  27. data/lib/deprec/recipes/db/mysql.rb +144 -0
  28. data/lib/deprec/recipes/db/postgresql.rb +104 -0
  29. data/lib/deprec/recipes/db/sqlite.rb +37 -0
  30. data/lib/deprec/recipes/ddclient.rb +51 -0
  31. data/lib/deprec/recipes/deprec.rb +199 -0
  32. data/lib/deprec/recipes/deprecated.rb +71 -0
  33. data/lib/deprec/recipes/example.rb +115 -0
  34. data/lib/deprec/recipes/git.rb +97 -0
  35. data/lib/deprec/recipes/gitosis.rb +48 -0
  36. data/lib/deprec/recipes/heartbeat.rb +138 -0
  37. data/lib/deprec/recipes/logrotate.rb +54 -0
  38. data/lib/deprec/recipes/lvm.rb +20 -0
  39. data/lib/deprec/recipes/memcache.rb +6 -2
  40. data/lib/deprec/recipes/monit.rb +143 -0
  41. data/lib/deprec/recipes/nagios.rb +305 -0
  42. data/lib/deprec/recipes/network.rb +93 -0
  43. data/lib/deprec/recipes/ntp.rb +103 -0
  44. data/lib/deprec/recipes/php.rb +58 -0
  45. data/lib/deprec/recipes/postfix.rb +115 -0
  46. data/lib/deprec/recipes/rails.rb +300 -55
  47. data/lib/deprec/recipes/ruby/mri.rb +55 -0
  48. data/lib/deprec/recipes/ruby/ree.rb +41 -0
  49. data/lib/deprec/recipes/sphinx.rb +86 -0
  50. data/lib/deprec/recipes/ssh.rb +85 -18
  51. data/lib/deprec/recipes/ssl.rb +55 -0
  52. data/lib/deprec/recipes/starling.rb +119 -0
  53. data/lib/deprec/recipes/svn.rb +163 -183
  54. data/lib/deprec/recipes/trac.rb +239 -62
  55. data/lib/deprec/recipes/ubuntu.rb +18 -100
  56. data/lib/deprec/recipes/users.rb +90 -0
  57. data/lib/deprec/recipes/utils.rb +58 -0
  58. data/lib/deprec/recipes/vnstat.rb +85 -0
  59. data/lib/deprec/recipes/web/apache.rb +119 -0
  60. data/lib/deprec/recipes/web/nginx.rb +172 -0
  61. data/lib/deprec/recipes/wordpress.rb +96 -0
  62. data/lib/deprec/recipes/wpmu.rb +103 -0
  63. data/lib/deprec/recipes/xen.rb +267 -0
  64. data/lib/deprec/recipes/xentools.rb +75 -0
  65. data/lib/deprec/templates/aoe/aoe-init +55 -0
  66. data/lib/deprec/templates/aoe/fence_aoemask +351 -0
  67. data/lib/deprec/templates/apache/namevirtualhosts.conf +5 -0
  68. data/lib/deprec/templates/apt/sources.list +18 -0
  69. data/lib/deprec/templates/apt_mirror/apt-mirror-cron +4 -0
  70. data/lib/deprec/templates/apt_mirror/mirror.list +33 -0
  71. data/lib/deprec/templates/ar_sendmail/logrotate.conf.erb +9 -0
  72. data/lib/deprec/templates/ar_sendmail/monit.conf.erb +5 -0
  73. data/lib/deprec/templates/ddclient/ddclient.conf.erb +11 -0
  74. data/lib/deprec/templates/ddclient/ddclient.erb +15 -0
  75. data/lib/deprec/templates/deprec/caprc.erb +14 -0
  76. data/lib/deprec/templates/heartbeat/authkeys.erb +2 -0
  77. data/lib/deprec/templates/heartbeat/ha.cf.erb +15 -0
  78. data/lib/deprec/templates/heartbeat/haresources.erb +1 -0
  79. data/lib/deprec/templates/logrotate/logrotate.conf.erb +32 -0
  80. data/lib/deprec/templates/mongrel/apache_vhost.erb +148 -0
  81. data/lib/deprec/templates/mongrel/logrotate.conf.erb +11 -0
  82. data/lib/deprec/{third_party/mongrel_cluster/resources/mongrel_cluster → templates/mongrel/mongrel_cluster-init-script} +19 -6
  83. data/lib/deprec/templates/mongrel/mongrel_cluster.yml.erb +10 -0
  84. data/lib/deprec/templates/mongrel/monit.conf.erb +17 -0
  85. data/lib/deprec/templates/mongrel/nginx_vhost.erb +41 -0
  86. data/lib/deprec/templates/monit/monit-init-script +104 -0
  87. data/lib/deprec/templates/monit/monitrc.erb +227 -0
  88. data/lib/deprec/templates/monit/nothing +0 -0
  89. data/lib/deprec/templates/mysql/create_databases.sql +20 -0
  90. data/lib/deprec/templates/mysql/database.yml.prod +6 -0
  91. data/lib/deprec/templates/mysql/database.yml.stage +6 -0
  92. data/lib/deprec/templates/mysql/my.cnf.erb +140 -0
  93. data/lib/deprec/templates/mysql/sphinx.conf.prod +542 -0
  94. data/lib/deprec/templates/mysql/sphinx.conf.stage +542 -0
  95. data/lib/deprec/templates/nagios/cgi.cfg.erb +321 -0
  96. data/lib/deprec/templates/nagios/check_linux_free_memory.pl +118 -0
  97. data/lib/deprec/templates/nagios/check_mongrel_cluster.rb +82 -0
  98. data/lib/deprec/templates/nagios/commands.cfg.erb +240 -0
  99. data/lib/deprec/templates/nagios/contacts.cfg.erb +57 -0
  100. data/lib/deprec/templates/nagios/hosts.cfg.erb +143 -0
  101. data/lib/deprec/templates/nagios/htpasswd.users +1 -0
  102. data/lib/deprec/templates/nagios/localhost.cfg.erb +157 -0
  103. data/lib/deprec/templates/nagios/nagios.cfg.erb +1274 -0
  104. data/lib/deprec/templates/nagios/nagios_apache_vhost.conf.erb +45 -0
  105. data/lib/deprec/templates/nagios/nrpe.cfg.erb +210 -0
  106. data/lib/deprec/templates/nagios/nrpe.xinetd.erb +16 -0
  107. data/lib/deprec/templates/nagios/resource.cfg.erb +34 -0
  108. data/lib/deprec/templates/nagios/services.cfg.erb +79 -0
  109. data/lib/deprec/templates/nagios/templates.cfg.erb +9 -0
  110. data/lib/deprec/templates/nagios/timeperiods.cfg.erb +94 -0
  111. data/lib/deprec/templates/network/hostname.erb +1 -0
  112. data/lib/deprec/templates/network/hosts.erb +2 -0
  113. data/lib/deprec/templates/network/interfaces.erb +18 -0
  114. data/lib/deprec/templates/network/resolv.conf.erb +6 -0
  115. data/lib/deprec/templates/nginx/logrotate.conf.erb +13 -0
  116. data/lib/deprec/templates/nginx/mime.types.erb +70 -0
  117. data/lib/deprec/templates/nginx/nginx-init-script +62 -0
  118. data/lib/deprec/templates/nginx/nginx.conf.erb +125 -0
  119. data/lib/deprec/templates/nginx/nginx.logrotate.d +12 -0
  120. data/lib/deprec/templates/nginx/nothing.conf +1 -0
  121. data/lib/deprec/templates/nginx/rails_nginx_vhost.conf.erb +41 -0
  122. data/lib/deprec/templates/ntp/ntp.conf.erb +42 -0
  123. data/lib/deprec/templates/passenger/apache_vhost.erb +21 -0
  124. data/lib/deprec/templates/passenger/passenger.conf.erb +21 -0
  125. data/lib/deprec/templates/passenger/passenger.load.erb +3 -0
  126. data/lib/deprec/templates/postfix/aliases.erb +3 -0
  127. data/lib/deprec/templates/postfix/dynamicmaps.cf.erb +8 -0
  128. data/lib/deprec/templates/{postfix_main.conf → postfix/main.cf.erb} +6 -8
  129. data/lib/deprec/templates/postfix/master.cf.erb +77 -0
  130. data/lib/deprec/templates/sphinx/monit.conf.erb +5 -0
  131. data/lib/deprec/templates/ssh/ssh_config.erb +50 -0
  132. data/lib/deprec/templates/ssh/sshd_config.erb +78 -0
  133. data/lib/deprec/templates/ssl/make-ssl-cert +138 -0
  134. data/lib/deprec/templates/ssl/ssl-cert-snakeoil.key +15 -0
  135. data/lib/deprec/templates/ssl/ssl-cert-snakeoil.pem +19 -0
  136. data/lib/deprec/templates/starling/monit.conf.erb +14 -0
  137. data/lib/deprec/templates/starling/starling-init-script.erb +71 -0
  138. data/lib/deprec/templates/subversion/svn.apache.vhost.erb +43 -0
  139. data/lib/deprec/templates/trac/apache_vhost.conf.erb +24 -0
  140. data/lib/deprec/templates/trac/nginx_vhost.conf.erb +26 -0
  141. data/lib/deprec/templates/trac/trac.ini.erb +169 -0
  142. data/lib/deprec/templates/trac/trac_deprec.png +0 -0
  143. data/lib/deprec/templates/trac/tracd-init.erb +43 -0
  144. data/lib/deprec/templates/trac/users.htdigest.erb +0 -0
  145. data/lib/deprec/templates/vnstat/config.php +57 -0
  146. data/lib/deprec/templates/wordpress/apache2_wordpress_vhost.conf.erb +31 -0
  147. data/lib/deprec/templates/wordpress/wp-config.php.erb +31 -0
  148. data/lib/deprec/templates/wpmu/apache_vhost.conf.erb +13 -0
  149. data/lib/deprec/templates/xen/network-bridge-wrapper +3 -0
  150. data/lib/deprec/templates/xen/xend-config.sxp.erb +195 -0
  151. data/lib/deprec/templates/xen/xend-init.erb +57 -0
  152. data/lib/deprec/templates/xen/xendomains.erb +137 -0
  153. data/lib/deprec/templates/xentools/15-disable-hwclock +40 -0
  154. data/lib/deprec/templates/xentools/40-setup-networking +145 -0
  155. data/lib/deprec/templates/xentools/xen-tools.conf.erb +276 -0
  156. data/lib/deprec/templates/xentools/xm.tmpl.erb +138 -0
  157. data/lib/deprec_cmd_completion.sh +26 -0
  158. data/lib/vmbuilder_plugins/all.rb +20 -0
  159. data/lib/vmbuilder_plugins/apt.rb +93 -0
  160. data/lib/vmbuilder_plugins/emerge.rb +76 -0
  161. data/lib/{deprec/third_party/vmbuilder/plugins → vmbuilder_plugins}/gem.rb +10 -17
  162. data/lib/{deprec/third_party/vmbuilder/plugins → vmbuilder_plugins}/std.rb +69 -19
  163. metadata +204 -55
  164. data/bin/deprec +0 -35
  165. data/docs/README.slicehost +0 -14
  166. data/docs/README.svn_trac +0 -19
  167. data/lib/deprec/capistrano_extensions/actor_extensions.rb +0 -89
  168. data/lib/deprec/capistrano_extensions/cli_extensions.rb +0 -38
  169. data/lib/deprec/capistrano_extensions/deprec_extensions.rb +0 -137
  170. data/lib/deprec/generators/deprec/USAGE +0 -11
  171. data/lib/deprec/generators/deprec/deprec_generator.rb +0 -24
  172. data/lib/deprec/generators/deprec/templates/deploy.rb +0 -90
  173. data/lib/deprec/generators/loader.rb +0 -20
  174. data/lib/deprec/recipes/apache.rb +0 -91
  175. data/lib/deprec/recipes/cache_svn.rb +0 -74
  176. data/lib/deprec/recipes/vmware.rb +0 -114
  177. data/lib/deprec/templates/trac.ini.erb +0 -106
  178. data/lib/deprec/third_party/THIRD_PARTY_README +0 -12
  179. data/lib/deprec/third_party/mongrel_cluster/LICENSE +0 -506
  180. data/lib/deprec/third_party/mongrel_cluster/recipes.rb +0 -96
  181. data/lib/deprec/third_party/railsmachine/LICENSE +0 -506
  182. data/lib/deprec/third_party/railsmachine/recipes/apache.rb +0 -92
  183. data/lib/deprec/third_party/railsmachine/recipes/mysql.rb +0 -73
  184. data/lib/deprec/third_party/railsmachine/recipes/templates/httpd-ssl.conf +0 -80
  185. data/lib/deprec/third_party/railsmachine/recipes/templates/httpd.conf +0 -57
  186. data/lib/deprec/third_party/vmbuilder/plugins.rb +0 -8
  187. data/lib/deprec/third_party/vmbuilder/plugins/apt.rb +0 -144
  188. data/resources/capistrano_include_dotfiles.patch +0 -17
@@ -1,102 +1,20 @@
1
- Capistrano.configuration(:must_exist).load do
2
-
3
- # require 'deprec/third_party/vmbuilder/plugins/apt'
4
-
5
- # Package files for a rails machine
6
- set :rails_ubuntu, {
7
- :base => %w(build-essential ntp-server mysql-server wget
8
- ruby irb ri rdoc ruby1.8-dev libopenssl-ruby libmysql-ruby
9
- zlib1g-dev zlib1g openssl libssl-dev subversion)
10
- }
11
-
12
- desc "enable universe repositories"
13
- task :enable_universe do
14
- # ruby is not installed by default or else we'd use
15
- # sudo "ruby -pi.bak -e \"gsub(/#\s?(.*universe$)/, '\1')\" sources.list"
16
- sudo 'perl -pi -e \'s/#\s?(.*dapper universe$)/\1/g\' /etc/apt/sources.list'
17
- apt.update
1
+ # Copyright 2006-2008 by Mike Bailey. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :ubuntu do
5
+
6
+ task :update do
7
+ apt.update
8
+ end
9
+
10
+ task :upgrade do
11
+ apt.upgrade
12
+ end
13
+
14
+ task :restart do
15
+ sudo "reboot"
16
+ end
17
+
18
+ end
18
19
  end
19
-
20
- desc "disable universe repositories"
21
- task :disable_universe do
22
- # ruby is not installed by default or else we'd use
23
- # sudo "ruby -pi.bak -e \"gsub(/#\s?(.*universe$)/, '\1')\" sources.list"
24
- sudo 'perl -pi -e \'s/^([^#]*dapper universe)/#\1/g\' /etc/apt/sources.list'
25
- apt.update
26
- end
27
-
28
- desc "enable multiverse repositories"
29
- task :enable_multiverse do
30
- # ruby is not installed by default or else we'd use
31
- # sudo "ruby -pi.bak -e \"gsub(/#\s?(.*universe$)/, '\1')\" sources.list"
32
- sudo 'perl -pi -e \'s/#\s?(deb.* multiverse$)/\1/g\' /etc/apt/sources.list'
33
- apt.update
34
- end
35
-
36
- desc "disable universe repositories"
37
- task :disable_multiverse do
38
- # ruby is not installed by default or else we'd use
39
- # sudo "ruby -pi.bak -e \"gsub(/#\s?(.*universe$)/, '\1')\" sources.list"
40
- sudo 'perl -pi -e \'s/^([^#]*multiverse)/#\1/g\' /etc/apt/sources.list'
41
- apt.update
42
- end
43
-
44
- desc "disable cdrom as a source of packages"
45
- task :disable_cdrom_install do
46
- # ruby is not installed by default so we use perl
47
- sudo 'perl -pi -e \'s/^([^#]*deb cdrom)/#\1/g\' /etc/apt/sources.list'
48
- apt.update
49
- end
50
-
51
- # XXX we need to run 'sudo apt-cdrom' to add a cdrom
52
- # desc "enable cdrom as a source of packages"
53
- # task :enable_cdrom_install do
54
- # # ruby is not installed by default so we use perl
55
- # sudo 'perl -pi -e \'s/^[# ]*(deb cdrom)/\1/g\' /etc/apt/sources.list'
56
- # apt.update
57
- # end
58
-
59
- desc "installs packages required for a rails box"
60
- task :install_packages_for_rails do
61
- apt.install(rails_ubuntu, :stable) # install packages for rails box
62
- end
63
-
64
- desc "installs image magick packages"
65
- task :install_image_magic do
66
- apt.install({:base => ['imagemagick', 'libmagick9-dev']}, :stable)
67
- end
68
-
69
- desc "install postfix and dependent packages"
70
- task :install_postfix do
71
- apt.install({:base => ['postfix']}, :stable)
72
- end
73
-
74
- # desc "write network config to server"
75
- # task :network_configure do
76
- # set :ethernet_interfaces, [{
77
- # :num => 0,
78
- # :type => 'static',
79
- # :ipaddr => '10.0.100.125',
80
- # :netmask => '255.255.255.0',
81
- # :gateway => '10.0.100.1',
82
- # :dns1 => '203.8.183.1',
83
- # :dns2 => '4.2.2.1'
84
- # }]
85
-
86
- # deprec.render_template_to_file('interfaces.rhtml', '/etc/network/interfaces')
87
- # end
88
-
89
- # desc "configure hostname on server"
90
- # task :hostname_configure do
91
- # # update /etc/hostname
92
- # # update /etc/hosts
93
- # end
94
-
95
-
96
-
97
- # XXX write function to enable/disable a service
98
- # XXX update-rc.d lighttpd remove
99
- # XXX update-rc.d -n httpd defaults
100
-
101
-
102
20
  end
@@ -0,0 +1,90 @@
1
+ # Copyright 2006-2008 by Mike Bailey. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :users do
5
+
6
+ # desc "Create user account"
7
+ # task :add do
8
+ # target_user = Capistrano::CLI.ui.ask "Enter userid for new user" do |q|
9
+ # q.default = user
10
+ # end
11
+ # deprec2.useradd(target_user, :shell => '/bin/bash')
12
+ # puts "Setting password for new account"
13
+ # deprec2.invoke_with_input("passwd #{target_user}", /UNIX password/)
14
+ # end
15
+
16
+ desc "Create account"
17
+ task :add do
18
+ target_user = Capistrano::CLI.ui.ask "Enter userid for new user" do |q|
19
+ q.default = user
20
+ end
21
+ make_admin = Capistrano::CLI.ui.ask "Should this be an admin account?" do |q|
22
+ q.default = 'no'
23
+ end
24
+ copy_keys = false
25
+ if File.readable?("config/ssh/authorized_keys/#{target_user}")
26
+ copy_keys = Capistrano::CLI.ui.ask "I've found an authorized_keys file for #{target_user}. Should I copy it out?" do |q|
27
+ q.default = 'yes'
28
+ end
29
+ end
30
+
31
+ new_password = Capistrano::CLI.ui.ask("Enter new password for #{target_user}") { |q| q.echo = false }
32
+
33
+ deprec2.useradd(target_user, :shell => '/bin/bash')
34
+
35
+ deprec2.invoke_with_input("passwd #{target_user}", /UNIX password/, new_password)
36
+
37
+ if make_admin.match(/y/i)
38
+ deprec2.groupadd('admin')
39
+ deprec2.add_user_to_group(target_user, 'admin')
40
+ deprec2.append_to_file_if_missing('/etc/sudoers', '%admin ALL=(ALL) ALL')
41
+ end
42
+
43
+ if copy_keys && copy_keys.grep(/y/i)
44
+ set :target_user, target_user
45
+ top.deprec.ssh.setup_keys
46
+ end
47
+
48
+ end
49
+
50
+ desc "Create account"
51
+ task :add_admin do
52
+ puts 'deprecated! use deprec:users:add'
53
+ add
54
+ end
55
+
56
+ desc "Change user password"
57
+ task :passwd do
58
+ target_user = Capistrano::CLI.ui.ask "Enter user to change password for" do |q|
59
+ q.default = user if user.is_a?(String)
60
+ end
61
+ new_password = Capistrano::CLI.ui.ask("Enter new password for #{target_user}") { |q| q.echo = false }
62
+
63
+ deprec2.invoke_with_input("passwd #{target_user}", /UNIX password/, new_password)
64
+ end
65
+
66
+ desc "Add user to group"
67
+ task :add_user_to_group do
68
+ target_user = Capistrano::CLI.ui.ask "Which user?" do |q|
69
+ q.default = user if user.is_a?(String)
70
+ end
71
+ target_group = Capistrano::CLI.ui.ask "Add to which group?" do |q|
72
+ q.default = 'deploy'
73
+ end
74
+ deprec2.add_user_to_group(target_user, target_group)
75
+ end
76
+
77
+ # desc "Create group"
78
+ # task :add_group do
79
+ # target_group = Capistrano::CLI.ui.ask "Enter name for new group"
80
+ # deprec2.groupadd(target_group)
81
+ # end
82
+ #
83
+ # desc "Add user to group"
84
+ # task :add_user_to_group do
85
+ # # XXX not yet implemented
86
+ # end
87
+
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,58 @@
1
+ # Copyright 2006-2008 by Mike Bailey. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :utils do
5
+
6
+ SRC_PACKAGES[:daemonize] = {
7
+ :filename => 'daemonize-1.5.2.tar.gz',
8
+ :md5sum => "c016f1a17f03ec976873d0a283a1a038 daemonize-1.5.2.tar.gz",
9
+ :dir => 'daemonize-1.5.2',
10
+ :url => "http://www.clapper.org/software/daemonize/daemonize-1.5.2.tar.gz",
11
+ :unpack => "tar zxf daemonize-1.5.2.tar.gz;",
12
+ :configure => %w(
13
+ ./configure
14
+ ;
15
+ ).reject{|arg| arg.match '#'}.join(' '),
16
+ :make => 'make;',
17
+ :install => 'make install;'
18
+ }
19
+
20
+ namespace :daemonize do
21
+
22
+ desc "Install daemonize"
23
+ task :install do
24
+ deprec2.download_src(SRC_PACKAGES[:daemonize], src_dir)
25
+ deprec2.install_from_src(SRC_PACKAGES[:daemonize], src_dir)
26
+ end
27
+
28
+ end
29
+
30
+ desc "Install some useful network utils"
31
+ task :net do
32
+ apps = %w(lynx nmap netcat telnet dnsutils rsync curl wget)
33
+ apt.install( {:base => apps}, :stable )
34
+ end
35
+
36
+ desc "Install some useful mail utils"
37
+ task :mail do
38
+ apps = %w(mailx mutt)
39
+ apt.install( {:base => apps}, :stable )
40
+ end
41
+
42
+ desc "Install some useful utils"
43
+ task :other do
44
+ apps = %w(vim-full tree)
45
+ apt.install( {:base => apps}, :stable )
46
+ end
47
+
48
+ desc "Install handy utils"
49
+ task :handy do
50
+ net
51
+ mail
52
+ other
53
+ end
54
+
55
+ end
56
+ end
57
+ end
58
+
@@ -0,0 +1,85 @@
1
+ # Copyright 2006-2008 by Mike Bailey. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+
4
+ namespace :deprec do
5
+ namespace :vnstat do
6
+
7
+ desc <<-EOF
8
+ vnstat description
9
+ EOF
10
+ task :default do
11
+ end
12
+
13
+ SRC_PACKAGES[:vnstat] = {
14
+ :url => "http://humdi.net/vnstat/vnstat-1.6.tar.gz",
15
+ :md5sum => "ccaffe8e70d47e0cf2f25e52daa25712 vnstat-1.6.tar.gz",
16
+ :configure => '',
17
+ :post_install => 'vnstat --testkernel && vnstat -u -i eth0'
18
+ }
19
+
20
+ desc <<-EOF
21
+ Install vnstat. Add interfaces with 'vnstat -u -i ethN'
22
+ (where N is interface number).
23
+
24
+ View stats using the vnstat command line tool.
25
+ EOF
26
+ task :install do
27
+ install_deps
28
+ deprec2.download_src(SRC_PACKAGES[:vnstat], src_dir)
29
+ deprec2.install_from_src(SRC_PACKAGES[:vnstat], src_dir)
30
+ end
31
+
32
+ # install dependencies for monit
33
+ task :install_deps do
34
+ # apt.install( {:base => %w(flex bison libssl-dev)}, :stable )
35
+ end
36
+
37
+ end
38
+
39
+
40
+ namespace :vnstat_php do
41
+
42
+ SRC_PACKAGES[:vnstat_php] = {
43
+ :url => "http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.3.tar.gz",
44
+ :md5sum => "190b37808ae16bd1c1a132434b170437 vnstat_php_frontend-1.3.tar.gz",
45
+ :configure => '',
46
+ :make => '',
47
+ :install => "test -d /var/www/vnstat_php_frontend-1.3 && rm -fr /var/www/vnstat_php_frontend-1.3; mv #{src_dir}/vnstat_php_frontend-1.3 /var/www &&
48
+ ln -sf /var/www/vnstat_php_frontend-1.3 /var/www/vnstat"
49
+ }
50
+
51
+ task :install do
52
+ install_deps
53
+ deprec2.download_src(SRC_PACKAGES[:vnstat_php], src_dir)
54
+ deprec2.install_from_src(SRC_PACKAGES[:vnstat_php], src_dir)
55
+ end
56
+
57
+ # install dependencies for monit
58
+ task :install_deps do
59
+ apt.install( {:base => %w(apache2 php5 php5-gd)}, :stable )
60
+ end
61
+
62
+ SYSTEM_CONFIG_FILES[:vnstat] = [
63
+
64
+ {:template => 'config.php',
65
+ :path => '/var/www/vnstat',
66
+ :mode => 0755,
67
+ :owner => 'root:root'}
68
+
69
+ ]
70
+
71
+ task :config_gen do
72
+ SYSTEM_CONFIG_FILES[:vnstat].each do |file|
73
+ deprec2.render_template(:vnstat, file)
74
+ end
75
+ end
76
+
77
+ desc "Push monit config files to server"
78
+ task :config do
79
+ deprec2.push_configs(:vnstat, SYSTEM_CONFIG_FILES[:vnstat])
80
+ end
81
+
82
+ end
83
+
84
+ end
85
+ end
@@ -0,0 +1,119 @@
1
+ # Copyright 2006-2008 by Mike Bailey. All rights reserved.
2
+ Capistrano::Configuration.instance(:must_exist).load do
3
+ namespace :deprec do
4
+ namespace :apache do
5
+
6
+ set :apache_vhost_dir, '/etc/apache2/sites-available'
7
+ set :apache_ssl_enabled, false
8
+ set :apache_ssl_ip, nil
9
+ set :apache_ssl_forward_all, apache_ssl_enabled
10
+ set :apache_ssl_chainfile, false
11
+ set :apache_modules_enabled, %w(rewrite ssl proxy_balancer proxy_http deflate headers)
12
+ set :apache_log_dir, '/var/log/apache2'
13
+
14
+ desc "Install apache"
15
+ task :install do
16
+ install_deps
17
+ enable_modules
18
+ reload
19
+ end
20
+
21
+ # install dependencies for apache
22
+ task :install_deps do
23
+ apt.install( {:base => %w(apache2-mpm-prefork apache2-prefork-dev rsync ssl-cert)}, :stable )
24
+ end
25
+
26
+ SYSTEM_CONFIG_FILES[:apache] = [
27
+
28
+ { :template => 'namevirtualhosts.conf',
29
+ :path => '/etc/apache2/conf.d/namevirtualhosts.conf',
30
+ :mode => 0644,
31
+ :owner => 'root:root'}
32
+
33
+ ]
34
+
35
+ PROJECT_CONFIG_FILES[:apache] = [
36
+ # Not required
37
+ ]
38
+
39
+ desc "Generate configuration file(s) for apache from template(s)"
40
+ task :config_gen do
41
+ config_gen_system
42
+ end
43
+
44
+ task :config_gen_system do
45
+ SYSTEM_CONFIG_FILES[:apache].each do |file|
46
+ deprec2.render_template(:apache, file)
47
+ end
48
+ end
49
+
50
+ task :config_gen_project do
51
+ PROJECT_CONFIG_FILES[:apache].each do |file|
52
+ deprec2.render_template(:apache, file)
53
+ end
54
+ # XXX Need to flesh out generation of custom certs
55
+ # In the meantime we'll just use the snakeoil cert
56
+ #
57
+ # top.deprec.ssl.config_gen if apache_ssl_enabled
58
+ top.deprec.ssl.generate_snakeoil_cert if apache_ssl_enabled
59
+ end
60
+
61
+ desc "Push apache config files to server"
62
+ task :config, :roles => :web do
63
+ deprec2.push_configs(:apache, SYSTEM_CONFIG_FILES[:apache])
64
+ end
65
+
66
+ # Stub so generic tasks don't fail (e.g. deprec:web:config_project)
67
+ task :config_project do
68
+ # XXX Need to flesh out generation of custom certs
69
+ # In the meantime we'll just use the snakeoil cert
70
+ #
71
+ # top.deprec.ssl.config if apache_ssl_enabled
72
+ end
73
+
74
+ task :enable_modules, :roles => :web do
75
+ apache_modules_enabled.each { |mod| sudo "a2enmod #{mod}" }
76
+ reload
77
+ end
78
+
79
+ desc "Start Apache"
80
+ task :start, :roles => :web do
81
+ send(run_method, "/etc/init.d/apache2 start")
82
+ end
83
+
84
+ desc "Stop Apache"
85
+ task :stop, :roles => :web do
86
+ send(run_method, "/etc/init.d/apache2 stop")
87
+ end
88
+
89
+ desc "Restart Apache"
90
+ task :restart, :roles => :web do
91
+ send(run_method, "/etc/init.d/apache2 restart")
92
+ end
93
+
94
+ desc "Reload Apache"
95
+ task :reload, :roles => :web do
96
+ send(run_method, "/etc/init.d/apache2 force-reload")
97
+ end
98
+
99
+ desc "Set apache to start on boot"
100
+ task :activate, :roles => :web do
101
+ send(run_method, "update-rc.d apache2 defaults")
102
+ end
103
+
104
+ desc "Set apache to not start on boot"
105
+ task :deactivate, :roles => :web do
106
+ send(run_method, "update-rc.d -f apache2 remove")
107
+ end
108
+
109
+ task :backup, :roles => :web do
110
+ # not yet implemented
111
+ end
112
+
113
+ task :restore, :roles => :web do
114
+ # not yet implemented
115
+ end
116
+
117
+ end
118
+ end
119
+ end