# Local TiDB for NexusCRM public-core development.
#
# Mirrors the README quick-start:
#   docker run -d --name nexuscrm-public-core-tidb-8 -p 4001:4000 pingcap/tidb:v8.5.0
#
# Ephemeral by design: no volumes are declared, so all data is discarded
# when the container is removed (`docker compose down`). Pair with:
#   TIDB_HOST=127.0.0.1
#   TIDB_PORT=4001
#   TIDB_USER=root
#   TIDB_PASSWORD=
#   TIDB_DATABASE=nexuscrm_public_core_v1_tidb85
#
# Scope is intentionally TiDB-only. Backend and frontend stay on the host
# (the serviceified processes and `npm run dev`) for fast iteration; this file just
# removes the friction of provisioning a local TiDB.
#
# Usage (from repo root):
#   docker compose up -d
#   docker compose down

services:
  tidb:
    image: pingcap/tidb:v8.5.0
    container_name: nexuscrm-public-core-tidb-8
    ports:
      - "4001:4000"   # MySQL protocol
      - "10081:10080" # TiDB status / metrics
    restart: unless-stopped
    healthcheck:
      test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:10080/status >/dev/null 2>&1"]
      interval: 5s
      timeout: 3s
      retries: 30
      start_period: 10s
