Docker Community Forums

Share and learn in the Docker community.

Linkin haproxy and varnish

dockerhub

(Helppier) #1

Hi,
I’m trying to link haproxy to a wordpress site that is behind varnish.
I’ve tried to use the stack file Blazing Wordpress but it didn’t work because the wordpress service didn’t had set the ‘WORDPRESS_DB_PASSWORD’ so I changed it and its working if I try to reach wordpress throught the varnish endpoint but if I try the haproxy endpoint I get a
"503 Service Unavailable - No server is available to handle this request".
Can anyone please help me?

Here is the slack file:

lb:
  deployment_strategy: high_availability
  image: 'dockercloud/haproxy:latest'
  links:
    - varnish
  ports:
    - '80:80'
  restart: always
  roles:
    - global
  tags:
    - node-tag
mysql:
  environment:
    - MYSQL_ROOT_PASSWORD=wordpress
  image: 'mysql:5.7'
  restart: always
  tags:
    - node-tag
  volumes:
    - '/host/path/to/mysql/data:/var/lib/mysql'
varnish:
  environment:
    - VARNISH_BACKEND_HOST=backend
    - VARNISH_BACKEND_PORT=80
    - VIRTUAL_HOST=example.com
  image: 'benhall/docker-varnish:latest'
  links:
    - 'wordpress:backend'
  ports:
    - '8080:80'
  restart: always
  tags:
    - node-tag
wordpress:
  environment:
    - WORDPRESS_DB_PASSWORD=wordpress
    - WORDPRESS_TABLE_PREFIX=wp_
  image: 'wordpress:4.3-apache'
  links:
    - mysql
  restart: always
  tags:
    - node-tag
  volumes:
    - '/host/path/to/wordpress:/var/www/html'

Thanks.
Best regards,
Hugo