version: "3.3"
# for users:
#       /usr/bin/docker-compose -f docker-compose-production.yaml --env-file env/env-envoy.txt pull && docker-compose -f docker-compose-production.yaml --env=env/env-envoy.txt up -d
#
#for old docker-compose which do not support --env-file option copy the ../env/env-envoy.txt and ../env/env.txt into .env file in the current directory
#installing docker-compose sudo curl -L "https://github.com/docker/compose/releases/download/1.28.6/docker-compose-$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose
#https://docs.docker.com/compose/environment-variables/#substitute-environment-variables-in-compose-files && #https://docs.docker.com/compose/env-file/
#Internal services - ext_authz-http-service (these 2 are redundant - access-logs-grpc-service - metrics-grpc-service)

volumes:
  appsentinels_onprem_config: {}

services:
  front-service:
    image: appsentinels/front-proxy:latest
    hostname: appsentinels-frontproxy
    networks:
      - onprem-mesh
    ports:
      - "${ENVOY_EXTERNAL_ADMIN_PORT}:${ENVOY_EXTERNAL_ADMIN_PORT}"
      - "${ENVOY_EXTERNAL_DATA_LISTENING_PORT}:${ENVOY_LISTENING_PORT}"
    logging:
      driver: syslog
      options:
        tag: appsentinels-envoy
    env_file:
      - ./env/env-envoy.txt
    volumes:
      - /var/crash:/var/crash

  onprem_controller:
    image: appsentinels/ng-controller:latest
    hostname: appsentinels-opc-frontproxy
    restart: on-failure:5
    env_file:
      - ./env/env.txt
    environment:
      - --cap-add=CAP_SYS_ADMIN_TEST
    networks:
      onprem-mesh:
        aliases:
          - ext_authz-http-service
    #network_mode: "host"
    ports:
      - "${ENVOY_AUTHZ_SERVICE_PORT}:${ENVOY_AUTHZ_SERVICE_PORT}"
      - "${ENVOY_ACCESS_LOG_SERVICE_PORT}:${ENVOY_ACCESS_LOG_SERVICE_PORT}"
      - "${ENVOY_METRICS_SERVICE_PORT}:${ENVOY_METRICS_SERVICE_PORT}"
      - "${ONPREM_STATS_SERVICE_PORT}"
    logging:
      driver: local
      options:
        max-size: 10m        
    volumes:
      - appsentinels_onprem_config:/usr/local/appsentinels-onprem/config
      - /var/crash/:/var/crash
#     - /var/log/appsentinels/:/var/crash
      - /var/log/appsentinels/:/log
networks:
  onprem-mesh: {}
