# This demonstration of containerbuddy has port mappings so we can use it
# on docker-machine locally.

consul:
    image: progrium/consul:latest
    command: >
      -server
      -bootstrap-expect 1
      -ui-dir /ui
    mem_limit: 256m
    expose:
    - 53
    - 8300
    - 8301
    - 8302
    - 8400
    - 8500
    - 8600
    ports:
    - 8500:8500
    restart: always

nginx:
    build: nginx/
    mem_limit: 512m
    expose:
    - 80
    links:
    - consul:consul
    ports:
    - 8080:80
    restart: always
    command: >
      /opt/containerbuddy/containerbuddy
      -config file:///opt/containerbuddy/nginx.json
      nginx -g "daemon off;"

app:
    build: app/
    mem_limit: 512m
    expose:
    - 8000
    links:
    - consul:consul
    ports:
    - 8000:8000
    restart: always
    command: >
      /opt/containerbuddy/containerbuddy
      -config file:///opt/containerbuddy/app.json
      /usr/local/bin/node /usr/local/bin/http-server /srv -p 8000

# This demonstration of containerbuddy has port mappings so we can use it
# on docker-machine locally.

consul:
    image: progrium/consul:latest
    command: >
      -server
      -bootstrap-expect 1
      -ui-dir /ui
    mem_limit: 256m
    expose:
    - 53
    - 8300
    - 8301
    - 8302
    - 8400
    - 8500
    - 8600
    ports:
    - 8500:8500
    restart: always

nginx:
    build: nginx/
    mem_limit: 512m
    expose:
    - 80
    links:
    - consul:consul
    ports:
    - 8080:80
    restart: always
    command: >
      /opt/containerbuddy/containerbuddy
      -config file:///opt/containerbuddy/nginx.json
      nginx -g "daemon off;"

app:
    build: app/
    mem_limit: 512m
    expose:
    - 8000
    links:
    - consul:consul
    ports:
    - 8000
    restart: always
    command: >
      /opt/containerbuddy/containerbuddy
      -config file:///opt/containerbuddy/app.json
      /usr/local/bin/node /usr/local/bin/http-server /srv -p 8000

Enable docker-compose to scale app.
Enable docker-compose to scale app.

The previous docker-compose-local.yml specified the host port for the app service.  As a result, running `docker-compose scale app=3` would fail because the second and third containers would attempt to bind to the same port on the docker host.  By removing the host portion of the port configuration, docker-compose chooses random port numbers for the host when scaling the app.
https://docs.docker.com/compose/compose-file/#ports
