version: '3'

services:
  mayan-app:
    image: mayanedms/mayanedms:latest
    container_name: mayan-app
    restart: unless-stopped
    depends_on:
      - mayan-postgres
      - mayan-redis
    environment:
      - MAYAN_DATABASES={"default":{"ENGINE":"django.db.backends.postgresql","NAME":"mayan","PASSWORD":"mayanuserpass","USER":"mayan","HOST":"mayan-postgres"}}
      - MAYAN_CELERY_BROKER_URL=redis://mayan-redis:6379/0
      - MAYAN_CELERY_RESULT_BACKEND=redis://mayan-redis:6379/1
    ports:
      - "8000:8000"
    volumes:
      - mayan_data:/var/lib/mayan
      - mayan_media:/var/lib/mayan/media
      - mayan_watch:/watch
    networks:
      - mayan-network

  mayan-postgres:
    image: postgres:13.4
    container_name: mayan-postgres
    restart: unless-stopped
    environment:
      - POSTGRES_DB=mayan
      - POSTGRES_USER=mayan
      - POSTGRES_PASSWORD=mayanuserpass
    volumes:
      - mayan_postgres_data:/var/lib/postgresql/data
    networks:
      - mayan-network

  mayan-redis:
    image: redis:6.2
    container_name: mayan-redis
    restart: unless-stopped
    command: ["redis-server", "--appendonly", "yes"]
    volumes:
      - mayan_redis_data:/data
    networks:
      - mayan-network

networks:
  mayan-network:
    driver: bridge

volumes:
  mayan_data:
  mayan_media:
  mayan_watch:
  mayan_postgres_data:
  mayan_redis_data: