Created
January 20, 2015 19:13
-
-
Save gswallow/533a6b25b33ef7cb075b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
log 127.0.0.1 local0 warning | |
log 127.0.0.1 local1 notice | |
maxconn 2000 | |
user haproxy | |
group haproxy | |
defaults | |
timeout client 10s | |
timeout server 10s | |
timeout connect 10s | |
log global | |
mode tcp | |
frontend srvs | |
maxconn 2000 | |
bind 0.0.0.0:10080 | |
default_backend backend_servers | |
backend backend_servers | |
mode tcp | |
server web02 10.250.216.161:80 | |
server web01 10.250.216.160:80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pool_members = search("node", "role:#{node['haproxy']['app_server_role']} AND chef_environment:#{node.chef_environment}") || [] | |
haproxy 'assaymatic' do | |
config Mash.new( | |
:global => { | |
:maxconn => 2000, | |
:user => node[:haproxy][:user], | |
:group => node[:haproxy][:group] | |
}, | |
:defaults => { | |
:log => :global, | |
:mode => :tcp | |
}, | |
:frontend => { | |
:srvs => { | |
:maxconn => 2000, | |
:bind => '0.0.0.0:10080', | |
:default_backend => :backend_servers | |
} | |
}, | |
:backend => { | |
:backend_servers => { | |
:mode => :tcp, | |
:server => pool_members.collect { |m| "#{m['hostname']} #{m['ipaddress']}:80" } | |
} | |
} | |
) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
log 127.0.0.1 local0 warning | |
log 127.0.0.1 local1 notice | |
maxconn 2000 | |
user haproxy | |
group haproxy | |
defaults | |
timeout client 10s | |
timeout server 10s | |
timeout connect 10s | |
log global | |
mode tcp | |
frontend | |
srvs maxconn 2000 | |
srvs bind 0.0.0.0:10080 | |
srvs default_backend backend_servers | |
backend | |
backend_servers mode tcp | |
backend_servers server web02 10.250.216.161:80 | |
backend_servers server web01 10.250.216.160:80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment