-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhaproxy.cfg
144 lines (123 loc) · 4.07 KB
/
haproxy.cfg
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
global
log stdout format raw local0
maxconn 4096
user haproxy
group haproxy
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
timeout tunnel 3600s # Add this for WebSocket support
frontend stats
mode http
bind *:8404
stats enable
stats uri /stats
stats refresh 10s
stats admin if TRUE
frontend http
bind *:80
# ACLs for different services
acl host_adminer hdr(host) -i adminer.twir.app
acl host_temporal hdr(host) -i temporal.twir.app
acl host_eventsub hdr(host) -i eventsub.twir.app
acl host_music_recognizer hdr(host) -i music-recognizer.twir.app
acl host_bots hdr(host) -i services-bots.twir.app
acl host_twir hdr(host) -i twir.app
# Path-based ACLs
acl path_api_old path_beg /api-old
acl path_api path_beg /api
acl path_dashboard path_beg /dashboard
acl path_overlays path_beg /overlays
acl path_socket path_beg /socket
# Combined routing rules
use_backend adminer if host_adminer
use_backend temporal if host_temporal
use_backend eventsub if host_eventsub
use_backend music_recognizer if host_music_recognizer
use_backend bots if host_bots
# Combined host and path rules
use_backend api_old if host_twir path_api_old
use_backend api if host_twir path_api
use_backend dashboard if host_twir path_dashboard
use_backend overlays if host_twir path_overlays
use_backend socket if host_twir path_socket
use_backend web if host_twir !path_api !path_dashboard !path_overlays !path_socket !path_api_old
backend adminer
mode http
balance roundrobin
option tcp-check
server-template adminer- 1-10 twir_adminer:8080 check resolvers docker init-addr none
backend temporal
mode http
balance roundrobin
option tcp-check
server-template temporal-ui- 1-10 twir_temporal-ui:8080 check resolvers docker init-addr none
backend api_old
mode http
balance roundrobin
option tcp-check
http-request set-path %[path,regsub(^/api-old/,/)]
server-template api_old- 1-10 twir_api:3002 check resolvers docker init-addr none
backend api
mode http
balance roundrobin
option tcp-check
http-request set-path %[path,regsub(^/api/,/)]
server-template api-gql- 1-10 twir_api-gql:3009 check resolvers docker init-addr none
backend bots
mode http
balance roundrobin
option tcp-check
server-template bots- 1-10 twir_bots:3000 check resolvers docker init-addr none
backend dashboard
mode http
balance roundrobin
option tcp-check
http-request set-path %[path,regsub(^/dashboard/,/)]
server-template dashboard- 1-10 twir_dashboard:8080 check resolvers docker init-addr none
backend overlays
mode http
balance roundrobin
option tcp-check
http-request set-path %[path,regsub(^/overlays/,/)]
server-template overlays- 1-10 twir_overlays:8080 check resolvers docker init-addr none
backend music_recognizer
mode http
balance roundrobin
option tcp-check
server-template music-recognizer- 1-10 twir_music-recognizer:3000 check resolvers docker init-addr none
backend web
mode http
balance roundrobin
option tcp-check
server-template web- 1-10 twir_web:3000 check resolvers docker init-addr none
backend eventsub
mode http
balance roundrobin
option tcp-check
server-template eventsub- 1-10 twir_eventsub:3003 check resolvers docker init-addr none
backend socket
mode http
balance roundrobin
option tcp-check
option http-server-close
option forwardfor
http-request set-header X-Forwarded-Proto http
http-request set-path %[path,regsub(^/socket/,/)]
# WebSocket specific settings
timeout tunnel 3600s
timeout server 3600s
option http-pretend-keepalive
server-template websockets- 1-10 twir_websockets:3004 check resolvers docker init-addr none
resolvers docker
nameserver dns 127.0.0.11:53
resolve_retries 3
hold valid 5s
hold timeout 1s
hold other 1s
timeout retry 1s