version: '3.4'

x-common-variables: &env
  DATABASE_HOST: arangodb
  DATABASE_PORT: 8529
  DATABASE_USERNAME: root
  ARANGO_ROOT_PASSWORD: test123
  ROOT_PASSWORD: agiquery.com

services:
  agiquery:
    image: agiquery/agiquery:latest
    container_name: agiquery
    environment: *env
    volumes:
      - agiquery_log:/var/log/agiquery
      - agiquery_cache:/var/lib/agiquery/cache
      - agiquery_download:/var/lib/agiquery/download
    healthcheck:
      test: [ "CMD", "/opt/agiquery/agiquery", "status" ]
      interval: 5s
      timeout: 15s
      retries: 5
    ports:
      - 8080:8000
    depends_on:
      - arangodb

  init-db:
    image: agiquery/agiquery:latest
    environment: *env
    command: "/opt/agiquery/agiquery init_db"
    depends_on:
      - arangodb

  arangodb:
    image: arangodb:latest
    environment:
      ARANGO_ROOT_PASSWORD: test123
    volumes:
      - arangodb_data_container:/var/lib/arangodb3
      - arangodb_apps_data_container:/var/lib/arangodb3-apps

volumes:
  agiquery_log:
  agiquery_cache:
  agiquery_download:
  arangodb_data_container:
  arangodb_apps_data_container: