# Digital Ocean App Platform Specification
# Deploy VIP Coordinator with managed containers
name: vip-coordinator
region: nyc

# Database (Managed PostgreSQL)
databases:
  - name: vip-coordinator-db
    engine: PG
    version: "16"
    production: false  # Set to true for production (more expensive)
    cluster_name: vip-coordinator-postgres

# Services
services:
  # Backend API
  - name: backend
    github:
      repo: kyle/vip-coordinator  # Will be overridden to use Docker registry
      branch: main
      deploy_on_push: true
    dockerfile_path: backend/Dockerfile
    # Override with Docker registry
    image:
      registry_type: DOCR  # Will need to use DigitalOcean registry or Docker Hub
      registry: gitea.madeamess.online
      repository: kyle/vip-coordinator/backend
      tag: latest
    instance_count: 1
    instance_size_slug: basic-xxs  # $5/month
    http_port: 3000
    health_check:
      http_path: /api/v1/health
    envs:
      - key: NODE_ENV
        value: production
      - key: DATABASE_URL
        scope: RUN_TIME
        type: SECRET
      - key: REDIS_URL
        value: redis://redis:6379
      - key: AUTH0_DOMAIN
        value: dev-s855cy3bvjjbkljt.us.auth0.com
      - key: AUTH0_AUDIENCE
        value: https://vip-coordinator-api
      - key: AUTH0_ISSUER
        value: https://dev-s855cy3bvjjbkljt.us.auth0.com/
    routes:
      - path: /api

  # Frontend
  - name: frontend
    github:
      repo: kyle/vip-coordinator
      branch: main
    dockerfile_path: frontend/Dockerfile
    image:
      registry_type: DOCR
      registry: gitea.madeamess.online
      repository: kyle/vip-coordinator/frontend
      tag: latest
    instance_count: 1
    instance_size_slug: basic-xxs  # $5/month
    http_port: 80
    build_command: echo "Using pre-built image"
    envs:
      - key: VITE_API_URL
        value: https://vip-coordinator-${APP_URL}/api/v1
      - key: VITE_AUTH0_DOMAIN
        value: dev-s855cy3bvjjbkljt.us.auth0.com
      - key: VITE_AUTH0_CLIENT_ID
        value: JXEVOIfS5eYCkeKbbCWIkBYIvjqdSP5d
      - key: VITE_AUTH0_AUDIENCE
        value: https://vip-coordinator-api
    routes:
      - path: /

# Workers (Redis)
workers:
  - name: redis
    github:
      repo: kyle/vip-coordinator
      branch: main
    dockerfile_path: Dockerfile.redis
    instance_count: 1
    instance_size_slug: basic-xxs
