- RabbitMQ
- Redis
- Web Server/Ingress
Last active
September 3, 2022 18:22
-
-
Save dogukancagatay/2c483246bbe3897763d73c98dd878927 to your computer and use it in GitHub Desktop.
Basic HAProxy Setup for Multiple Services with Docker
This file contains 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
version: "3" | |
services: | |
haproxy: | |
image: haproxy:2.1-alpine | |
container_name: ingress-haproxy | |
volumes: | |
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro | |
ports: | |
- 8406:8404 | |
- 80:80 | |
- 443:443 | |
- 5672:5672 | |
- 15672:15672 | |
- 6379:6379 | |
restart: unless-stopped | |
This file contains 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 local1 | |
maxconn 50000 | |
defaults | |
log global | |
mode tcp | |
option tcplog | |
retries 3 | |
option redispatch | |
option log-health-checks | |
timeout connect 3s | |
timeout client 6s | |
timeout server 6s | |
listen stats | |
bind *:8404 | |
mode http | |
option http-use-htx | |
http-request use-service prometheus-exporter if { path /metrics } | |
stats enable | |
stats uri /stats | |
stats refresh 10s | |
listen lb-tcp-1 | |
bind *:80 | |
mode tcp | |
balance leastconn | |
option tcplog | |
option tcp-check | |
server srv-01 srv-01:80 check inter 5s | |
server srv-02 srv-02:80 check inter 5s | |
listen lb-tcp-2 | |
bind *:443 | |
mode tcp | |
balance leastconn | |
option tcplog | |
option tcp-check | |
server srv-01 srv-01:443 check inter 5s | |
server srv-02 srv-02:443 check inter 5s | |
listen rabbitmq | |
bind *:5672 | |
mode tcp | |
balance leastconn | |
option tcplog | |
option tcp-check | |
option clitcpka | |
timeout client 3h | |
timeout server 3h | |
server srv-01 srv-01:5672 check inter 5s | |
server srv-02 srv-02:5672 check inter 5s | |
listen rabbitmq-http | |
bind *:15672 | |
mode http | |
balance roundrobin | |
option httplog | |
option httpchk | |
server srv-01 srv-01:15672 check inter 5s | |
server srv-02 srv-02:15672 check inter 5s | |
listen keydb | |
bind *:6379 name redis | |
mode tcp | |
balance first | |
option tcplog | |
option tcp-check | |
#uncomment these lines if you have basic auth | |
#tcp-check send AUTH\ yourpassword\r\n | |
#tcp-check expect +OK | |
tcp-check send PING\r\n | |
tcp-check expect string +PONG | |
tcp-check send info\ replication\r\n | |
tcp-check expect string role:active-replica | |
tcp-check send QUIT\r\n | |
tcp-check expect string +OK | |
server srv-01 srv-01:6379 check inter 1s | |
server srv-02 srv-02:6379 check inter 1s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment