version: '3.8'

name: dna_django
services:
  web:
    build: .
    container_name: DnA_django_app
    restart: always
    volumes:
      - .:/app
      - ./db.sqlite3:/app/db.sqlite3
    ports:
      - "7015:8000"
    # depends_on:
    #   - db
    env_file:
      - .env

  # db:
  #   image: postgres:15
  #   container_name: DnA_postgres_db
  #   restart: always
  #   environment:
  #     POSTGRES_DB: danda
  #     POSTGRES_USER: postgres
  #     POSTGRES_PASSWORD: postgres
  #   volumes:
  #     - postgres_data:/var/lib/postgresql/data
  #   ports:
  #     - "5432:5432"

# volumes:
#   postgres_data:


  # db:
  #   image: timescale/timescaledb:latest-pg15
  #   container_name: timescaledb
  #   environment:
  #     POSTGRES_DB: dna-django
  #     POSTGRES_USER: postgres
  #     POSTGRES_PASSWORD: xiH1z14Wh~j5
  #   ports:
  #     - "5432:5432"
  #   volumes:
  #     - pgdata:/var/lib/postgresql/data
  # volumes:
  #   pgdata:

  # celery:
  #   build:
  #     context: .
  #   command: celery -A danda worker --loglevel=info
  #   volumes:
  #     - .:/app
  #   depends_on:
  #     - redis
  #     - django
  #   env_file:
  #     - .env

  # redis:
  #   image: redis:7
  #   ports:
  #     - "6379:6379"  


  redis:
    image: redis:7
    ports:
      - "6379:6379"

  celery:
    build: .
    container_name: DnA_celery
    command: celery -A danda worker --loglevel=INFO
    volumes:
      - .:/app
    depends_on:
      - redis
    env_file:
      - .env

  celery-beat:
    build: .
    container_name: DnA_celery_beat
    command: celery -A danda beat --loglevel=INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler
    volumes:
      - .:/app
    depends_on:
      - redis
    env_file:
      - .env 

networks:
  dna_network:
