# Load balancer not working at all

**URL:** <https://forums.suse.com/t/load-balancer-not-working-at-all/3128>\
**Category:** General\
**Created:** [June 15, 2016, 5:35pm UTC](https://forums.suse.com/t/load-balancer-not-working-at-all/3128 "2016-06-15T17:35:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sirmurei](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@sirmurei](https://forums.suse.com/u/sirmurei)\
**Post date:** [June 15, 2016, 5:35pm UTC](https://forums.suse.com/t/load-balancer-not-working-at-all/3128/1 "2016-06-15T17:35:18Z")

</div>

Was hoping to receive some help with this.

 ![](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/c/c217501e229cb2ea8e53da1c07310c6fb1359049.png)

I have a ghost and wordpress stack, built from the catalog. I have wordpress running on port 5000, and ghost running on port 5001. I can visit each application by using the hostip:port.

I’ve set up a 3rd stack which contains the loadbalancer service. Here is how that is set up:

**docker-compose.yml:**

```
lb:
  ports:
  - 80:80
  external_links:
  - ghost/ghost:ghost
  - wordpress/wordpress:wordpress
  labels:
    io.rancher.loadbalancer.target.wordpress/wordpress: wordpress.dev=5000
    io.rancher.loadbalancer.target.ghost/ghost: ghost.dev=5001
  tty: true
  image: rancher/load-balancer-service
  stdin_open: true

```

**haproxy.cfg:**

```
root@593ced489b04:/# cat /etc/haproxy/haproxy.cfg
global
        log 127.0.0.1 local0
        log 127.0.0.1 local1 notice
        maxconn 4096
        maxpipes 1024
        chroot /var/lib/haproxy
        user haproxy
        group haproxy
        daemon

defaults
        log global
        mode tcp
        option tcplog
        option dontlognull
        option redispatch
        option http-server-close
        option forwardfor
        retries 3
        timeout connect 5000
        timeout client 50000
        timeout server 50000
        errorfile 400 /etc/haproxy/errors/400.http
        errorfile 403 /etc/haproxy/errors/403.http
        errorfile 408 /etc/haproxy/errors/408.http
        errorfile 500 /etc/haproxy/errors/500.http
        errorfile 502 /etc/haproxy/errors/502.http
        errorfile 503 /etc/haproxy/errors/503.http
        errorfile 504 /etc/haproxy/errors/504.http

frontend b13b9617-cefe-4318-af84-27cd77e8c082_80_frontend
        bind *:80
        mode http

                acl 0_host hdr(host) -i wordpress.dev
                acl 0_host hdr(host) -i wordpress.dev:80
        use_backend b13b9617-cefe-4318-af84-27cd77e8c082_80_0_backend if 0_host
                acl 1_host hdr(host) -i ghost.dev
                acl 1_host hdr(host) -i ghost.dev:80
        use_backend b13b9617-cefe-4318-af84-27cd77e8c082_80_1_backend if 1_host

backend b13b9617-cefe-4318-af84-27cd77e8c082_80_0_backend
        mode http
        server d65bc1ec-4acd-4e3b-a9be-382a498c1d14 10.42.236.134:5000

backend b13b9617-cefe-4318-af84-27cd77e8c082_80_1_backend
        mode http
        server 3c3d3a67-4137-45e4-abfe-8ed37bc97384 10.42.83.148:5001

listen default
        bind *:42

```

When visiting ghost.dev or wordpress.dev I get a 503 Service Unavailable error. I’ve tried restarting everything and building from scratch on a new host. What have I done wrong?

---

<div class="post-metadata">

**Author:** ![sirmurei](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@sirmurei](https://forums.suse.com/u/sirmurei)\
**Post date:** [June 17, 2016, 9:57am UTC](https://forums.suse.com/t/load-balancer-not-working-at-all/3128/2 "2016-06-17T09:57:47Z")

</div>

![](https://us1.discourse-cdn.com/flex022/uploads/suse/original/2X/7/720d75d6e6ef627f0f2ae2b9bf80d5f3464c6a2e.png)

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [June 20, 2016, 10:06pm UTC](https://forums.suse.com/t/load-balancer-not-working-at-all/3128/3 "2016-06-20T22:06:35Z")

</div>

The target ports `5001` and `5000` are not actually exposed/open on the ghost/wordpress containers. The load balancer goes directly to the containers of the service.

---

<div class="post-metadata">

**Author:** ![cloudlady911](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/cloudlady911/32/782_2.png) [@cloudlady911](https://forums.suse.com/u/cloudlady911)\
**Post date:** [June 21, 2016, 3:12pm UTC](https://forums.suse.com/t/load-balancer-not-working-at-all/3128/4 "2016-06-21T15:12:28Z")

</div>

In other words, you have to point your entry in the load balancer to the INTERNAL port the app is running on. The Ghost app from the catalog runs on 2368 internally so you would point your load balancer entry at that port.

---

<div class="post-metadata">

**Author:** ![sirmurei](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@sirmurei](https://forums.suse.com/u/sirmurei)\
**Post date:** [June 22, 2016, 7:09am UTC](https://forums.suse.com/t/load-balancer-not-working-at-all/3128/5 "2016-06-22T07:09:30Z")

</div>

Thanks to the both of you, it’s working perfectly now.
