-
Notifications
You must be signed in to change notification settings - Fork 0
/
haproxy.ctmpl
39 lines (35 loc) · 1.46 KB
/
haproxy.ctmpl
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
{{ scratch.Set "kv_config_prefix" (print "instances/" (env "INSTANCE_ID") "/services/lb-haproxy/") -}}
{{ scratch.Set "global_maxconn" (keyOrDefault (print (scratch.Get "kv_config_prefix") "maxconn") "") -}}
{{ scratch.Set "default_timeout_connect" (keyOrDefault (print (scratch.Get "kv_config_prefix") "default_timeouts/connect") "5000ms") -}}
{{ scratch.Set "default_timeout_client" (keyOrDefault (print (scratch.Get "kv_config_prefix") "default_timeouts/client") "5000ms") -}}
{{ scratch.Set "default_timeout_server" (keyOrDefault (print (scratch.Get "kv_config_prefix") "default_timeouts/server") "5000ms") -}}
global
daemon
{{- if (scratch.Get "global_maxconn")}}
maxconn {{scratch.Get "global_maxconn"}}
{{else}}
{{end -}}
ssl-default-bind-options no-sslv3 no-tls-tickets force-tlsv12
ssl-default-bind-ciphers AES128+EECDH:AES128+EDH
defaults
mode http
default_backend backends
timeout connect {{scratch.Get "default_timeout_connect"}}
timeout client {{scratch.Get "default_timeout_client"}}
timeout server {{scratch.Get "default_timeout_server"}}
listen stats
bind 127.0.0.1:8080
stats enable
stats hide-version
stats refresh 30s
stats show-node
stats uri /haproxy?stats
frontend www
bind *:80
mode http
default_backend backends
backend backends
mode http
balance roundrobin
{{range (ls (print (scratch.Get "kv_config_prefix") "backends"))}}
server {{.Key}} {{.Value}} check{{end}}