Docker Community Forums

Share and learn in the Docker community.

Haproxy working only one service

(Cheftestn) #1

i launched different types of services in single node and try to balance that services using haproxy in docker- cloud but it is failed it only configured and balanced only once service how to over come this problem

(Peter Pritchard) #2

for the haproxy instance, create a link to each service

  image: 'dockercloud/haproxy:latest'
    - api
    - application
    - dashboard
    - '80:80'
  restart: on-failure
    - global
    - front_end

the service need not publish, just expose a port and define VIRTUAL_HOST, VIRTUAL_PATH, etc … eg.

  image: 'johndoe/api:1.0.0'
    - 'VIRTUAL_HOST=api.*'
    - '3001'
    - memcached
    - mongo
    - redis
  restart: on-failure

(Cheftestn) #3

Hi Peter Pritchard,
in my application requirement is each service (like rabbitmq, redis, mongodb, and tomcat )is load balanced in haproxy and finally get tomcat application port 80 only

(Richard Adams) #4

hi @cheftestn, you might want to take a look at my project:

It might work better for your needs

(Peterlauri) #5

Does dockercloud-nginx-proxy support all configurations, ssl support etc? I read up quickly on the docs, but it looks limited to VIRTUAL_HOST and FORCE_SSL (using self-signed cert).

(Richard Adams) #6

@peterlauri sure, you’re right. it’s a niche setup and it’s more like an heroku style router

(Peterlauri) #7

Personally I prefer nginx, but I love Docker Cloud, so I guess HAproxy will be ok for now :slight_smile:

And it works quite well I must saw, after playing around for 24 hours, I got it all up and running. I have been fiddling around with other docker oriented approaches, like Convox etc, but Docker Cloud just makes things very clean…