deprec 1.9.3 → 2.0.0

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.
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,92 +0,0 @@
1
- Capistrano.configuration(:must_exist).load do
2
-
3
- set :apache_server_name, nil
4
- set :apache_conf, nil
5
- set :apache_default_vhost, false
6
- set :apache_default_vhost_conf, nil
7
- set :apache_ctl, "/etc/init.d/httpd"
8
- set :apache_server_aliases, []
9
- set :apache_proxy_port, 8000
10
- set :apache_proxy_servers, 2
11
- set :apache_proxy_address, "127.0.0.1"
12
- set :apache_ssl_enabled, false
13
- set :apache_ssl_ip, nil
14
- set :apache_ssl_forward_all, false
15
- set :apache_ssl_chainfile, false
16
-
17
- task :setup_apache, :roles => :web do
18
- set :apache_path, '/usr/local/apache2'
19
- apps_dir = "#{apache_path}/conf/apps"
20
- sudo "test -d #{apps_dir} || sudo mkdir -p #{apps_dir}"
21
- sudo "chgrp #{group} #{apps_dir}"
22
- sudo "chmod g+w #{apps_dir}"
23
- inc_cmd = 'Include conf/apps/'
24
- # XXX quick hack to permit me to add to file
25
- sudo "chmod 766 #{apache_path}/conf/httpd.conf"
26
- sudo "grep '#{inc_cmd}' #{apache_path}/conf/httpd.conf || sudo echo '#{inc_cmd}' >> #{apache_path}/conf/httpd.conf"
27
- sudo "chmod 755 #{apache_path}/conf/httpd.conf"
28
- index = '/usr/local/apache2/htdocs/index.html'
29
- sudo "test ! -f #{index} || sudo mv #{index} #{index}.bak"
30
- end
31
-
32
- desc "Configure Apache. This uses the :use_sudo
33
- variable to determine whether to use sudo or not. By default, :use_sudo is
34
- set to true."
35
- task :configure_apache, :roles => :web do
36
- set_apache_conf
37
-
38
- server_aliases = []
39
- server_aliases << "www.#{apache_server_name}"
40
- server_aliases.concat apache_server_aliases
41
- set :apache_server_aliases_array, server_aliases
42
-
43
- file = File.join(File.dirname(__FILE__), "templates", "httpd.conf")
44
- buffer = render :template => File.read(file)
45
-
46
- if apache_ssl_enabled
47
- file = File.join(File.dirname(__FILE__), "templates", "httpd-ssl.conf")
48
- ssl_buffer = render :template => File.read(file)
49
- buffer += ssl_buffer
50
- end
51
-
52
- put buffer, "#{shared_path}/httpd.conf", :mode => 0444
53
- send(run_method, "cp #{shared_path}/httpd.conf #{apache_conf}")
54
- delete "#{shared_path}/httpd.conf"
55
-
56
- deprec.append_to_file_if_missing('/usr/local/apache2/conf/httpd.conf', 'NameVirtualHost *:80')
57
- end
58
-
59
- desc "Start Apache "
60
- task :start_apache, :roles => :web do
61
- send(run_method, "#{apache_ctl} start")
62
- end
63
-
64
-
65
- desc "Restart Apache "
66
- task :apache_restart, :roles => :web do
67
- restart_apache
68
- end
69
-
70
- task :restart_apache, :roles => :web do # deprecated
71
- send(run_method, "#{apache_ctl} restart")
72
- end
73
-
74
- desc "Stop Apache "
75
- task :stop_apache, :roles => :web do
76
- send(run_method, "#{apache_ctl} stop")
77
- end
78
-
79
- desc "Reload Apache "
80
- task :reload_apache, :roles => :web do
81
- send(run_method, "#{apache_ctl} reload")
82
- end
83
-
84
- def set_apache_conf
85
- if apache_default_vhost
86
- set :apache_conf, "/usr/local/apache2/conf/default.conf" unless apache_default_vhost_conf
87
- else
88
- set :apache_conf, "/usr/local/apache2/conf/apps/#{application}.conf" unless apache_conf
89
- end
90
- end
91
-
92
- end
@@ -1,73 +0,0 @@
1
- require 'yaml'
2
- require 'capistrano'
3
- require 'capistrano/cli'
4
-
5
- module MySQLMethods
6
-
7
- def execute(sql, user)
8
- user = 'root'
9
- run "mysql --user=#{user} -p --execute=\"#{sql}\"" do |channel, stream, data|
10
- handle_mysql_password(user, channel, stream, data)
11
- end
12
- end
13
-
14
- def create_database(db_name, user = nil, pass = nil)
15
- sql = ["CREATE DATABASE IF NOT EXISTS #{db_name};"]
16
- sql << "GRANT ALL PRIVILEGES ON #{user}.* TO #{user}@localhost" if user
17
- sql << " IDENTIFIED BY '#{pass}'" if pass
18
- sql << ';'
19
- sql << 'flush privileges;'
20
- mysql.execute sql, mysql_admin
21
- end
22
-
23
- private
24
- def handle_mysql_password(user, channel, stream, data)
25
- logger.info data, "[database on #{channel[:host]} asked for password]"
26
- if data =~ /^Enter password:/
27
- pass = Capistrano::CLI.password_prompt "Enter database password for '#{user}':"
28
- channel.send_data "#{pass}\n"
29
- end
30
- end
31
- end
32
-
33
- Capistrano.plugin :mysql, MySQLMethods
34
-
35
- Capistrano.configuration(:must_exist).load do
36
-
37
- set :mysql_admin, nil
38
-
39
- desc "Execute MySQL statements using --execute option. Set the 'sql' variable."
40
- task :execute_mysql, :roles => :db, :only => { :primary => true } do
41
- set_mysql_admin
42
- mysql.execute sql, mysql_admin
43
- end
44
-
45
- desc "Create MySQL database and user based on config/database.yml"
46
- task :setup_mysql, :roles => :db, :only => { :primary => true } do
47
- # on_rollback {}
48
-
49
- # rails puts "socket: /tmp/mysql.sock" into config/database.yml
50
- # this is not the location for our ubuntu's mysql socket file
51
- # so we create this link to make depployment using rails defaults simpler
52
- sudo "sudo ln -sf /var/run/mysqld/mysqld.sock /tmp/mysql.sock"
53
-
54
- set_mysql_admin
55
- read_config
56
-
57
- sql = "CREATE DATABASE IF NOT EXISTS #{db_name};"
58
- sql += "GRANT ALL PRIVILEGES ON #{db_name}.* TO #{db_user}@localhost IDENTIFIED BY '#{db_password}';"
59
- mysql.execute sql, mysql_admin
60
- end
61
-
62
- def read_config
63
- db_config = YAML.load_file('config/database.yml')
64
- set :db_user, db_config[rails_env]["username"]
65
- set :db_password, db_config[rails_env]["password"]
66
- set :db_name, db_config[rails_env]["database"]
67
- end
68
-
69
- def set_mysql_admin
70
- set :mysql_admin, user unless mysql_admin
71
- end
72
-
73
- end
@@ -1,80 +0,0 @@
1
- <VirtualHost <%= apache_ssl_ip %>:443>
2
-
3
- ServerName <%= apache_server_name %>
4
- <% apache_server_aliases_array.each do |a| %>
5
- ServerAlias <%= "#{a}" %>
6
- <% end %>
7
- DocumentRoot <%= "#{current_path}/public" %>
8
-
9
- <Directory <%= "#{current_path}/public" %>>
10
- Options FollowSymLinks
11
- AllowOverride None
12
- Order allow,deny
13
- Allow from all
14
- </Directory>
15
-
16
- # Configure mongrel_cluster
17
- <Proxy balancer://<%= "#{application}_cluster" %>>
18
- <% start_port = apache_proxy_port %>
19
- <% end_port = apache_proxy_port + apache_proxy_servers - 1 %>
20
- <% start_port.upto(end_port) do |port| %>
21
- BalancerMember http://<%= "#{apache_proxy_address}:#{port.to_s}" %>
22
- <% end %>
23
- </Proxy>
24
-
25
- RewriteEngine On
26
-
27
- # Prevent access to .svn directories
28
- RewriteRule ^(.*/)?\.svn/ - [F,L]
29
- ErrorDocument 403 "Access Forbidden"
30
-
31
- # Check for maintenance file and redirect all requests
32
- RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
33
- RewriteCond %{SCRIPT_FILENAME} !maintenance.html
34
- RewriteRule ^.*$ /system/maintenance.html [L]
35
-
36
- # Rewrite index to check for static
37
- RewriteRule ^/$ /index.html [QSA]
38
-
39
- # Rewrite to check for Rails cached page
40
- RewriteRule ^([^.]+)$ $1.html [QSA]
41
-
42
- # Redirect all non-static requests to cluster
43
- RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
44
- # Add header for Mongrel to set HTTPS environment for Rails
45
- RequestHeader set X-Forwarded-Proto "https"
46
- RewriteRule ^/(.*)$ balancer://<%= "#{application}_cluster" %>%{REQUEST_URI} [P,QSA,L]
47
-
48
- # Deflate
49
- AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
50
- BrowserMatch ^Mozilla/4 gzip-only-text/html
51
- BrowserMatch ^Mozilla/4\.0[678] no-gzip
52
- BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
53
-
54
- # SSL Engine Switch
55
- SSLEngine on
56
-
57
- # SSL Cipher Suite:
58
- SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
59
-
60
- # Server Certificate
61
- SSLCertificateFile /usr/local/apache2/conf/ssl.crt/<%= domain %>.crt
62
-
63
- # Server Private Key
64
- SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/<%= domain %>.key
65
-
66
- <% if apache_ssl_chainfile %>
67
- # Intermediate keys
68
- SSLCertificateChainFile /usr/local/apache2/conf/ssl.crt/<%= domain %>-chainfile.crt
69
- <% end %>
70
-
71
-
72
- BrowserMatch ".*MSIE.*" \
73
- nokeepalive ssl-unclean-shutdown \
74
- downgrade-1.0 force-response-1.0
75
-
76
- ErrorLog logs/<%= domain %>-error_log
77
- CustomLog logs/<%= domain %>-access_log combined
78
- CustomLog logs/<%= domain %>-ssl_log \
79
- "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
80
- </VirtualHost>
@@ -1,57 +0,0 @@
1
- <VirtualHost <%= apache_ssl_enabled ? apache_ssl_ip : "*" %>:80>
2
- ServerName <%= apache_server_name %>
3
- <% apache_server_aliases_array.each do |a| %>
4
- ServerAlias <%= "#{a}" %>
5
- <% end %>
6
- DocumentRoot <%= "#{current_path}/public" %>
7
-
8
- <Directory <%= "#{current_path}/public" %>>
9
- Options FollowSymLinks
10
- AllowOverride None
11
- Order allow,deny
12
- Allow from all
13
- </Directory>
14
-
15
- # Configure mongrel_cluster
16
- <Proxy balancer://<%= "#{application}_cluster" %>>
17
- <% start_port = apache_proxy_port %>
18
- <% end_port = apache_proxy_port + apache_proxy_servers - 1 %>
19
- <% start_port.upto(end_port) do |port| %>
20
- BalancerMember http://<%= "#{apache_proxy_address}:#{port.to_s}" %>
21
- <% end %>
22
- </Proxy>
23
-
24
- RewriteEngine On
25
-
26
- <% if apache_ssl_enabled && apache_ssl_forward_all %>
27
- RewriteRule ^(.*)$ https://<%= domain %>$1
28
- <% end %>
29
-
30
- # Prevent access to .svn directories
31
- RewriteRule ^(.*/)?\.svn/ - [F,L]
32
- ErrorDocument 403 "Access Forbidden"
33
-
34
- # Check for maintenance file and redirect all requests
35
- RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
36
- RewriteCond %{SCRIPT_FILENAME} !maintenance.html
37
- RewriteRule ^.*$ /system/maintenance.html [L]
38
-
39
- # Rewrite index to check for static
40
- RewriteRule ^/$ /index.html [QSA]
41
-
42
- # Rewrite to check for Rails cached page
43
- RewriteRule ^([^.]+)$ $1.html [QSA]
44
-
45
- # Redirect all non-static requests to cluster
46
- RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
47
- RewriteRule ^/(.*)$ balancer://<%= "#{application}_cluster" %>%{REQUEST_URI} [P,QSA,L]
48
-
49
- # Deflate
50
- AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
51
- BrowserMatch ^Mozilla/4 gzip-only-text/html
52
- BrowserMatch ^Mozilla/4\.0[678] no-gzip
53
- BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
54
-
55
- ErrorLog logs/<%= domain %>-error_log
56
- CustomLog logs/<%= domain %>-access_log combined
57
- </VirtualHost>
@@ -1,8 +0,0 @@
1
- # plugins.rb: Load all the Capistrano Plugins in the plugins directory.
2
-
3
- require 'rubygems'
4
-
5
- # Load plugins from the plugins directory
6
- Dir["#{File.dirname(__FILE__)}/plugins/*.rb"].sort.each do |plugin|
7
- load plugin
8
- end
@@ -1,144 +0,0 @@
1
- # =apt.rb: Debian 'apt' Installer library
2
- # Capistrano task library to install and manage apt packages
3
- #
4
- # ----
5
- # Copyright (c) 2006 Neil Wilson, Aldur Systems Ltd
6
- #
7
- # Licensed under the GNU Public License v2. No warranty is provided.
8
-
9
- require 'capistrano'
10
-
11
- # = Purpose
12
- # Apt is a Capistrano plugin module providing a set of methods
13
- # that invoke the *apt* package manager (as used in Debian and Ubuntu)
14
- #
15
- # Installs within Capistrano as the plugin _apt_.
16
- #
17
- # =Usage
18
- #
19
- # require 'vmbuilder/plugins/apt'
20
- #
21
- # Prefix all calls to the library with <tt>apt.</tt>
22
- #
23
- module Apt
24
-
25
- # Default apt-get command - reduces any interactivity to the minimum.
26
- APT_GET="DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND=noninteractive apt-get"
27
-
28
- # Default list of packages required to extract source packages.
29
- BACKPORT_REQUIRED={:base => %w(dpkg-dev debhelper devscripts fakeroot)}
30
-
31
- # Directory where any package compilation takes place.
32
- BUILD_DIR="/var/cache/backport/build"
33
-
34
- # Run the apt install program across the package list in 'packages'.
35
- # Select those packages referenced by <tt>:base</tt> and the +version+
36
- # of the distribution you want to use.
37
- def install(packages, version, options={})
38
- special_options="--allow-unauthenticated" if version != :stable
39
- cmd = <<-CMD
40
- sh -c "#{APT_GET} -qyu #{special_options.to_s} install #{package_list(packages, version)}"
41
- CMD
42
- sudo(cmd, options)
43
- end
44
-
45
- # Run an apt autoclean
46
- def autoclean(options={})
47
- cmd = <<-CMD
48
- sh -c "#{APT_GET} -qy autoclean"
49
- CMD
50
- sudo(cmd, options)
51
- end
52
-
53
- # Run an apt distribution upgrade
54
- def dist_upgrade(options={})
55
- cmd = <<-CMD
56
- sh -c "#{APT_GET} -qy dist-upgrade"
57
- CMD
58
- sudo(cmd, options)
59
- end
60
-
61
- # Run an apt upgrade. Use dist_upgrade instead if you want to upgrade
62
- # the critical base packages.
63
- def upgrade(options={})
64
- cmd = <<-CMD
65
- sh -c "#{APT_GET} -qy upgrade"
66
- CMD
67
- sudo(cmd, options)
68
- end
69
-
70
- # Run an apt update.
71
- def update(options={})
72
- cmd = <<-CMD
73
- sh -c "#{APT_GET} -qy update"
74
- CMD
75
- sudo(cmd, options)
76
- end
77
-
78
- # Update the apt control files using the files from the machine
79
- # which is running Capistrano. Set the default version to +version+
80
- def update_apt(version, myopts={})
81
- apt_fname="/etc/apt/apt.conf"
82
- sources_fname="/etc/apt/sources.list"
83
- pref_fname="/etc/apt/preferences"
84
- std.su_put("APT::Default-Release \"#{version.to_s}\";\n"+apt_conf, apt_fname, "/tmp", myopts)
85
- std.su_put(sources, sources_fname, "/tmp", myopts)
86
- std.su_put(preferences, pref_fname, '/tmp', myopts)
87
- end
88
-
89
- # Downloads the specified source module and the quoted dependencies
90
- # Compiles the module and installs it.
91
- #
92
- # If no dependencies are specified, runs an apt build-dep on the stable
93
- # package list in an attempt to locate them automatically.
94
- #
95
- # Alter the <tt>deb-src</tt> line in <tt>sources.list</tt> file to
96
- # determine which distribution source files are retrieved from.
97
- def backport_to_stable(packages, dependencies={})
98
- install(BACKPORT_REQUIRED, :stable)
99
- if dependencies.empty?
100
- sudo <<-CMD
101
- sh -c "#{APT_GET} -qyu build-dep #{package_list(packages, :stable)}"
102
- CMD
103
- else
104
- install(dependencies, :stable)
105
- end
106
- patch_gcc
107
- sudo <<-SUDO
108
- sh -c "[ -d #{BUILD_DIR} ] || { mkdir -p #{BUILD_DIR} && chown #{user || ENV['USER']} #{BUILD_DIR}; }"
109
- SUDO
110
- sudo <<-CMD
111
- sh -c "cd #{BUILD_DIR} &&
112
- if [ ! -f `apt-get --print-uris source #{package_list(packages, :stable)}| tail -n1 | cut -d' ' -f2` ]; then
113
- #{APT_GET} -qyub source #{package_list(packages, :stable)};
114
- fi;"
115
- CMD
116
- sudo "dpkg -i #{BUILD_DIR}/*.deb"
117
- end
118
-
119
- # Boot script manipulation command
120
- def rc_conf(packages, setting)
121
- packages.each do |service|
122
- sudo "sysv-rc-conf --level 2 #{service} #{setting}"
123
- end
124
- end
125
-
126
- private
127
-
128
- # Provides a string containing all the package names in the base
129
- #list plus those in +version+.
130
- def package_list(packages, version)
131
- packages[:base].to_a.join(' ') + ' ' + packages[version].to_a.join(' ')
132
- end
133
-
134
- # Stable likes to use gcc3.3. Force it to use 3.4 if it is installed.
135
- def patch_gcc
136
- sudo <<-CMD
137
- sh -c "[ ! -f /usr/bin/gcc-3.4 ] || ln -sf /usr/bin/gcc-3.4 /usr/local/bin/gcc"
138
- CMD
139
- end
140
-
141
- end
142
-
143
- Capistrano.plugin :apt, Apt
144
- # vim: nowrap sw=2 sts=2 ts=8 ff=unix ft=ruby: