Skip to content

Operations

1. Deployment

Thuộc tínhGiá trị
Imageregistry/outreach:<tag>
Replicas (mặc định)1 (traffic thấp; API stateless)
Resources (req/lim)nhỏ — CPU/memory theo baseline cluster
HPA targetCPU (tùy chọn; traffic bùng nổ khi campaign)
ProbesGET /healthz (live), GET /readyz (ready)
Snowflake ID10 (APP_ENV_NODE_ID)
Migration modebun run migrate:dev / boot job; seed idempotent (alwaysRun)

Traefik labels

yaml
labels:
  - "traefik.enable=true"
  - "traefik.http.routers.outreach.rule=PathPrefix(`/v1/api/outreach`)"
  - "traefik.http.services.outreach.loadbalancer.server.port=3000"

Nhiều replica là an toàn: WebSocket emitter backed bởi Redis, nên bất kỳ replica nào cũng có thể broadcast tới mọi subscriber. Snowflake worker 10 phải unique theo từng process đang chạy nếu scale quá một — phối hợp APP_ENV_NODE_ID.

2. Observability

SignalNguồnNơi xem
Logsstdout (key-value có cấu trúc)kubectl logs <pod> / Loki
MetricsPrometheus /metrics (nếu bật)Grafana
Tracesno-op (chưa nối tracer)
HealthGET /healthz, GET /readyzGateway portal
API specGET /v1/api/outreach/doc/openapi.json, /doc (Scalar)Browser

Trường log quan trọng

TrườngNguồnGhi chú
requestIdheader X-Request-IdPropagate cross-service
inquiryIdWS notifyInquiry SENT | inquiryId: %s | rooms: %j
roomsWS notifyRoom quan sát đích

3. Security

Mối quan tâmBiện pháp
AuthNJWT (ES256, JWKS từ identity) trên CRUD + statistics
Endpoint public/inquiries/submit, /subscribers/subscribe, /subscribers/unsubscribe không xác thực theo thiết kế
Lạm dụng / spamKhông có rate limit tích hợp — dựa vào middleware Traefik + WAF trước submit/subscribe public
Unsubscribe tokenSnowflake unsubscribeToken, ẩn khỏi API response; chỉ token hợp lệ mới deactivate được — xem ADR-0001
AuthZPermission Casbin seed cho OWNER/EMPLOYEE/CASHIER
SecretsK8s Secret mount làm env (DB, Redis password)
TLSKết thúc tại gateway
Network policyCilium — cho phép gateway + identity JWKS + Redis + Postgres
Soft-deletedeletedAt; không hard-delete theo mặc định

4. Runbook

4.1 Lớp Alert

AlertTriggerCheckFixEscalate
outreachHighErrorRate5xx >5% trong 5mlog level=errorinspect kết nối DB / Redison-call backend
outreachSubmitFloodspike submit RPSmetric Traefikbật/tăng rate limit tại gatewayon-call SRE
outreachWSNotReadycảnh báo lặp Socket event service not readyRedis healthrestart pod / check Redison-call backend

4.2 Thao tác thường gặp

Thao tácLệnh
Tail logkubectl logs -n <ns> -f deploy/outreach
Re-run seedchạy migration (seed alwaysRun, idempotent) — chỉ operator chạy
Verify spec livemở /v1/api/outreach/doc
Triage spamđánh dấu các yêu cầu vi phạm CANCELLED qua CRUD admin

Không có Kafka replay và không có BullMQ queue cho service này — không có gì để drain hay replay.

5. Trang liên quan

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.