Skip to content

Kiến trúc

Gateway là một edge proxy, không phải dịch vụ. Không có máy trạng thái (không thực thể domain) — các kịch bản runtime dưới đây mô tả đường request-routing thay vào đó.

1. Bối cảnh hệ thống (C4 L1)

2. Góc nhìn Container (C4 L2)

Hai topology proxy riêng biệt dùng chung cùng ý định routing: Traefik cho Docker/prod, Nginx cục bộ cho dev native.

TopologyProxyKhám pháTLSDùng khi
Production / DockerTraefik v3.6Docker labels (tự động)Edge NginxTriển khai container hóa
Development nativeNginx cục bộBảng route tĩnh nginx.confKhôngDịch vụ chạy trên host 127.0.0.1:31xx

3. Góc nhìn Component (C4 L3) — Quyết định Routing

LớpNguồn TraefikNguồn Nginx cục bộ
Entrypointtraefik.yml entryPoints.web/.traefiklisten 80 default_server
RoutersDocker labels (tự khám phá)block location /v1/api/<svc>/
Middlewaresmiddlewares.yml (file provider)block proxy_set_header dùng chung
UpstreamsIP mạng Dockerupstream <svc>_upstream { 127.0.0.1:31xx }
Catch-allrouter portal priority 1location / → JSON 404

4. Chỉ mục Máy trạng thái

N/A — gateway không quản lý thực thể có trạng thái. Cấu trúc runtime có trạng thái duy nhất là circuit breaker của Traefik, máy trạng thái của nó được tài liệu hóa trong Resilience.

5. Kịch bản Runtime

5.1 Request REST chuẩn (production, Traefik)

5.2 Request dev native (Nginx cục bộ)

5.3 Nâng cấp WebSocket Signal

5.4 Khám phá sức khỏe Portal

6. Mối quan tâm xuyên suốt

Mối quan tâmGateway xử lý như thế nào
AuthN/AuthZKhông tại gateway — JWT được mỗi dịch vụ xác thực (identity là issuer). Gateway chỉ basic-auth Traefik dashboard + portal.
TLSKết thúc tại edge Nginx, không phải Traefik (không có HTTPS entrypoint trong traefik.yml).
Rate limitingTraefik rate-limit (200/s) / rate-limit-auth (30/min), theo IP qua ipStrategy.depth=1.
ResilienceTraefik circuit-breaker + health check chủ động. Xem Resilience.
LoggingTraefik JSON access logs; Authorization/Cookie bị bỏ.
MetricsPrometheus trên :8080. Xem Observability.
IDs / Soft-delete / i18nN/A — không có datastore.

7. Trang liên quan

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