version: '3.8'

# Aurora Continuum — Production deployment
# Full setup guide: https://aurora.selectred.com/account/downloads
#
# Quick start:
#   1. Copy this file to your server
#   2. Create a .env file with the variables below:
#        JWT_SECRET=$(openssl rand -base64 32)
#        FRONTEND_SECRET=$(openssl rand -base64 32)
#        FRONTEND_URL=http://your-server:82
#   3. Run: docker compose up -d
#      The database is seeded automatically on first startup.
#   4. Open http://your-server:82 and activate your licence

services:

  mongodb:
    image: mongo:6.0
    container_name: continuum-mongodb
    restart: unless-stopped
    volumes:
      - mongodb_data:/data/db
    networks:
      - continuum-network
    healthcheck:
      test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/continuum --quiet
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 10s

  backend:
    image: ghcr.io/selectred/aurora-continuum-backend:latest
    container_name: continuum-backend
    restart: unless-stopped
    ports:
      - "3002:3002"
    environment:
      - NODE_ENV=production
      - PORT=3002
      - MONGODB_URI=mongodb://mongodb:27017/continuum
      - JWT_SECRET=${JWT_SECRET}
      - JWT_EXPIRES_IN=7d
      - CORS_ORIGIN=${FRONTEND_URL:-http://localhost:82}
      - FRONTEND_SECRET=${FRONTEND_SECRET}
    depends_on:
      mongodb:
        condition: service_healthy
    networks:
      - continuum-network

  frontend:
    image: ghcr.io/selectred/aurora-continuum-frontend:latest
    container_name: continuum-frontend
    restart: unless-stopped
    ports:
      - "${PORT:-82}:80"
    environment:
      - FRONTEND_SECRET=${FRONTEND_SECRET}
    depends_on:
      - backend
    networks:
      - continuum-network

volumes:
  mongodb_data:
    driver: local

networks:
  continuum-network:
    driver: bridge
