# DokPloy Configuration for Wiki.GhostGuild.org
name: wiki-ghostguild
type: nixpacks

# Build Configuration
build:
  dockerfile: null  # Using Nixpacks auto-detection
  context: .

# Environment Configuration
env:
  NODE_ENV: production
  NITRO_PRESET: node-server

# Secrets (configured in DokPloy UI)
# These should be set in DokPloy interface, not in this file:
# - MONGODB_URI
# - JWT_SECRET
# - JWT_REFRESH_SECRET
# - GHOSTGUILD_CLIENT_ID
# - GHOSTGUILD_CLIENT_SECRET
# - GHOSTGUILD_API_KEY

# Port Configuration
ports:
  - 3000:3000

# Health Check
healthcheck:
  path: /api/health
  interval: 30
  timeout: 10
  retries: 3

# Resource Limits
resources:
  limits:
    memory: 1GB
    cpu: 1
  requests:
    memory: 512MB
    cpu: 0.5

# Domains
domains:
  - wiki.ghostguild.org

# SSL Configuration
ssl:
  enabled: true
  provider: letsencrypt
  email: admin@ghostguild.org

# Deployment Strategy
deploy:
  replicas: 1
  strategy: rolling
  maxSurge: 1
  maxUnavailable: 0

# Volume Mounts (for persistent data)
volumes:
  - name: content
    path: /app/content
    size: 5GB
  - name: uploads
    path: /app/public/uploads
    size: 10GB

# Commands
scripts:
  prebuild: |
    echo "Installing dependencies..."
    npm ci
  build: |
    echo "Building application..."
    npm run build
  start: |
    echo "Starting production server..."
    node .output/server/index.mjs

# Monitoring
monitoring:
  enabled: true
  metrics_path: /metrics

# Backup Configuration
backup:
  enabled: true
  schedule: "0 2 * * *"  # Daily at 2 AM
  retention: 30  # Keep 30 days of backups