pygmystack / haproxy

the pygmy stack - haproxy image
2 stars 2 forks source link

adding an extra proxy container fails to resolve #3

Open yhesse opened 1 year ago

yhesse commented 1 year ago

I have a docker-compose file with varnish + nginx. When I add a proxy (nginx) between varnish and the nginx container the stack is broken.

The reason for adding a proxy: This service serves as a proxy between Varnish and nginx. This allows Varnish to be hosted on a hosting environment separate from the application (nginx, php, ...), allowing for independent deployments and auto-scaling for both.

haproxy.cfg:

/app # cat haproxy.cfg
global
  daemon
  maxconn 1024
  pidfile /var/run/haproxy.pid
defaults
  balance roundrobin
  timeout client 600s
  timeout connect 600s
  timeout server 600s
  option http-server-close
frontend http
  mode http
  bind :80
  option forwardfor
  stats enable
  stats refresh 30s
  stats show-node
  stats uri  /stats
  use_backend http_mailhog.docker.amazee.io if { hdr_dom(host) -i mailhog.docker.amazee.io }
  use_backend http_wp-back-office-proxy-1.docker.amazee.io if { hdr_dom(host) -i wp-back-office-proxy-1.docker.amazee.io }
  use_backend http_bo.web-platform.docker.amazee.io if { hdr_dom(host) -i bo.web-platform.docker.amazee.io }
  use_backend http_nginx.bo.web-platform.docker.amazee.io if { hdr_dom(host) -i nginx.bo.web-platform.docker.amazee.io }
  use_backend http_rabbitmq-consumer.bo.web-platform.docker.amazee.io if { hdr_dom(host) -i rabbitmq-consumer.bo.web-platform.docker.amazee.io }
frontend https
  mode http
  bind *:443 ssl crt /app/server.pem
  reqadd X-Forwarded-Proto:\ https
  option socket-stats
  use_backend http_mailhog.docker.amazee.io if { hdr_dom(host) -i mailhog.docker.amazee.io }
  use_backend http_wp-back-office-proxy-1.docker.amazee.io if { hdr_dom(host) -i wp-back-office-proxy-1.docker.amazee.io }
  use_backend http_bo.web-platform.docker.amazee.io if { hdr_dom(host) -i bo.web-platform.docker.amazee.io }
  use_backend http_nginx.bo.web-platform.docker.amazee.io if { hdr_dom(host) -i nginx.bo.web-platform.docker.amazee.io }
  use_backend http_rabbitmq-consumer.bo.web-platform.docker.amazee.io if { hdr_dom(host) -i rabbitmq-consumer.bo.web-platform.docker.amazee.io }
backend http_mailhog.docker.amazee.io
  mode http
  # amazeeio-mailhog
  server 172.17.0.5:80 172.17.0.5:80 check
backend http_wp-back-office-proxy-1.docker.amazee.io
  mode http
  # wp-back-office-proxy-1
  server wp-back-office-proxy-1:8080 wp-back-office-proxy-1:8080 check
backend http_bo.web-platform.docker.amazee.io
  mode http
  # wp-back-office-varnish-1
  server wp-back-office-varnish-1:8080 wp-back-office-varnish-1:8080 check
backend http_nginx.bo.web-platform.docker.amazee.io
  mode http
  # wp-back-office-nginx-1
  server wp-back-office-nginx-1:8080 wp-back-office-nginx-1:8080 check
backend http_rabbitmq-consumer.bo.web-platform.docker.amazee.io
  mode http

Reloading:

/app # ./haproxy_reload.sh 
[WARNING] 106/092245 (237) : Setting tune.ssl.default-dh-param to 1024 by default, if your workload permits it you should set it to at least 2048. Please set a value >= 1024 to make this warning disappear.
[ALERT] 106/092245 (237) : parsing [/app/haproxy.cfg:45] : 'server wp-back-office-proxy-1:8080' : could not resolve address 'wp-back-office-proxy-1'.
[ALERT] 106/092245 (237) : Failed to initialize server(s) addr.

I work on a macbook pro with the M2 chip.