services:
  dagster-webserver:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: dagster-webserver
    restart: unless-stopped
    expose:
      - "3000"
    environment:
      - DAGSTER_HOME=/app
      # Dagster storage DB
      - DAGSTER_POSTGRES_HOST=optoviaproject-dagsterdb-i8upew
      - DAGSTER_POSTGRES_PORT=5432
      - DAGSTER_POSTGRES_USER=postgres
      - DAGSTER_POSTGRES_PASSWORD=mxxyhvrg3g2qslaa
      - DAGSTER_POSTGRES_DB=postgres
      # App resources (same DB for now)
      - POSTGRES_HOST=optoviaproject-dagsterdb-i8upew
      - POSTGRES_PORT=5432
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=mxxyhvrg3g2qslaa
      - POSTGRES_DB=postgres
      - EGRUL_AGENT_URL=http://egrul-agent:8000
      - MONGODB_URI=${MONGODB_URI}
      - MONGODB_DB=${MONGODB_DB:-optovia}
      - MONGODB_COLLECTION=${MONGODB_COLLECTION:-egrul_companies}
    volumes:
      - dagster-storage:/app/storage
    networks:
      dokploy-network:
        aliases:
          - dagster

  dagster-daemon:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: dagster-daemon
    restart: unless-stopped
    command: ["dagster-daemon", "run"]
    environment:
      - DAGSTER_HOME=/app
      # Dagster storage DB
      - DAGSTER_POSTGRES_HOST=optoviaproject-dagsterdb-i8upew
      - DAGSTER_POSTGRES_PORT=5432
      - DAGSTER_POSTGRES_USER=postgres
      - DAGSTER_POSTGRES_PASSWORD=mxxyhvrg3g2qslaa
      - DAGSTER_POSTGRES_DB=postgres
      # App resources (same DB for now)
      - POSTGRES_HOST=optoviaproject-dagsterdb-i8upew
      - POSTGRES_PORT=5432
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=mxxyhvrg3g2qslaa
      - POSTGRES_DB=postgres
      - EGRUL_AGENT_URL=http://egrul-agent:8000
      - MONGODB_URI=${MONGODB_URI}
      - MONGODB_DB=${MONGODB_DB:-optovia}
      - MONGODB_COLLECTION=${MONGODB_COLLECTION:-egrul_companies}
    volumes:
      - dagster-storage:/app/storage
    networks:
      - dokploy-network

volumes:
  dagster-storage:

networks:
  dokploy-network:
