feat(docs): Remove outdated service templates and enhance Vietnamese architecture documentation

- Deleted obsolete service architecture templates in both English and Vietnamese to streamline content.
- Updated the Vietnamese architecture documentation with improved Mermaid diagrams for better visual clarity.
- Enhanced color coding in diagrams to improve readability and consistency across documentation.
- Added a new section detailing visual indicators for better understanding of architecture components.
This commit is contained in:
Ho Ngoc Hai
2026-01-10 21:00:02 +07:00
parent b89e07f4cb
commit 4e595d0746
50 changed files with 36 additions and 28 deletions

View File

@@ -27,8 +27,12 @@ graph TD
Topics -->|Subscribe| Consumer1 Topics -->|Subscribe| Consumer1
Topics -->|Subscribe| Consumer2 Topics -->|Subscribe| Consumer2
style IAM fill:#5E35B1,stroke:#4527A0,color:#ffffff
style Service1 fill:#5E35B1,stroke:#4527A0,color:#ffffff
style Kafka fill:#1E88E5,stroke:#1565C0,color:#ffffff style Kafka fill:#1E88E5,stroke:#1565C0,color:#ffffff
style Topics fill:#FB8C00,stroke:#EF6C00,color:#ffffff style Topics fill:#FB8C00,stroke:#EF6C00,color:#ffffff
style Consumer1 fill:#43A047,stroke:#2E7D32,color:#ffffff
style Consumer2 fill:#43A047,stroke:#2E7D32,color:#ffffff
``` ```
## Mô tả Kiến trúc ## Mô tả Kiến trúc
@@ -214,7 +218,7 @@ C4Context
- Automatic deletion sau retention period - Automatic deletion sau retention period
- Compliance với GDPR (right to erasure) - Compliance với GDPR (right to erasure)
## Triển khai / Deployment ## Triển khai
```mermaid ```mermaid
graph TD graph TD
@@ -264,25 +268,29 @@ graph TD
style Broker2 fill:#1E88E5,stroke:#1565C0,color:#ffffff style Broker2 fill:#1E88E5,stroke:#1565C0,color:#ffffff
style Broker3 fill:#1E88E5,stroke:#1565C0,color:#ffffff style Broker3 fill:#1E88E5,stroke:#1565C0,color:#ffffff
style ZK fill:#8E24AA,stroke:#7B1FA2,color:#ffffff style ZK fill:#8E24AA,stroke:#7B1FA2,color:#ffffff
style IAM fill:#5E35B1,stroke:#4527A0,color:#ffffff
style ServiceA fill:#5E35B1,stroke:#4527A0,color:#ffffff
style Notification fill:#43A047,stroke:#2E7D32,color:#ffffff
style Audit fill:#43A047,stroke:#2E7D32,color:#ffffff
``` ```
### Chiến lược Triển khai / Deployment Strategy ### Chiến lược Triển khai
**Cấu hình Kafka Cluster / Kafka Cluster Configuration**: **Cấu hình Kafka Cluster**:
- **Brokers**: 3 brokers minimum (5 for production) - **Brokers**: 3 brokers minimum (5 for production)
- **Replication Factor**: 3 (for fault tolerance) - **Replication Factor**: 3 (for fault tolerance)
- **Min In-Sync Replicas**: 2 (ensure data durability) - **Min In-Sync Replicas**: 2 (ensure data durability)
- **Partitions**: 3-10 per topic (based on throughput needs) - **Partitions**: 3-10 per topic (based on throughput needs)
- **Zookeeper**: 3-node ensemble (for coordination) - **Zookeeper**: 3-node ensemble (for coordination)
**Phân bổ Tài nguyên / Resource Allocation**: **Phân bổ Tài nguyên**:
| Component | CPU | Memory | Disk | | Component | CPU | Memory | Disk |
|-----------|-----|--------|------| |-----------|-----|--------|------|
| **Kafka Broker** | 2 cores | 4GB RAM | 100GB SSD | | **Kafka Broker** | 2 cores | 4GB RAM | 100GB SSD |
| **Zookeeper** | 1 core | 2GB RAM | 20GB SSD | | **Zookeeper** | 1 core | 2GB RAM | 20GB SSD |
| **Schema Registry** | 500m | 1GB RAM | 10GB | | **Schema Registry** | 500m | 1GB RAM | 10GB |
**Cấu hình Topic / Topic Configuration**: **Cấu hình Topic**:
```yaml ```yaml
user.created: user.created:
partitions: 3 partitions: 3
@@ -303,15 +311,15 @@ audit.events:
compression-type: lz4 compression-type: lz4
``` ```
**Tính Sẵn sàng Cao / High Availability**: **Tính Sẵn sàng Cao**:
- Multiple brokers với partition replication / Multiple brokers with partition replication - Multiple brokers với partition replication
- Automatic leader election khi broker fails / Automatic leader election when broker fails - Automatic leader election khi broker fails
- Consumer group rebalancing - Consumer group rebalancing
- Monitoring và alerting cho broker health / Monitoring and alerting for broker health - Monitoring và alerting cho broker health
## Giám sát & Khả năng quan sát / Monitoring & Observability ## Giám sát & Khả năng quan sát
### Chỉ số Chính / Key Metrics ### Chỉ số Chính
**Kafka Broker Metrics**: **Kafka Broker Metrics**:
- `kafka_server_brokertopicmetrics_messagesinpersec` - Messages in/sec - `kafka_server_brokertopicmetrics_messagesinpersec` - Messages in/sec
@@ -332,7 +340,7 @@ audit.events:
**Application Metrics**: **Application Metrics**:
```typescript ```typescript
// Custom metrics cho event processing / Custom metrics for event processing // Custom metrics cho event processing
const eventPublished = new Counter({ const eventPublished = new Counter({
name: 'events_published_total', name: 'events_published_total',
help: 'Total events published', help: 'Total events published',
@@ -353,7 +361,7 @@ const eventProcessingDuration = new Histogram({
}); });
``` ```
**Quy tắc Cảnh báo / Alerting Rules**: **Quy tắc Cảnh báo**:
```yaml ```yaml
# High consumer lag # High consumer lag
- alert: HighConsumerLag - alert: HighConsumerLag
@@ -395,9 +403,9 @@ const eventProcessingDuration = new Histogram({
- Consumer Performance (lag, throughput, errors) - Consumer Performance (lag, throughput, errors)
- Topic Metrics (messages/sec, bytes/sec, retention) - Topic Metrics (messages/sec, bytes/sec, retention)
**Logging / Ghi nhật ký**: **Logging**:
```typescript ```typescript
// Structured logging cho events / Structured logging for events // Structured logging cho events
logger.info('Event published', { logger.info('Event published', {
eventId: event.eventId, eventId: event.eventId,
eventType: event.eventType, eventType: event.eventType,
@@ -415,21 +423,21 @@ logger.info('Event consumed', {
``` ```
## Tài liệu Liên quan / Related Documentation ## Tài liệu Liên quan
- [System Design](./system-design.md) - Kiến trúc tổng thể / Overall architecture - [System Design](./system-design.md) - Kiến trúc tổng thể
- [IAM Architecture](./iam-proposal.md) - Triển khai Event sourcing / Event sourcing implementation - [IAM Architecture](./iam-proposal.md) - Triển khai Event sourcing
--- ---
**Cập nhật Lần cuối / Last Updated**: 2026-01-07 **Cập nhật Lần cuối**: 2026-01-07
**Tác giả / Authors**: GoodGo Architecture Team **Tác giả**: GoodGo Architecture Team
## Quick Tips / Mẹo Nhanh ## Mẹo Nhanh
### Mermaid Diagram Color Palette ### Bảng Màu Mermaid
| Node Type | Fill Color | Stroke Color | Text Color | Usage | | Loại Node | Màu Nền | Màu Viền | Màu Chữ | Sử dụng |
|-----------|------------|--------------|------------|-------| |-----------|------------|--------------|------------|-------|
| **Core/Broker** | `#1E88E5` (Blue) | `#1565C0` | `#ffffff` | Kafka Brokers, Main Components | | **Core/Broker** | `#1E88E5` (Blue) | `#1565C0` | `#ffffff` | Kafka Brokers, Main Components |
| **Topic/Data** | `#FB8C00` (Orange) | `#EF6C00` | `#ffffff` | Topics, Queues, Data Stores | | **Topic/Data** | `#FB8C00` (Orange) | `#EF6C00` | `#ffffff` | Topics, Queues, Data Stores |
@@ -437,10 +445,10 @@ logger.info('Event consumed', {
| **Error/Danger** | `#E53935` (Red) | `#C62828` | `#ffffff` | Errors, DLQ, Critical issues | | **Error/Danger** | `#E53935` (Red) | `#C62828` | `#ffffff` | Errors, DLQ, Critical issues |
| **Coordination** | `#8E24AA` (Purple) | `#7B1FA2` | `#ffffff` | Zookeeper, Orchestrators | | **Coordination** | `#8E24AA` (Purple) | `#7B1FA2` | `#ffffff` | Zookeeper, Orchestrators |
### Visual Indicators / Các Chỉ báo Trực quan ### Các Chỉ báo Trực quan
- 🔄 **Retry Loop**: Indicates automatic retries (Chỉ báo thử lại tự động) - 🔄 **Retry Loop**: Chỉ báo thử lại tự động
- ⚠️ **DLQ/Warning**: Indicates error handling path (Đường dẫn xử lý lỗi) - ⚠️ **DLQ/Warning**: Đường dẫn xử lý lỗi
- 📝 **Log/Audit**: Indicates logging point (Điểm ghi log) - 📝 **Log/Audit**: Điểm ghi log
- 🔐 **Lock/Auth**: Indicates security check (Kiểm tra bảo mật) - 🔐 **Lock/Auth**: Kiểm tra bảo mật