Lewati ke isi

Deployment Overview

Gambaran deploy komponen ERP & pipeline data. Bukan blueprint infra cloud lengkap — merangkum apa yang ada di repo.


Topology deploy (typical)

flowchart TB
  subgraph host [Server aplikasi / sic]
    PM2[PM2: erp-backend, clickhouse-etl, migrasi-ui]
    DC[Docker Compose CDC stack]
  end

  subgraph data_services [Data]
    PG[(PostgreSQL erp)]
    CH[(ClickHouse)]
  end

  subgraph external [Eksternal]
    FB[Firebase]
    TS[Tailscale ops]
  end

  PM2 --> PG
  PM2 --> CH
  DC --> PG
  DC --> CH
  FL[Flutter clients] --> PM2
  FL --> FB
  OPS[Operator] --> TS
  TS --> PM2

Komponen & artefak deploy

Komponen Artefak Start
PostgreSQL Paket/managed — skema dari database/ddl, migrations/ psql migrasi, database/RUNBOOK
NestJS API backend/dist — npm run build pm2 / systemd, port 3001
CDC stack database/cdc/docker-compose.yml docker compose up -d
ClickHouse ETL consumer_clickhouse.py pm2 restart clickhouse-etl
migrasi-ui Python/FastAPI main.py PM2, port 5000 (var)
Flutter Store/build APK — config API URL SETUP.md

Urutan bootstrap lingkungan baru

  1. PostgreSQL: 00_init → 01–04 → 11_logika (CLAUDE.md)
  2. Buat tenant: database/scripts/buat_tenant.sql
  3. Migrasi tenant: jalankan_migrasi_tenant.sh
  4. (Opsional) ETL legacy → PG
  5. ClickHouse DDL: migrations/clickhouse/V101+
  6. Initial load CH: SOP_INITIAL_LOAD
  7. CDC: compose + Debezium connector + publication
  8. Backend: env Firebase + ERP_* URL + CH credentials
  9. Verifikasi: CHECKLIST_SERVER.md

Environment variables (inti)

Variabel Pemakai
ERP_MIGRASI_URL Migrasi DDL
DATABASE_URL / pool tenant Backend runtime
TENANT_SCHEMAS Consumer CDC
KAFKA_BROKER Consumer
CLICKHOUSE_* Consumer + Backend
Firebase service account Backend auth

Secret tidak disimpan di Git — gunakan secret manager prod (07).


CI / quality gate

  • Lint + uji per workstream (07)
  • Migrasi bernomor wajib di review PR
  • Progress dashboard: npm run progress — ONBOARDING-TEAM.md

Asumsi: Pipeline CI spesifik belum didokumentasikan terpusat di repo.


Produksi vs DEV

Aspek DEV PRODUCTION
Kafka topic reset Diizinkan (migrasi-ui) Dilarang global
Debezium Stop/recreate OK Always-on; tenant-scoped change
API destructive ops migrasi-ui Control plane + approval

OPERATING_MODEL.md.


Dokumen terkait