version: '3.3'

services:
  frontend:
    container_name: drugstone_frontend
    image: gitlab.rrz.uni-hamburg.de:4567/cosy-bio/drugst.one/website:prod
    restart: always
    ports:
      - 8031:80
    networks:
      - drugstone
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
  backend:
    image: gitlab.rrz.uni-hamburg.de:4567/cosy-bio/drugst.one/backend:prod
    container_name: drugstone_backend
    command: 
      - "sh"
      - "scripts/docker-entrypoint.sh"
    env_file:
      - 'docker-django.env'
    restart: always
    volumes:
      - drugstone_db_schema_volume:/usr/src/drugstone/drugstone/migrations
      - drugstone_data_volume:/usr/src/drugstone/data
    ports:
      - 8032:8000
    networks:
      - drugstone
    depends_on:
      - db
      - redis
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
  db:
    image: postgres
    container_name: drugstone_postgres
    restart: always
    hostname: drugstone_postgres
#    ports:
#      - 5432:5432
    networks:
      - drugstone
    volumes:
      - drugstone_db_volume:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=drugstone
      - POSTGRES_USER=drugstone
      - POSTGRES_PASSWORD=t6278yczAH7rPKVMxaDD
    command: 
      - "postgres"
      - "-c" 
      - "max_connections=10000"
      - "-c"
      - "shared_buffers=2GB"
  redis:
    image: redis
    container_name: drugstone_redis
    restart: always
    command: ["redis-server"]
    networks:
      - drugstone
#    ports:
#      - 6379:6379
  celery:
    image: gitlab.rrz.uni-hamburg.de:4567/cosy-bio/drugst.one/backend:prod
    command:
      - "sh"
      - "scripts/start_celery_worker.sh"
    restart: always
    container_name: drugstone_celery
    hostname: drugstone_celery
    volumes:
      - drugstone_data_volume:/usr/src/drugstone/data
    env_file:
      - './docker-django.env'
    depends_on:
      - redis
      - db
    networks:
      - drugstone
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
  celery-beat:
    image: gitlab.rrz.uni-hamburg.de:4567/cosy-bio/drugst.one/backend:prod
    command:
      - "sh"
      - "scripts/start_celery_beat.sh"
    container_name: drugstone_celery_beat
    hostname: drugstone_celery_beat
    env_file:
      - './docker-django.env'
    depends_on:
      - redis
      - db
    networks:
      - drugstone
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
  cdn:
    build: cdn
    image: drugstone_cdn
    container_name: drugstone_cdn
    restart: always
    volumes:
      - drugstone_cdn_volume:/app/files
    ports:
      - 8033:80

networks:
  drugstone:

volumes:
  drugstone_db_volume:
    external: true
  drugstone_db_schema_volume:
    external: true
  drugstone_data_volume:
    external: true
  drugstone_cdn_volume:
    external: true