version: '3.8'

# Aurora Continuum — self-hosted deployment
# Images pulled from GitHub Container Registry — no source code required.
#
# Quick start:
#   1. Copy this file to an empty directory
#   2. Create a .env file in the same directory (see variables below)
#   3. docker compose up -d
#   4. Open http://localhost:82
#      Default login: admin@continuum.aurora / admin123
#
# Required .env variables:
#   JWT_SECRET=<random 32+ char string>
#   FRONTEND_SECRET=<random 32+ char string>
#
# Generate secrets with: openssl rand -base64 32

services:
  mongodb:
    image: mongo:6.0
    container_name: continuum-mongodb
    restart: unless-stopped
    ports:
      - "27018:27017"
    environment:
      MONGO_INITDB_DATABASE: continuum
    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:-change-me-before-use}
      - JWT_EXPIRES_IN=7d
      - CORS_ORIGIN=${CORS_ORIGIN:-http://localhost:82}
      - FRONTEND_SECRET=${FRONTEND_SECRET:-change-me-before-use}
    depends_on:
      mongodb:
        condition: service_healthy
    networks:
      - continuum-network

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

volumes:
  mongodb_data:
    driver: local

networks:
  continuum-network:
    driver: bridge
