# Struggling with load balancer

**URL:** <https://forums.suse.com/t/struggling-with-load-balancer/9598>\
**Category:** Rancher 1.x\
**Created:** [February 22, 2018, 7:03pm UTC](https://forums.suse.com/t/struggling-with-load-balancer/9598 "2018-02-22T19:03:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Peacock](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/andrew_peacock/32/3724_2.png) [@Andrew\_Peacock](https://forums.suse.com/u/Andrew_Peacock)\
**Post date:** [February 22, 2018, 7:03pm UTC](https://forums.suse.com/t/struggling-with-load-balancer/9598/1 "2018-02-22T19:03:26Z")

</div>

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](http://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

---

<div class="post-metadata">

**Author:** ![Andrew\_Peacock](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/andrew_peacock/32/3724_2.png) [@Andrew\_Peacock](https://forums.suse.com/u/Andrew_Peacock)\
**Post date:** [February 22, 2018, 7:04pm UTC](https://forums.suse.com/t/struggling-with-load-balancer/9598/2 "2018-02-22T19:04:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![superseb](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/superseb/32/2424_2.png) [@superseb](https://forums.suse.com/u/superseb)\
**Post date:** [March 8, 2018, 10:17pm UTC](https://forums.suse.com/t/struggling-with-load-balancer/9598/3 "2018-03-08T22:17:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Andrew\_Peacock](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/andrew_peacock/32/3724_2.png) [@Andrew\_Peacock](https://forums.suse.com/u/Andrew_Peacock)\
**Post date:** [March 10, 2018, 12:01pm UTC](https://forums.suse.com/t/struggling-with-load-balancer/9598/4 "2018-03-10T12:01:00Z")

</div>

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
