I have a very basic test setup which doesn’t work and I was hoping someone can point me into the right directions
So, for this experiment I use a docker compose file (with Docker Swarm):
version: ‘3.8’
services:
backend:
image: nmatsui/hello-world-api
deploy:
replicas: 2
networks:
- ha_network
ports:
- "3000"
haproxy:
image: haproxy:latest
volumes:
- ./files/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
ports:
- "80:80"
networks:
- ha_network
networks:
ha_network:
driver: overlay
attachable: true
Now what happens when I start this, I see 2 backends spinning up, but haproxy won’t start complaining about the haproxy.cfg, which in my case is:
global
log stdout format raw local0
maxconn 4096
tune.ssl.default-dh-param 2048
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5s
timeout client 30s
timeout server 30s
retries 3
resolvers docker
nameserver dns 127.0.0.11:53
resolve_retries 3
timeout resolve 1s
timeout connect 1s
timeout server 5s
frontend http-in
bind *:80
default_backend app-backend
backend app-backend
balance roundrobin
option httpchk GET /health
server-template backend 1-10 backend:3000 check resolvers docker
The error is
[NOTICE] (1) : haproxy version is 3.0.5-8e879a5 [NOTICE] (1) : path to executable is /usr/local/sbin/haproxy [ALERT] (1) : config : parsing [/usr/local/etc/haproxy/haproxy.cfg:20] : ‘timeout’ expects ‘retry’ or ‘resolve’ and as arguments got ‘connect’. [ALERT]
(1) : config : parsing [/usr/local/etc/haproxy/haproxy.cfg:21] : ‘timeout’ expects ‘retry’ or ‘resolve’ and as arguments got ‘server’. [ALERT] (1) : config : parsing [/usr/local/etc/haproxy/haproxy.cfg:30]: Missing LF on last line, file might have been truncated at position 69. [ALERT] (1) : config : Error(s) found in configuration file : /usr/local/etc/haproxy/haproxy.cfg [ALERT] (1) : config : Fatal errors found in configuration.
So haproxy doesn’t say what exactly the problem is (I think it is in the last line). Any suggestions what the problem might be or how to debug this and where I can find more details about connecting HaProxy with replicas?