-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhaproxy.ctmpl
38 lines (33 loc) · 1.09 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
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /var/run/haproxy_admin.sock mode 660 level admin
pidfile /var/run/haproxy.pid
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 50000
timeout client 50000
timeout server 50000
resolvers consul
nameserver consul %%CONSUL_CLIENT_DNS%%
accepted_payload_size 8192
hold valid 3s
frontend http_front
bind *:80
use_backend %[req.hdr(host),lower,word(1,:)]
default_backend haproxy
backend haproxy
mode http
http-request set-log-level silent
errorfile 503 /etc/haproxy/static/default.html
{{ range $i, $service := services }}{{ range $tag := .Tags }}{{ if $tag | regexMatch "^domain=.+" }}{{ $domain := index (. | split "=") 1 }}{{ if $service.Tags | contains "edge" }}
backend {{$domain}}
server-template {{$service.Name}} 10 _{{$service.Name}}._tcp.service.consul resolvers consul resolve-opts allow-dup-ip resolve-prefer ipv4 check
{{end}}{{end}}{{end}}{{end}}