version: '2.1'

volumes:
    broker:
        driver: local
    app:
        driver: local
    db:
        driver: local
    results:
        driver: local

services:
  broker:
    container_name: mayan-edms-broker
    image: healthcheck/rabbitmq
    environment:
      RABBITMQ_DEFAULT_USER: mayan
      RABBITMQ_DEFAULT_PASS: mayan
      RABBITMQ_DEFAULT_VHOST: mayan
    volumes:
      - broker:/var/lib/rabbitmq
  results:
    container_name: mayan-edms-results
    image: healthcheck/redis
    volumes:
      - results:/data
  #db:
  #  container_name: mayan-edms-db
  #  image: healthcheck/mysql
  #  environment:
  #    MYSQL_DATABASE: mayan
  #    MYSQL_PASSWORD: mayan-password
  #    MYSQL_ROOT_PASSWORD: root-password
  #    MYSQL_USER: mayan
  #  volumes:
  #    - db:/var/lib/mysql
  db:
    container_name: mayan-edms-db
    image: healthcheck/postgres
    environment:
      POSTGRES_DB: mayan
      POSTGRES_PASSWORD: mayan-password
      POSTGRES_USER: mayan
    volumes:
      - db:/var/lib/postgresql/data
  mayan-edms:
    container_name: mayan-edms-app
    image: mayan-edms/next
    build:
      context: ./
      args:
        - APT_PROXY=172.18.0.1:3142
    depends_on:
      broker:
        condition: service_healthy
      db:
        condition: service_healthy
      results:
        condition: service_healthy
    environment:
      MAYAN_BROKER_URL: amqp://mayan:mayan@broker:5672/mayan
      MAYAN_CELERY_RESULT_BACKEND: redis://results:6379/0
      MAYAN_DATABASE_ENGINE: django.db.backends.postgresql
      MAYAN_DATABASE_HOST: db
      MAYAN_DATABASE_NAME: mayan
      MAYAN_DATABASE_PASSWORD: mayan-password
      MAYAN_DATABASE_USER: mayan
    ports:
      - "80:80"
    volumes:
      - app:/var/lib/mayan
