forked from Signl/opsworks-web-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
haproxy.cfg.erb
47 lines (45 loc) · 2.32 KB
/
haproxy.cfg.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Dummy override config to avoid port conflicts.
global
#log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn <%= node[:haproxy][:global_max_connections] %>
#debug
#quiet
user haproxy
group haproxy
<% if node[:haproxy][:stats_socket_level] %>
stats socket <%= node[:haproxy][:stats_socket_path] %> level <%= node[:haproxy][:stats_socket_level] %>
<% else %>
stats socket <%= node[:haproxy][:stats_socket_path] %>
<% end %>
defaults
log global
mode http
option httplog
option dontlognull
retries <%= node[:haproxy][:retries] %>
option redispatch
maxconn <%= node[:haproxy][:default_max_connections] %>
timeout client <%= node[:haproxy][:client_timeout] %> # Client and server timeout must match the longest
timeout server <%= node[:haproxy][:server_timeout] %> # time we may wait for a response from the server.
timeout queue <%= node[:haproxy][:queue_timeout] %> # Don't queue requests too long if saturated.
timeout connect <%= node[:haproxy][:connect_timeout] %> # There's no reason to change this one.
timeout http-request <%= node[:haproxy][:http_request_timeout] %> # A complete request may never take that long.
<% if node[:haproxy][:httpclose] %>
option httpclose # disable keepalive (HAProxy does not yet support the HTTP keep-alive mode)
<% end %>
<% if node[:haproxy][:http_server_close] %>
option http-server-close # enable HTTP connection closing on the server side
<% end %>
option abortonclose # enable early dropping of aborted requests from pending queue
option httpchk # enable HTTP protocol to check on servers health
<% if node[:haproxy][:enable_stats] -%>
stats auth <%= node[:haproxy][:stats_user] %>:<%= node[:haproxy][:stats_password] %>
stats uri <%= node[:haproxy][:stats_url] %>
<% end -%>
listen application 0.0.0.0:8080
# configure a fake backend as long as there are no real ones
# this way HAProxy will not fail on a config check
balance <%= node[:haproxy][:balance] %>
server localhost 127.0.0.1:8081 weight 1 maxconn 5 check