Quick Start Guide Issue with Creating a Multi-Container Application

Hi, I was able to follow the quick start guide step-by-step to create a multi-container application on a console-only CentOS7 server, from where the Rancher server is launched. All services are up and running, but I can’t hit the CentOS7’s public IP to get to the loadbalancer. How can I route the traffic from the CentOS7 (public IP address) to the loadbalancer (in my case, 172.17.0.9) for the mywordpress service? I tried to put a haproxy on the CentOS7 to route the traffic to the loadbalancer, but doesn’t seem to work. Below are the yml’s retrieved from the RancherUI. Thanks in advance for any help!

docker-compose.yml

mywordpress:
  restart: always
  tty: true
  image: wordpress
  links:
  - database:mysql
  stdin_open: true
database:
  restart: always
  environment:
    MYSQL_ROOT_PASSWORD: pass1
  tty: true
  image: mysql
  stdin_open: true
wordpresslb:
  ports:
  - 80:80
  restart: always
  tty: true
  image: rancher/load-balancer-service
  links:
  - mywordpress:mywordpress
  stdin_open: true

rancher-compose.yml

mywordpress:
  scale: 2
database:
  scale: 1
wordpresslb:
  scale: 1
  load_balancer_config:
    name: wordpresslb config

I am able to take your exact docker-compose.yml and rancher-compose.yml files and import them into my version of Rancher (v0.42.0). From there, I can take the host IP that has the load balancer and access the wordpress container.

What happens when you access the host IP? Is there an error (503) or a blank page?

Thanks for your reply Denise! Below is a brief description of a pseudo deployment topology. When I access http://192.168.0.100, I got “This web page is not available” error with “ERR_CONNECTION_REFUSED” when using Google Chrome, basically, 504, can’t reach out to the LB.

Client - Google Chrome on Windows (192.168.0.10)
Linux VM (CentOS7, 192.168.0.100)
Rancher Host (172.17.0.9)
  wordpresslb service - lb agent(10.42.126.40)
  mywordpress service - Default_mywordpress_1(10.42.214.176), Default_mywordpress_2(10.42.161.50)
  database service - Default_Database_1(10.42.72.129)

Now, I did make it working by setting up a haproxy on the Linux VM (192.168.0.100) to route the traffic from 192.168.0.100 to 10.42.126.40, with the haproxy.cfg look like the following:

# cat haproxy.cfg
global
    log         127.0.0.1 local2

    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

    # turn on stats unix socket
    stats socket /var/lib/haproxy/stats

defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
    option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    10s
    timeout queue           1m
    timeout connect         10s
    timeout client          1m
    timeout server          1m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000

frontend  main *:80
    default_backend             app

backend app
    balance     roundrobin
    server  app1 10.42.126.40:80 check

Is this the way to go, or, should it be a more elegant way without the haproxy?

Thanks again for looking into this!

You definitely shouldn’t have to launch with haproxy as the load balancer is already running haproxy software and should be working.

Can you look at the troubleshooting docs to check your haproxy.cfg for the load balancer?

http://docs.rancher.com/rancher/faqs/troubleshooting/#load-balancer

@denise - The last two sections of the haproxy.cfg file for the LB (10.42.126.40) container would look something like the following:

frontend 1a9b7308-805a-4212-abf0-8a80bce80b58_frontend
        bind 10.42.126.40:80
        mode http

        default_backend 1a9b7308-805a-4212-abf0-8a80bce80b58_0_backend

backend 1a9b7308-805a-4212-abf0-8a80bce80b58_0_backend
        mode http
        balance roundrobin
        server 171c9673-908f-4343-b1d5-35c6eaa04e90 10.42.214.176:80
        server e6db7bf6-a9a6-4a0b-b9d6-0f9368ecb542 10.42.161.50:80

Once again, here’s the topology:

Client - Google Chrome on Windows (192.168.0.10)
Linux VM (CentOS7, 192.168.0.100)
Rancher Host (172.17.0.9)
wordpresslb service - lb agent(10.42.126.40)
mywordpress service - Default_mywordpress_1(10.42.214.176), Default_mywordpress_2(10.42.161.50)
database service - Default_Database_1(10.42.72.129)

So, from the outter Linux VM (IP: 192.168.0.100), it doesn’t seem to have a route to the inner LB (10.42.126.40). Or, am I missing something important here?

Hi, @denise, do you have any thoughts based on the posted haproxy configuration retrieved from the load balancer container?

Re-looking at your set up, it looks like your Rancher host has picked up the docker bridge IP instead of the actual IP of the host.

Do you only have 1 host with all the containers on the host?

http://docs.rancher.com/rancher/faqs/troubleshooting/#cross-host-communication

Thanks for looking into it… Correct, I only had one host with all the containers on it, and I followed the quick start guide to the teeth.

Can you confirm if the host has the correct IP or the docker bridge IP? You can set the IP specifically by following the docs for setting up a host on the same VM as rancher server.

http://docs.rancher.com/rancher/rancher-ui/infrastructure/hosts/custom/#samehost

I am having ERR_CONNECTION_REFUSED Problem in myc Pc