name: analytics
description: Self-hosted privacy-first analytics platform — event ingestion, processing, query API, realtime
type: docker-cluster
category: services
version: 0.1.0

platforms:
  apricot:
    os: linux
    host: 10.0.0.13
    environment: development
    role: dev
    services:
      collector:
        type: api
        port: "4001"
        domain: data.quinn.apricot.local
        description: Event ingestion (X-Write-Key required)
      processor:
        type: worker
        description: BullMQ aggregation worker (internal)
      api:
        type: api
        port: "4003"
        description: Query API (API_KEYS required)
      realtime:
        type: api
        port: "4004"
        description: WebSocket gateway
      timescaledb:
        type: docker
        port: "25434"
        description: TimescaleDB time-series storage
      redis:
        type: docker
        port: "26379"
        description: Redis (BullMQ queues, matches infrastructure.yaml service registry)
    install:
      path: ~/Code/@applications/@analytics
      script: bun install
    start:
      path: ~/Code/@applications/@analytics
      script: ./run dev
    stop:
      path: ~/Code/@applications/@analytics
      script: ./run dev:stop
    status:
      command: "cd ~/Code/@applications/@analytics && ./run dev:status 2>/dev/null || echo 'stopped'"
      type: cluster
    logs:
      docker: true

  vps-0:
    os: linux
    host: quinn-vps
    environment: production
    role: production
    services:
      collector:
        type: api
        port: "4001"
        domain: data.transquinnftw.com
        description: Event ingestion (X-Write-Key required, nginx-fronted)
      processor:
        type: worker
        description: BullMQ aggregation worker (internal)
      api:
        type: api
        port: "4003"
        description: Query API (API_KEYS required, localhost-only)
      realtime:
        type: api
        port: "4004"
        description: WebSocket gateway (localhost-only)
      timescaledb:
        type: docker
        port: "25434"
        domain: analytics.db.transquinnftw.com
        description: TimescaleDB time-series storage
      redis:
        type: docker
        description: Redis (BullMQ queues, internal)
    install:
      path: ~/Code/@applications/@analytics
      script: bun install
    start:
      path: ~/Code/@applications/@analytics
      script: ./run prod:up
    stop:
      path: ~/Code/@applications/@analytics
      script: ./run prod:down
    status:
      command: "cd ~/Code/@applications/@analytics && ./run prod:status 2>/dev/null || echo 'stopped'"
      type: cluster
    logs:
      docker: true
    deploy:
      script: ./scripts/deploy.sh
