docker-archive / dockercloud-haproxy

HAproxy image that autoreconfigures itself when used in Docker Cloud
https://cloud.docker.com/
651 stars 187 forks source link

How do i get Haproxy to run by docker-compose not using Legacy Link #156

Closed moshhasa closed 7 years ago

moshhasa commented 7 years ago

So i have a version 2 compose.yml and when i run docker-compose up Haproxy reports

INFO:haproxy:Haproxy is running using legacy link, loading HAProxy definition from environment variables: unable to connect to docker daemon ('Connection aborted.', error(13, 'Permission denied'))
but i was expecting

INFO:haproxy:Haproxy is running by docker-compose, loading HAProxy definition through docker api

How do it get it to run by by docker-compose? Here is my compose.yml

version: '2'
services:
    admje:       
      image: comp.repos/deploy-war:latest
      ports:
        - "8051:8041"
        - "8851:8887"
      environment:
        - ENV_DB_HOST_NAME=host
        - ENV_DB_HOST_PORT=3891
        - ENV_DB_HOST_SID=SOMEID
        - ENV_DEAJAVIEW_CODEBASE=http://localhost:8041/Daeja
        - ENV_HELP_URL=http://localhost:8041/sys
        - ENV_DOCSTORE_URL=http://localhost:8044/document/rest/
        - ENV_JMS_NAMING=tcp://localhost:909090
        - ENV_EI_ADDRESS_URI=http://adei:8043/adei-qas/enterprise
        - ENV_HTTP_PORT=8041
        - ENV_HTTPS_PORT=18041
        - http_proxy=
        - https_proxy=
        - VIRTUAL_HOST=''
      restart: unless-stopped
      networks:
        net:
    admjewls:
      image: comp.repos/deploy-ear-wls:latest
      ports:
        - "8001:8001"
        - "8801:8453"
      environment:
        - envstore.url=http://production:8044/envstore
        - envNumber=102
        - jndi.datasource=jdbc/DEVDS
        - jndi.jms.naming.url=tcp://production:61616
        - JAVA_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8003
      restart: unless-stopped
      networks:
        net:
      restart: unless-stopped
      networks:
        net:
    haproxy:
      image: 'dockercloud/haproxy:1.6.2'
      ports:
        - "8080:80"
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
      environment:
        - EXTRA_GLOBAL_SETTINGS="debug"
        - STATS_PORT=1936
      links:
        - admje
        - admjewls
      networks:
        net:    
networks:
   net:

and here's the haproxy log

INFO:haproxy:dockercloud/haproxy 1.6.2 is running outside Docker Cloud
INFO:haproxy:Haproxy is running using legacy link, loading HAProxy definition from environment variables: unable to connect to docker daemon ('Connection aborted.', error(13, 'Permission denied'))
INFO:haproxy:dockercloud/haproxy PID: 7
INFO:haproxy:=> Add task: Initial start - Legacy Mode
INFO:haproxy:=> Executing task: Initial start - Legacy Mode
INFO:haproxy:==========BEGIN==========
INFO:haproxy:HAProxy configuration:
global
  log '127.0.0.1' local0
  log '127.0.0.1' local1 notice
  log-send-hostname
  maxconn 4096
  pidfile /var/run/haproxy.pid
  user haproxy
  group haproxy
  daemon
  stats socket /var/run/haproxy.stats level admin
defaults
  balance roundrobin

obal
  mode http
  option redispatch
  option httplog
  option dontlognull
  option forwardfor
  timeout connect 5000
  timeout client 50000
  timeout server 50000

tats

1936
  mode http
  stats enable
  timeout connect 10s
  timeout client 1m
  timeout server 1m
  stats hide-version
  stats realm Haproxy\ Statistics
  stats uri /
  stats auth "haproxy:haproxy"
INFO:haproxy:Launching HAProxy
INFO:haproxy:HAProxy has been launched(PID: 13)
INFO:haproxy:===========END===========
levino commented 6 years ago

@moshhasa How did you fix it?