Skip to content

Commit

Permalink
Added the nginx conf.
Browse files Browse the repository at this point in the history
  • Loading branch information
benburkert committed Apr 8, 2009
1 parent e22330f commit eaf2521
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cookbooks/haproxy/attributes/haproxy.rb
@@ -1,7 +1,7 @@
haproxy Mash.new unless attribute?('haproxy')

haproxy[:user] = @attribute[:users].first[:username]
haproxy[:password] = @attribute[:users].first[:username]
haproxy[:password] = @attribute[:users].first[:password]
haproxy[:application] = @attribute[:applications].keys.first

haproxy[:upstream_port] = 5000
Expand Down
49 changes: 49 additions & 0 deletions cookbooks/haproxy/files/default/mashtags.conf
@@ -0,0 +1,49 @@
upstream mashtags_upstream {
server 127.0.0.1:5000;
}

server {
listen 80;

server_name hashtags.org;

root /data/mashtags/current/public;

access_log /var/log/engineyard/nginx/mashtags.access.log main;

error_log /var/log/engineyard/nginx/mashtags.error.log notice;
# error_log /dev/null notice;

include /etc/nginx/common/servers.conf;

include /etc/nginx/servers/mashtags.rewrites;
include /etc/nginx/servers/mashtags/custom.locations.conf;

location /monit {
proxy_pass http://127.0.0.1:9111/;
}

location / {
# auth is disabled for this server
# auth_basic "Restricted";
# auth_basic_user_file /etc/nginx/servers/mashtags.users;

include /etc/nginx/common/proxy.conf;

if (-f $request_filename) {
break;
}

if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}

if (!-f $request_filename) {
proxy_pass http://mashtags_upstream;
break;
}
}

location = /500.html {
root /data/mashtags/current/public;
}
7 changes: 7 additions & 0 deletions cookbooks/haproxy/recipes/default.rb
Expand Up @@ -30,6 +30,13 @@
not_if "/etc/init.d/haproxy status | grep 'status: started'"
end

remote_file "/etc/nginx/servers/mashtags.conf" do
source "mashtags.conf"
owner 'root'
group 'root'
mode 0644
end

execute 'restart-nginx' do
command %Q{
/etc/init.d/nginx restart
Expand Down
5 changes: 2 additions & 3 deletions cookbooks/haproxy/templates/default/haproxy.cfg.erb
Expand Up @@ -5,16 +5,15 @@ global

defaults
mode http
timeout client 10s
srvtimeout 3s
timeout client 3s
timeout server 15s
timeout connect 20ms

option httpclose
option abortonclose
option httpchk
option forwardfor


balance roundrobin

stats enable
Expand Down
2 changes: 0 additions & 2 deletions cookbooks/monit/recipes/default.rb
Expand Up @@ -7,8 +7,6 @@
command %Q{
rm /etc/monit.d/rm-mongrel_merb.#{node[:monit][:application]}.monitrc
}

not_if { not File.exists? "/etc/monit.d/rm-mongrel_merb.#{node[:monit][:application]}.monitrc"}
end

remote_file "/etc/monit.d/mashtags.mongrels.monitrc" do
Expand Down

0 comments on commit eaf2521

Please sign in to comment.