Struggling with load balancer

Hi,
I’m setting up a custom Wordpress build as the catalogue version has some issues with the way I’m using it.

So I’ve used the standard docker Wordpress and MariaDB images, and it’s working fine.

When I add the standard load-balancer in front of it, I get 503 errors. Can anyone help me get to the bottom of this please? I’ve tried every combination I can think of for mapping ports, with no resolution.

docker-compose.yml
version: '2’
services:
mariadb:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: XXXX
MYSQL_DATABASE: wordpress
MYSQL_USER: root
MYSQL_PASSWORD: XXXX
stdin_open: true
tty: true
labels:
io.rancher.container.pull_image: always
wordpress-lb:
image: rancher/lb-service-haproxy:v0.7.15
ports:
- 80:80/tcp
labels:
io.rancher.container.agent.role: environmentAdmin,agent
io.rancher.container.agent_service.drain_provider: 'true’
io.rancher.container.create_agent: 'true’
wordpress:
image: wordpress
environment:
WORDPRESS_DB_HOST: mariadb
WORDPRESS_DB_USER: XXXX
WORDPRESS_DB_PASSWORD: XXXXX
WORDPRESS_DB_NAME: wordpress
stdin_open: true
tty: true
labels:
io.rancher.container.pull_image: always

rancher-compose.yml
version: '2’
services:
mariadb:
scale: 1
start_on_create: true
wordpress-lb:
scale: 1
start_on_create: true
lb_config:
certs: []
port_rules:
- hostname: XXXX.com
path: ''
priority: 1
protocol: http
service: wordpress/wordpress
source_port: 80
target_port: 80
health_check:
healthy_threshold: 2
response_timeout: 2000
port: 42
unhealthy_threshold: 3
initializing_timeout: 60000
interval: 2000
reinitializing_timeout: 60000
wordpress:
scale: 1
start_on_create: true

Sorry, formatting on those is out. But they are formatted correctly as the services run without the load balancer.

If you specify the hostname, you have to hit the loadbalancer through that hostname. If you hit it by IP, you’ll get 503 (no vhost found/no backend found)

You can also check wordpress container is listening on 80.

Hi,
Thanks for getting back to me. I actually gave up in the end as I had another issue - the service I use to backup WP couldn’t do a restore from my old legacy site backup, to the docker version. So I went with a static IP for the site hosting on my normal website host. I got the load balancer working for the other services without issue though.
Andy