deprec 1.9.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +280 -0
- data/COPYING +19 -0
- data/LICENSE +339 -0
- data/README +152 -0
- data/THANKS +17 -0
- data/bin/depify +128 -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/{README.quickstart → deprec-1.x/deprec-1.x.quickstart} +4 -1
- data/docs/{building_edge_capistrano.txt → deprec-1.x/notes.txt} +6 -3
- 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 +8 -1
- data/lib/deprec/capistrano_extensions.rb +442 -0
- data/lib/deprec/recipes.rb +50 -233
- data/lib/deprec/recipes/aoe.rb +79 -0
- data/lib/deprec/recipes/app/mongrel.rb +213 -0
- data/lib/deprec/recipes/app/passenger.rb +197 -0
- data/lib/deprec/recipes/apt_mirror.rb +99 -0
- data/lib/deprec/recipes/ar_sendmail.rb +67 -0
- data/lib/deprec/recipes/canonical.rb +68 -0
- data/lib/deprec/recipes/db/mysql.rb +144 -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 +199 -0
- data/lib/deprec/recipes/deprecated.rb +71 -0
- data/lib/deprec/recipes/example.rb +115 -0
- data/lib/deprec/recipes/git.rb +97 -0
- data/lib/deprec/recipes/gitosis.rb +48 -0
- data/lib/deprec/recipes/heartbeat.rb +138 -0
- data/lib/deprec/recipes/logrotate.rb +54 -0
- data/lib/deprec/recipes/lvm.rb +20 -0
- data/lib/deprec/recipes/memcache.rb +6 -2
- data/lib/deprec/recipes/monit.rb +143 -0
- data/lib/deprec/recipes/nagios.rb +305 -0
- data/lib/deprec/recipes/network.rb +93 -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/rails.rb +300 -55
- data/lib/deprec/recipes/ruby/mri.rb +55 -0
- data/lib/deprec/recipes/ruby/ree.rb +41 -0
- data/lib/deprec/recipes/sphinx.rb +86 -0
- data/lib/deprec/recipes/ssh.rb +85 -18
- data/lib/deprec/recipes/ssl.rb +55 -0
- data/lib/deprec/recipes/starling.rb +119 -0
- data/lib/deprec/recipes/svn.rb +163 -183
- data/lib/deprec/recipes/trac.rb +239 -62
- data/lib/deprec/recipes/ubuntu.rb +18 -100
- 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 +119 -0
- data/lib/deprec/recipes/web/nginx.rb +172 -0
- data/lib/deprec/recipes/wordpress.rb +96 -0
- data/lib/deprec/recipes/wpmu.rb +103 -0
- data/lib/deprec/recipes/xen.rb +267 -0
- data/lib/deprec/recipes/xentools.rb +75 -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/apt/sources.list +18 -0
- data/lib/deprec/templates/apt_mirror/apt-mirror-cron +4 -0
- data/lib/deprec/templates/apt_mirror/mirror.list +33 -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/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/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/logrotate/logrotate.conf.erb +32 -0
- data/lib/deprec/templates/mongrel/apache_vhost.erb +148 -0
- data/lib/deprec/templates/mongrel/logrotate.conf.erb +11 -0
- data/lib/deprec/{third_party/mongrel_cluster/resources/mongrel_cluster → templates/mongrel/mongrel_cluster-init-script} +19 -6
- 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.erb +41 -0
- data/lib/deprec/templates/monit/monit-init-script +104 -0
- data/lib/deprec/templates/monit/monitrc.erb +227 -0
- data/lib/deprec/templates/monit/nothing +0 -0
- data/lib/deprec/templates/mysql/create_databases.sql +20 -0
- data/lib/deprec/templates/mysql/database.yml.prod +6 -0
- data/lib/deprec/templates/mysql/database.yml.stage +6 -0
- data/lib/deprec/templates/mysql/my.cnf.erb +140 -0
- data/lib/deprec/templates/mysql/sphinx.conf.prod +542 -0
- data/lib/deprec/templates/mysql/sphinx.conf.stage +542 -0
- data/lib/deprec/templates/nagios/cgi.cfg.erb +321 -0
- data/lib/deprec/templates/nagios/check_linux_free_memory.pl +118 -0
- data/lib/deprec/templates/nagios/check_mongrel_cluster.rb +82 -0
- data/lib/deprec/templates/nagios/commands.cfg.erb +240 -0
- data/lib/deprec/templates/nagios/contacts.cfg.erb +57 -0
- data/lib/deprec/templates/nagios/hosts.cfg.erb +143 -0
- data/lib/deprec/templates/nagios/htpasswd.users +1 -0
- data/lib/deprec/templates/nagios/localhost.cfg.erb +157 -0
- data/lib/deprec/templates/nagios/nagios.cfg.erb +1274 -0
- data/lib/deprec/templates/nagios/nagios_apache_vhost.conf.erb +45 -0
- data/lib/deprec/templates/nagios/nrpe.cfg.erb +210 -0
- data/lib/deprec/templates/nagios/nrpe.xinetd.erb +16 -0
- data/lib/deprec/templates/nagios/resource.cfg.erb +34 -0
- data/lib/deprec/templates/nagios/services.cfg.erb +79 -0
- data/lib/deprec/templates/nagios/templates.cfg.erb +9 -0
- data/lib/deprec/templates/nagios/timeperiods.cfg.erb +94 -0
- data/lib/deprec/templates/network/hostname.erb +1 -0
- data/lib/deprec/templates/network/hosts.erb +2 -0
- data/lib/deprec/templates/network/interfaces.erb +18 -0
- data/lib/deprec/templates/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 +21 -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.conf → postfix/main.cf.erb} +6 -8
- data/lib/deprec/templates/postfix/master.cf.erb +77 -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/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/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/15-disable-hwclock +40 -0
- data/lib/deprec/templates/xentools/40-setup-networking +145 -0
- data/lib/deprec/templates/xentools/xen-tools.conf.erb +276 -0
- data/lib/deprec/templates/xentools/xm.tmpl.erb +138 -0
- data/lib/deprec_cmd_completion.sh +26 -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/{deprec/third_party/vmbuilder/plugins → vmbuilder_plugins}/gem.rb +10 -17
- data/lib/{deprec/third_party/vmbuilder/plugins → vmbuilder_plugins}/std.rb +69 -19
- metadata +204 -55
- data/bin/deprec +0 -35
- data/docs/README.slicehost +0 -14
- data/docs/README.svn_trac +0 -19
- data/lib/deprec/capistrano_extensions/actor_extensions.rb +0 -89
- data/lib/deprec/capistrano_extensions/cli_extensions.rb +0 -38
- data/lib/deprec/capistrano_extensions/deprec_extensions.rb +0 -137
- data/lib/deprec/generators/deprec/USAGE +0 -11
- data/lib/deprec/generators/deprec/deprec_generator.rb +0 -24
- data/lib/deprec/generators/deprec/templates/deploy.rb +0 -90
- data/lib/deprec/generators/loader.rb +0 -20
- data/lib/deprec/recipes/apache.rb +0 -91
- data/lib/deprec/recipes/cache_svn.rb +0 -74
- data/lib/deprec/recipes/vmware.rb +0 -114
- data/lib/deprec/templates/trac.ini.erb +0 -106
- data/lib/deprec/third_party/THIRD_PARTY_README +0 -12
- data/lib/deprec/third_party/mongrel_cluster/LICENSE +0 -506
- data/lib/deprec/third_party/mongrel_cluster/recipes.rb +0 -96
- data/lib/deprec/third_party/railsmachine/LICENSE +0 -506
- data/lib/deprec/third_party/railsmachine/recipes/apache.rb +0 -92
- data/lib/deprec/third_party/railsmachine/recipes/mysql.rb +0 -73
- data/lib/deprec/third_party/railsmachine/recipes/templates/httpd-ssl.conf +0 -80
- data/lib/deprec/third_party/railsmachine/recipes/templates/httpd.conf +0 -57
- data/lib/deprec/third_party/vmbuilder/plugins.rb +0 -8
- data/lib/deprec/third_party/vmbuilder/plugins/apt.rb +0 -144
- data/resources/capistrano_include_dotfiles.patch +0 -17
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# /etc/apt/sources.list
|
3
|
+
#
|
4
|
+
|
5
|
+
|
6
|
+
#
|
7
|
+
# gutsy
|
8
|
+
#
|
9
|
+
deb http://<%= apt_mirror_hostname %>/ubuntu gutsy main restricted universe multiverse
|
10
|
+
deb http://archive.ubuntu.com/ubuntu gutsy-updates main restricted universe multiverse
|
11
|
+
deb http://security.ubuntu.com/ubuntu gutsy-security main restricted universe
|
12
|
+
|
13
|
+
deb-src http://archive.ubuntu.com/ubuntu gutsy main restricted universe
|
14
|
+
deb-src http://archive.ubuntu.com/ubuntu gutsy-updates main restricted universe
|
15
|
+
deb-src http://security.ubuntu.com/ubuntu gutsy-security main restricted universe
|
16
|
+
|
17
|
+
|
18
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
############# config ##################
|
2
|
+
#
|
3
|
+
# set base_path /var/spool/apt-mirror
|
4
|
+
#
|
5
|
+
# if you change the base path you must create the directories below with write privlages
|
6
|
+
#
|
7
|
+
# set mirror_path $base_path/mirror
|
8
|
+
# set skel_path $base_path/skel
|
9
|
+
# set var_path $base_path/var
|
10
|
+
# set cleanscript $var_path/clean.sh
|
11
|
+
# set defaultarch <running host architecture>
|
12
|
+
set nthreads 20
|
13
|
+
set _tilde 0
|
14
|
+
#
|
15
|
+
############# end config ##############
|
16
|
+
|
17
|
+
<% Array(apt_releases_to_mirror).each do |release| %>
|
18
|
+
# <%= release %>
|
19
|
+
deb http://archive.ubuntu.com/ubuntu <%= release %> main restricted universe multiverse
|
20
|
+
#deb http://archive.ubuntu.com/ubuntu <%= release %>-updates main restricted universe multiverse
|
21
|
+
#deb http://archive.ubuntu.com/ubuntu <%= release %>-backports main restricted universe multiverse
|
22
|
+
#deb http://archive.ubuntu.com/ubuntu <%= release %>-security main restricted universe multiverse
|
23
|
+
#deb http://archive.ubuntu.com/ubuntu <%= release %>-proposed main restricted universe multiverse
|
24
|
+
|
25
|
+
deb-src http://archive.ubuntu.com/ubuntu <%= release %> main restricted universe multiverse
|
26
|
+
#deb-src http://archive.ubuntu.com/ubuntu <%= release %>-updates main restricted universe multiverse
|
27
|
+
#deb-src http://archive.ubuntu.com/ubuntu <%= release %>-backports main restricted universe multiverse
|
28
|
+
#deb-src http://archive.ubuntu.com/ubuntu <%= release %>-security main restricted universe multiverse
|
29
|
+
#deb-src http://archive.ubuntu.com/ubuntu <%= release %>-proposed main restricted universe multiverse
|
30
|
+
<% end %>
|
31
|
+
|
32
|
+
clean http://archive.ubuntu.com/ubuntu
|
33
|
+
|
@@ -0,0 +1,5 @@
|
|
1
|
+
check process ar_sendmail-<%= application %> with pidfile <%= current_path %>/tmp/pids/ar_sendmail.pid
|
2
|
+
start program = "/usr/local/sbin/daemonize -c <%= current_path %> -o <%= current_path %>/log/ar_sendmail.log -e <%= current_path %>/log/ar_sendmail.log -p <%= current_path %>/tmp/pids/ar_sendmail.pid -l <%= current_path %>/tmp/pids/ar_sendmail.pid /usr/local/bin/ar_sendmail --environment production --verbose"
|
3
|
+
stop program = "/usr/bin/xargs kill -9 < <%= current_path %>/tmp/pids/ar_sendmail.pid"
|
4
|
+
|
5
|
+
if 3 restarts within 5 cycles then timeout
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Configuration file for ddclient generated by deprec
|
2
|
+
#
|
3
|
+
# /etc/ddclient.conf
|
4
|
+
|
5
|
+
pid=/var/run/ddclient.pid
|
6
|
+
protocol=dyndns2
|
7
|
+
use=if, if=<%= ddclient_interface %>
|
8
|
+
server=members.dyndns.org
|
9
|
+
login=<%= ddclient_user %>
|
10
|
+
password='<%= ddclient_pass %>'
|
11
|
+
<%= Array(ddclient_domains).join(',') %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Configuration for ddclient scripts
|
2
|
+
# generated from debconf on Sun Jan 18 09:20:43 UTC 2009
|
3
|
+
#
|
4
|
+
# /etc/default/ddclient
|
5
|
+
|
6
|
+
# Set to "true" if ddclient should be run every time a new ppp connection is
|
7
|
+
# established. This might be useful, if you are using dial-on-demand
|
8
|
+
run_ipup="true"
|
9
|
+
|
10
|
+
# Set to "true" if ddclient should run in daemon mode
|
11
|
+
run_daemon="true"
|
12
|
+
|
13
|
+
# Set the time interval between the updates of the dynamic DNS name in seconds.
|
14
|
+
# This option only takes effect if the ddclient runs in daemon mode.
|
15
|
+
daemon_interval="300"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
ssh_options[:paranoid] = false
|
2
|
+
ssh_options[:forward_agent] = true
|
3
|
+
|
4
|
+
|
5
|
+
# Just import the general purpose tasks
|
6
|
+
require '/deprec/general_purpose' if respond_to?(:namespace)
|
7
|
+
|
8
|
+
# Enable all deprec tasks all the time. This will change the
|
9
|
+
# behviour of some standard cap tasks (like 'cap deploy') so
|
10
|
+
# only enable it if you know what you're doing!
|
11
|
+
#
|
12
|
+
# require 'deprec/recipes' unless respond_to?(:namespace)
|
13
|
+
|
14
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# http://linux-ha.org/ha.cf
|
2
|
+
logfacility daemon
|
3
|
+
keepalive 1
|
4
|
+
deadtime 10
|
5
|
+
warntime 5
|
6
|
+
initdead 120 # depend on your hardware
|
7
|
+
udpport 694
|
8
|
+
ping <%= heartbeat_ping %>
|
9
|
+
bcast <%= heartbeat_bcast %>
|
10
|
+
auto_failback <%= heartbeat_auto_failback %>
|
11
|
+
<% heartbeat_nodes.each do |node| -%>
|
12
|
+
node <%= node %>
|
13
|
+
<% end -%>
|
14
|
+
respawn hacluster /usr/lib/heartbeat/ipfail
|
15
|
+
use_logd yes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= heartbeat_preferred_node %> <%= heartbeat_resources %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# see "man logrotate" for details
|
2
|
+
# rotate log files weekly
|
3
|
+
weekly
|
4
|
+
|
5
|
+
# keep 4 weeks worth of backlogs
|
6
|
+
rotate 4
|
7
|
+
|
8
|
+
# create new (empty) log files after rotating old ones
|
9
|
+
create
|
10
|
+
|
11
|
+
# uncomment this if you want your log files compressed
|
12
|
+
#compress
|
13
|
+
|
14
|
+
# packages drop log rotation information into this directory
|
15
|
+
include /etc/logrotate.d
|
16
|
+
|
17
|
+
# no packages own wtmp, or btmp -- we'll rotate them here
|
18
|
+
/var/log/wtmp {
|
19
|
+
missingok
|
20
|
+
monthly
|
21
|
+
create 0664 root utmp
|
22
|
+
rotate 1
|
23
|
+
}
|
24
|
+
|
25
|
+
/var/log/btmp {
|
26
|
+
missingok
|
27
|
+
monthly
|
28
|
+
create 0664 root utmp
|
29
|
+
rotate 1
|
30
|
+
}
|
31
|
+
|
32
|
+
# system-specific logs may be configured here
|
@@ -0,0 +1,148 @@
|
|
1
|
+
<VirtualHost *:80>
|
2
|
+
ServerName <%= domain %>
|
3
|
+
<%- 4.times do |counter| -%>
|
4
|
+
ServerAlias <%= domain.sub(/.*?\./, "assets#{counter}.") %>
|
5
|
+
<%- end %>
|
6
|
+
DocumentRoot <%= "#{current_path}/public" %>
|
7
|
+
ErrorLog <%= apache_log_dir %>/<%= domain %>-error_log
|
8
|
+
CustomLog <%= apache_log_dir %>/<%= domain %>-access_log combined
|
9
|
+
|
10
|
+
<Directory <%= "#{current_path}/public" %>>
|
11
|
+
Options FollowSymLinks
|
12
|
+
AllowOverride None
|
13
|
+
Order allow,deny
|
14
|
+
Allow from all
|
15
|
+
</Directory>
|
16
|
+
|
17
|
+
<Proxy *>
|
18
|
+
Order deny,allow
|
19
|
+
Allow from all
|
20
|
+
</Proxy>
|
21
|
+
|
22
|
+
# Configure mongrel_cluster
|
23
|
+
<Proxy balancer://<%= "#{application}_cluster" %>>
|
24
|
+
<%- mongrel_servers.times do |counter| -%>
|
25
|
+
BalancerMember http://<%= "127.0.0.1:#{mongrel_port+counter}" %>
|
26
|
+
<%- end -%>
|
27
|
+
</Proxy>
|
28
|
+
|
29
|
+
RewriteEngine On
|
30
|
+
|
31
|
+
<%- if apache_ssl_enabled && apache_ssl_forward_all -%>
|
32
|
+
RewriteRule ^(.*)$ https://<%= domain %>$1
|
33
|
+
<%- else -%>
|
34
|
+
# Prevent access to .svn directories
|
35
|
+
RewriteRule ^(.*/)?\.svn/ - [F,L]
|
36
|
+
ErrorDocument 403 "Access Forbidden"
|
37
|
+
|
38
|
+
# Check for maintenance file and redirect all requests
|
39
|
+
RewriteCond %{REQUEST_URI} !\.(css|jpg|png|gif)$
|
40
|
+
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
|
41
|
+
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
|
42
|
+
RewriteRule ^.*$ /system/maintenance.html [L]
|
43
|
+
|
44
|
+
# Rewrite index to check for static
|
45
|
+
RewriteRule ^/$ /index.html [QSA]
|
46
|
+
|
47
|
+
# Rewrite to check for Rails cached page
|
48
|
+
RewriteRule ^([^.]+)$ $1.html [QSA]
|
49
|
+
|
50
|
+
# Redirect all non-static requests to cluster
|
51
|
+
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
|
52
|
+
RewriteRule ^/(.*)$ balancer://<%= "#{application}_cluster" %>%{REQUEST_URI} [P,QSA,L]
|
53
|
+
|
54
|
+
# Deflate
|
55
|
+
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
|
56
|
+
BrowserMatch ^Mozilla/4 gzip-only-text/html
|
57
|
+
BrowserMatch ^Mozilla/4\.0[678] no-gzip
|
58
|
+
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
|
59
|
+
<%- end -%>
|
60
|
+
</VirtualHost>
|
61
|
+
|
62
|
+
|
63
|
+
<% if apache_ssl_enabled %>
|
64
|
+
<VirtualHost <%= apache_ssl_ip ? apache_ssl_ip : '*' %>:443>
|
65
|
+
ServerName <%= domain %>
|
66
|
+
<%- 4.times do |counter| -%>
|
67
|
+
ServerAlias <%= domain.sub(/.*?\./, "assets#{counter}.") %>
|
68
|
+
<%- end %>
|
69
|
+
DocumentRoot <%= "#{current_path}/public" %>
|
70
|
+
ErrorLog <%= apache_log_dir %>/<%= domain %>-error_log
|
71
|
+
CustomLog <%= apache_log_dir %>/<%= domain %>-access_log combined
|
72
|
+
CustomLog <%= apache_log_dir %>/<%= domain %>-ssl_log \
|
73
|
+
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
|
74
|
+
|
75
|
+
<Directory <%= "#{current_path}/public" %>>
|
76
|
+
Options FollowSymLinks
|
77
|
+
AllowOverride None
|
78
|
+
Order allow,deny
|
79
|
+
Allow from all
|
80
|
+
</Directory>
|
81
|
+
|
82
|
+
<Proxy *>
|
83
|
+
Order deny,allow
|
84
|
+
Allow from all
|
85
|
+
</Proxy>
|
86
|
+
|
87
|
+
# Configure mongrel_cluster
|
88
|
+
<Proxy balancer://<%= "#{application}_cluster" %>>
|
89
|
+
<%- mongrel_servers.times do |counter| -%>
|
90
|
+
BalancerMember http://<%= "127.0.0.1:#{mongrel_port+counter}" %>
|
91
|
+
<%- end -%>
|
92
|
+
</Proxy>
|
93
|
+
|
94
|
+
RewriteEngine On
|
95
|
+
|
96
|
+
# Prevent access to .svn directories
|
97
|
+
RewriteRule ^(.*/)?\.svn/ - [F,L]
|
98
|
+
ErrorDocument 403 "Access Forbidden"
|
99
|
+
|
100
|
+
# Prevent access to .git directories
|
101
|
+
RewriteRule ^(.*/)?\.git/ - [F,L]
|
102
|
+
ErrorDocument 403 "Access Forbidden"
|
103
|
+
|
104
|
+
# Check for maintenance file and redirect all requests
|
105
|
+
RewriteCond %{REQUEST_URI} !\.(css|jpg|png|gif)$
|
106
|
+
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
|
107
|
+
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
|
108
|
+
RewriteRule ^.*$ /system/maintenance.html [L]
|
109
|
+
|
110
|
+
# Rewrite index to check for static
|
111
|
+
RewriteRule ^/$ /index.html [QSA]
|
112
|
+
|
113
|
+
# Rewrite to check for Rails cached page
|
114
|
+
RewriteRule ^([^.]+)$ $1.html [QSA]
|
115
|
+
|
116
|
+
# Redirect all non-static requests to cluster
|
117
|
+
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
|
118
|
+
# Add header for Mongrel to set HTTPS environment for Rails
|
119
|
+
RequestHeader set X-Forwarded-Proto "https"
|
120
|
+
RewriteRule ^/(.*)$ balancer://<%= "#{application}_cluster" %>%{REQUEST_URI} [P,QSA,L]
|
121
|
+
|
122
|
+
# Deflate
|
123
|
+
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
|
124
|
+
BrowserMatch ^Mozilla/4 gzip-only-text/html
|
125
|
+
BrowserMatch ^Mozilla/4\.0[678] no-gzip
|
126
|
+
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
|
127
|
+
|
128
|
+
# SSL Engine Switch
|
129
|
+
SSLEngine on
|
130
|
+
|
131
|
+
# SSL Cipher Suite:
|
132
|
+
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
|
133
|
+
|
134
|
+
# Server Certificate
|
135
|
+
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
|
136
|
+
|
137
|
+
# Server Private Key
|
138
|
+
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
|
139
|
+
|
140
|
+
<% if apache_ssl_chainfile %>
|
141
|
+
# Intermediate keys
|
142
|
+
SSLCertificateChainFile /usr/local/apache2/conf/ssl.crt/<%= domain %>-chainfile.crt
|
143
|
+
<% end %>
|
144
|
+
|
145
|
+
BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
|
146
|
+
|
147
|
+
</VirtualHost>
|
148
|
+
<% end %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
#
|
3
|
-
# Copyright (c)
|
3
|
+
# Copyright (c) 2007 Bradley Taylor, bradley@railsmachine.com
|
4
4
|
#
|
5
5
|
# mongrel_cluster Startup script for Mongrel clusters.
|
6
6
|
#
|
@@ -9,9 +9,14 @@
|
|
9
9
|
# behind a load balancer.
|
10
10
|
#
|
11
11
|
|
12
|
+
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local:/usr/local/sbin:/usr/local/bin
|
12
13
|
CONF_DIR=/etc/mongrel_cluster
|
13
|
-
|
14
|
+
PID_DIR=/var/run/mongrel_cluster
|
15
|
+
# USER=mongrel
|
16
|
+
|
17
|
+
EVENT=1
|
14
18
|
|
19
|
+
RETVAL=0
|
15
20
|
|
16
21
|
# Gracefully exit if the controller is missing.
|
17
22
|
which mongrel_cluster_ctl >/dev/null || exit 0
|
@@ -21,7 +26,11 @@ which mongrel_cluster_ctl >/dev/null || exit 0
|
|
21
26
|
|
22
27
|
case "$1" in
|
23
28
|
start)
|
24
|
-
|
29
|
+
# Create pid directory
|
30
|
+
mkdir -p $PID_DIR
|
31
|
+
# chown $USER:$USER $PID_DIR
|
32
|
+
|
33
|
+
mongrel_cluster_ctl start --clean -c $CONF_DIR
|
25
34
|
RETVAL=$?
|
26
35
|
;;
|
27
36
|
stop)
|
@@ -29,13 +38,17 @@ case "$1" in
|
|
29
38
|
RETVAL=$?
|
30
39
|
;;
|
31
40
|
restart)
|
32
|
-
mongrel_cluster_ctl restart -c $CONF_DIR
|
41
|
+
mongrel_cluster_ctl restart --clean -c $CONF_DIR
|
42
|
+
RETVAL=$?
|
43
|
+
;;
|
44
|
+
status)
|
45
|
+
mongrel_cluster_ctl status -c $CONF_DIR
|
33
46
|
RETVAL=$?
|
34
47
|
;;
|
35
48
|
*)
|
36
|
-
echo "Usage: mongrel_cluster {start|stop|restart}"
|
49
|
+
echo "Usage: mongrel_cluster {start|stop|restart|status}"
|
37
50
|
exit 1
|
38
51
|
;;
|
39
52
|
esac
|
40
53
|
|
41
|
-
exit $RETVAL
|
54
|
+
exit $RETVAL
|
@@ -0,0 +1,10 @@
|
|
1
|
+
---
|
2
|
+
user: <%= app_user %>
|
3
|
+
group: <%= app_group %>
|
4
|
+
cwd: <%= current_path %>
|
5
|
+
log_file: <%= mongrel_log_dir %>/mongrel.log
|
6
|
+
port: "<%= mongrel_port.to_s %>"
|
7
|
+
environment: <%= mongrel_environment %>
|
8
|
+
address: <%= mongrel_address %>
|
9
|
+
pid_file: <%= mongrel_pid_dir %>/mongrel.pid
|
10
|
+
servers: <%= mongrel_servers.to_s %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% mongrel_servers.times do |counter| -%>
|
2
|
+
check process mongrel-<%=mongrel_port+counter%> with pidfile <%= mongrel_pid_dir %>/mongrel.<%=mongrel_port+counter%>.pid
|
3
|
+
group mongrel_<%= application %>
|
4
|
+
start program = "/usr/local/bin/ruby /usr/local/bin/mongrel_rails cluster::start --clean -C <%= mongrel_conf %> --only <%=mongrel_port+counter%>"
|
5
|
+
stop program = "/usr/local/bin/ruby /usr/local/bin/mongrel_rails cluster::stop -C <%= mongrel_conf %> --only <%=mongrel_port+counter%>"
|
6
|
+
|
7
|
+
if failed host 127.0.0.1 port <%=mongrel_port+counter%> protocol http
|
8
|
+
with timeout 10 seconds
|
9
|
+
then alert
|
10
|
+
|
11
|
+
if totalmem > 100 Mb then restart
|
12
|
+
if cpu > 60% for 2 cycles then alert
|
13
|
+
if cpu > 80% for 5 cycles then restart
|
14
|
+
if loadavg(5min) > 10 for 8 cycles then restart
|
15
|
+
if 3 restarts within 5 cycles then timeout
|
16
|
+
|
17
|
+
<% end -%>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
upstream <%= application %> {
|
2
|
+
<% mongrel_servers.times do |counter| -%>
|
3
|
+
<%= "server 127.0.0.1:#{mongrel_port+counter};" %>
|
4
|
+
<% end -%>
|
5
|
+
}
|
6
|
+
|
7
|
+
server {
|
8
|
+
listen 80;
|
9
|
+
server_name <%= domain %> <% 4.times do |counter| %> <%= domain.sub(/.*?\./, "assets#{counter}.") %><% end %>;
|
10
|
+
root <%= deploy_to %>/current/public;
|
11
|
+
access_log <%= deploy_to %>/shared/log/<%= domain %>-access.log;
|
12
|
+
error_log <%= deploy_to %>/shared/log/<%= domain %>-error.log;
|
13
|
+
client_max_body_size <%= nginx_client_max_body_size %>;
|
14
|
+
|
15
|
+
if (-f $document_root/system/maintenance.html){
|
16
|
+
rewrite ^(.*)$ /system/maintenance.html last;
|
17
|
+
break;
|
18
|
+
}
|
19
|
+
location / {
|
20
|
+
proxy_set_header X-Real-IP $remote_addr;
|
21
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
22
|
+
proxy_set_header Host $http_host;
|
23
|
+
proxy_redirect false;
|
24
|
+
|
25
|
+
if (-f $request_filename/index.html) {
|
26
|
+
rewrite (.*) $1/index.html break;
|
27
|
+
}
|
28
|
+
if (-f $request_filename.html) {
|
29
|
+
rewrite (.*) $1.html break;
|
30
|
+
}
|
31
|
+
if (!-f $request_filename) {
|
32
|
+
proxy_pass http://<%= application %>;
|
33
|
+
break;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
error_page 500 502 503 504 /50x.html;
|
38
|
+
location = /50x.html {
|
39
|
+
root html;
|
40
|
+
}
|
41
|
+
}
|