131 lines
3.9 KiB
Markdown
131 lines
3.9 KiB
Markdown
# Trạng Thái Môi Trường Phát Triển Cục Bộ
|
|
|
|
## Thông Tin Cài Đặt
|
|
- **Ngày**: 2026-04-12
|
|
- **Máy**: MacBook M-series, 64GB RAM
|
|
- **Docker**: Docker Desktop 4.55, Engine 29.1.3 (darwin/arm64)
|
|
- **Compose file**: `deployments/local/docker-compose.yml`
|
|
- **Env file**: `deployments/local/.env`
|
|
|
|
## Cơ Sở Dữ Liệu
|
|
- **Loại**: Remote Neon PostgreSQL
|
|
- **Host**: 212.28.186.239:30992
|
|
- **User**: cloud_admin
|
|
- **Databases**: 23 per-service databases (iam_service, merchant_service, etc.)
|
|
- **Note**: Shared with staging — changes here affect staging data
|
|
|
|
## Các Service Đang Chạy (36 containers)
|
|
|
|
### Hạ Tầng
|
|
| Service | Port | Trạng thái |
|
|
|---------|------|--------|
|
|
| PostgreSQL 16 | 5432 | healthy (local container, but services use remote Neon) |
|
|
| Redis 7 | 6379 | healthy |
|
|
| RabbitMQ 3 | 5672 / 15672 (UI) | healthy |
|
|
| MinIO | 9000 / 9001 (Console) | healthy |
|
|
| Traefik v3.3 | 80 / 8080 (Dashboard) | running |
|
|
|
|
### Microservices
|
|
| Service | Port | Trạng thái |
|
|
|---------|------|--------|
|
|
| iam-service | 5001 | healthy |
|
|
| merchant-service | 5005 | healthy |
|
|
| catalog-service | 5016 | healthy |
|
|
| order-service | 5017 | healthy |
|
|
| inventory-service | 5018 | healthy |
|
|
| fnb-engine | 5019 | healthy |
|
|
| booking-service | 5020 | healthy |
|
|
| wallet-service | 5004 | healthy |
|
|
| storage-service | 5002 | healthy |
|
|
| membership-service | 5003 | healthy |
|
|
| chat-service | 5006 | healthy |
|
|
| social-service | 5007 | healthy |
|
|
| promotion-service | 5008 | healthy |
|
|
| mining-service | 5009 | healthy |
|
|
| mission-service | 5010 | healthy |
|
|
| ads-manager-service | 5011 | healthy |
|
|
| ads-serving-service | 5012 | healthy |
|
|
| ads-billing-service | 5013 | healthy |
|
|
| ads-tracking-service | 5014 | healthy |
|
|
| ads-analytics-service | 5015 | healthy |
|
|
| mkt-facebook-service | 5021 | healthy |
|
|
| mkt-whatsapp-service | 5022 | healthy |
|
|
| mkt-x-service | 5023 | healthy |
|
|
| mkt-zalo-service | 5024 | healthy |
|
|
|
|
### Giao Diện
|
|
| Service | Port | Trạng thái |
|
|
|---------|------|--------|
|
|
| pos-web (Blazor WASM) | 3001 | healthy |
|
|
|
|
### Quan Sát Hệ Thống
|
|
| Service | Port | Trạng thái |
|
|
|---------|------|--------|
|
|
| Prometheus | 9090 | healthy |
|
|
| Grafana | 3002 | healthy |
|
|
| Loki | 3100 | running |
|
|
| Promtail | — | running |
|
|
| Alertmanager | 9093 | healthy |
|
|
|
|
## Điểm Truy Cập
|
|
| URL | Mục đích |
|
|
|-----|---------|
|
|
| http://localhost:3001 | POS App (Blazor WASM) |
|
|
| http://localhost:8080 | Traefik Dashboard |
|
|
| http://localhost:15672 | RabbitMQ Management (guest / goodgo-rabbitmq-local) |
|
|
| http://localhost:9001 | MinIO Console (minioadmin / minioadmin123) |
|
|
| http://localhost:9090 | Prometheus |
|
|
| http://localhost:3002 | Grafana |
|
|
| http://localhost:5001/swagger | IAM API Swagger |
|
|
| http://localhost:5005/swagger | Merchant API Swagger |
|
|
|
|
## Dev Workflow
|
|
|
|
### Rebuild a service after code changes
|
|
```bash
|
|
cd deployments/local
|
|
docker compose build <service-name>
|
|
docker compose up -d <service-name>
|
|
```
|
|
|
|
### Hot-reload (recommended for active dev)
|
|
```bash
|
|
# Stop Docker container for the service
|
|
docker compose stop iam-service-net-local
|
|
|
|
# Run locally with hot-reload
|
|
cd services/iam-service-net
|
|
dotnet watch run --project src/IamService.API
|
|
```
|
|
|
|
### View logs
|
|
```bash
|
|
docker compose logs -f <service-name> --tail=50
|
|
```
|
|
|
|
### Restart all
|
|
```bash
|
|
docker compose restart
|
|
```
|
|
|
|
### Stop all
|
|
```bash
|
|
docker compose down
|
|
```
|
|
|
|
## Git → CI/CD Flow
|
|
1. Edit code locally
|
|
2. Test on http://localhost:3001
|
|
3. `git add && git commit && git push origin master`
|
|
4. GitHub → Gitea sync (5 min cronjob)
|
|
5. Gitea Actions → Kaniko build → Harbor → K8s deploy
|
|
6. Verify on https://platform.techbi.org
|
|
|
|
## Vấn Đề Đã Biết
|
|
- PostgreSQL container runs locally but all services point to remote Neon DB
|
|
- Homebrew postgres/redis must be stopped before starting Docker (they grab ports 5432/6379)
|
|
- `brew services stop postgresql@17 && brew services stop redis`
|
|
|
|
## Cập Nhật Lần Cuối
|
|
2026-04-12 — Initial setup, 36 containers running healthy
|