version: '3.7'
services:
  proxy:
    image: dockercloud/haproxy
    depends_on:
      - web_app
    environment:
      - BALANCE=leastconn
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 80:80
      - 1936:1936
    networks:
      - prod
    deploy:
        placement:
          constraints: [node.role == manager]
  web_app:
    image: myrepo/web-app-as
    ports:
      - 5000
    depends_on:
      - aerospike
    hostname: prod.awesome-counter.com
    environment:
      - SERVICE_PORTS=5000
      - AEROSPIKE_HOST=aerospike
    networks:
      - prod
  aerospike:
    image: aerospike/aerospike-server
    volumes: 
      - $PWD:/etc/aerospike
    networks:
      - prod

networks:
  prod:
    driver: overlay
    attachable: true