version: '3'
services:
  postgresql-data:
    image: chefdemo/postgresql-data:stable
    volumes:
      - postgresql-data:/hab/svc/postgresql/data

  postgresql:
    image: chefdemo/postgresql:${VERSION:-stable}
    depends_on:
      - postgresql-data
    environment:
      HAB_POSTGRESQL: |
        [superuser]
        name = 'hab'
        password = 'chefrocks'
    ulimits:
      nproc: 65536
      nofile:
        soft: 65536
        hard: 65536
    volumes:
      - postgresql-data:/hab/svc/postgresql/data

  rabbitmq:
    image: chefdemo/rabbitmq:${VERSION:-stable}
    command: --peer postgresql
    depends_on:
      - postgresql
    environment:
      HAB_RABBITMQ: |
        [rabbitmq]
        default_vhost = '/insights'
        default_user = 'insights'
        default_pass = 'chefrocks'
        [rabbitmq.management]
        enabled = true

  elasticsearch:
    image: chefdemo/elasticsearch5:${VERSION:-stable}
    command: --peer postgresql
    depends_on:
      - postgresql

  logstash:
    image: chefdemo/logstash:${VERSION:-stable}
    command: --peer postgresql
      --bind elasticsearch:elasticsearch5.default
      --bind rabbitmq:rabbitmq.default
    depends_on:
      - postgresql

  workflow-server:
    image: chefdemo/workflow-server:${VERSION:-stable}
    command: --peer postgresql
      --bind database:postgresql.default
      --bind elasticsearch:elasticsearch5.default
      --bind rabbitmq:rabbitmq.default
    depends_on:
      - postgresql
    environment:
      HAB_WORKFLOW_SERVER: |
        enterprise = '${ENTERPRISE:-Demo}'
        default_admin_password = '${ADMIN_PASSWORD:-password}'
        [mlsa]
        accept = true
    volumes:
      - maintenance:/var/opt/delivery/delivery/etc

  notifications:
    image: chefdemo/notifications:${VERSION:-stable}
    command: --peer postgresql
      --bind elasticsearch:elasticsearch5.default
      --bind rabbitmq:rabbitmq.default
    depends_on:
      - postgresql

  compliance:
    image: chefdemo/compliance:${VERSION:-stable}
    command: --peer postgresql
      --bind postgresql:postgresql.default
      --bind elasticsearch:elasticsearch5.default
      --bind workflow:workflow-server.default
    depends_on:
      - postgresql
    environment:
      HAB_COMPLIANCE_SERVICE: |
        [service]
        host = "0.0.0.0"
        [profiles]
        secrets_key = "12345678901234567890123456789012"

  automate-nginx:
    image: chefdemo/automate-nginx:${VERSION:-stable}
    command: --peer postgresql
      --bind compliance:compliance.default
      --bind elasticsearch:elasticsearch5.default
      --bind workflow:workflow-server.default
      --bind notifications:notifications.default
    depends_on:
      - postgresql
    ports:
      - ${PILOT_HTTP_PORT:-80}:${PILOT_HTTP_PORT:-8080}
      - ${PILOT_HTTPS_PORT:-443}:${PILOT_HTTPS_PORT:-8443}
    environment:
      HAB_AUTOMATE_NGINX: |
        port = ${PILOT_HTTP_PORT:-8080}
        ssl_port = ${PILOT_HTTPS_PORT:-8443}
        [mlsa]
        accept = true
    volumes:
      - maintenance:/var/opt/delivery/delivery/etc

volumes:
  postgresql-data:
  maintenance:
