Skip to content

Operations

1. Triển khai

Thuộc tínhGiá trị
Imageregistry/pricing:<tag>
Container Port3000 (ngoài 31070)
ProbesGET /healthz (live), GET /readyz (ready)
Snowflake ID7 (APP_ENV_NODE_ID)
Run modesapi (REST + CDC consumer lúc boot) · migrate (seed chạy một lần)
Phụ thuộc lúc bootPostgreSQL (schema pricing), Redis (auth cache), Kafka (binding throw nếu APP_ENV_KAFKA_BROKERS rỗng)

Kafka là phụ thuộc boot cứng: ApplicationKafkaComponent.binding() throw InternalServerError nếu brokers chưa đặt, dù pricing chỉ consume (không produce). Một pod không có broker tới được sẽ không start.

Traefik labels

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

2. Observability

Tín hiệuNguồnXem ở đâu
Logsstdout (key-value có cấu trúc IGNIS)kubectl logs <pod> / Loki
HealthGET /healthz, GET /readyzPortal gateway
OpenAPIGET /doc (Scalar), /doc/openapi.jsonAPI explorer trực tiếp

Marker log chính

MarkerNguồnÝ nghĩa
SKIP — FareSet already existsPricingWorkerServiceTrúng idempotency CDC (kỳ vọng khi replay RETRIEVE)
DONE FareSet + SALE Fare seeded via CDCPricingWorkerServiceVariant mới được định giá
DONE FBT override seededPricingWorkerServiceTạo FBT override child fare
Received message | Topic: %sApplicationKafkaComponentNạp message CDC
Unknown topic — subscribed but no handlerApplicationKafkaComponentSubscription sai cấu hình

3. Bảo mật

Mối quan tâmGiảm thiểu
AuthNJWT (ES256, JWKS từ identity); BASIC cho service-to-service (sale → pricing)
AuthZCasbin qua PolicyDefinition; theo resource mỗi controller; cache trong Redis
SecretsK8s Secret mount như env (DB URL, Kafka SASL, basic-auth)
TLSKết thúc tại gateway; Kafka SASL tuỳ chọn
Network policyCilium — chỉ cho gateway + sale + Kafka + Postgres + Redis
Soft-deletedeletedAt — mặc định không hard-delete

4. Runbook

4.1 Lớp cảnh báo

Cảnh báoKích hoạtKiểm traKhắc phụcLeo thang
pricingHighErrorRate5xx >5% trong 5mlogs level=errorxem lỗi calculator / khả năng tới DBbackend on-call
pricingCheckoutRejectstăng vọt 4xx trên /simulation*logs cho "no active fare set"xác nhận CDC worker đang seed FareSetbackend on-call
pricingCdcStalledoffset CDC không tiếnkhả năng tới broker + lag consumer grouprestart pod / kiểm DebeziumSRE on-call
pricingBootCrashLooppod restartlogs Cannot start Kafka — env ... emptyđặt APP_ENV_KAFKA_BROKERSSRE on-call

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

Thao tácLệnh / hành động
Tail logskubectl logs -n <ns> -f deploy/pricing
Re-seed fare của một variantRe-emit hàng ProductVariant của nó (CDC RETRIEVE) — worker idempotent
Xem fare thắngPOST /simulation-v2/calculate với variant + context; đọc fareSource trên applied-rule PRICE
Chạy migration thủ côngbun run migrate (trong pod) — seed permissions + role-permissions
Xác minh tiêu thụ CDCKiểm lag consumer group cho PRICING_CONSUMER_GROUP trên PRODUCT_VARIANT

Ghi DB / migration do operator chạy. Chẩn đoán read-only qua endpoint calculate.

5. Trang liên quan

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