Te├── infrastructure/ # Infrastructure services ├── databases/ # Database services │ ├── mysql/ ## 📂 Data Persi## 📝 Development Status
- ✅ **Infrastruc## 📊 Monitoring Features
- System Overview (CPU, Memory, Disk)
- Container Metrics
- Application Performance (khi implement services)
- Custom dashboards có thể thêm
- System metrics (Node Exporter)
- Container metrics (cAdvisor)
- Application metrics (ready for services)
- Custom alerting rules
- Docker container logs
- System logs
- Application logs (structured logging ready)
- Log search và filtering trong Grafana
# Clone và setup
git clone <your-repo>
cd software-templatetack**: Hoàn thiện (MySQL, MongoDB, Redis, Kafka)
- ✅ **Monitoring & Logging**: Hoàn thiện (Grafana, Prometheus, Loki)
- ✅ **Docker Orchestration**: Centralized compose với environment variables
- ✅ **Data Persistence**: Local folder mapping
- ✅ **Web Management UIs**: Grafana, Prometheus, Mongo Express, Redis Commander, Kafka UI
- ✅ **Observability**: Metrics collection, log aggregation, alerting rules
- ⚠️ **Backend Services**: Template đã sẵn sàng, chờ implementation
- ⚠️ **Frontend Applications**: Template đã sẵn sàng, chờ implementation
- ⚠️ **Custom Dashboards**: Sẽ được thêm theo từng service
- ⚠️ **API Documentation**: Sẽ được thêm khi implement servicesất cả data được lưu trong các folder local:
- `infrastructure/databases/mysql/data/` - MySQL data
- `infrastructure/databases/mongodb/data/` - MongoDB data
- `infrastructure/redis/data/` - Redis data
- `infrastructure/kafka/data/` - Kafka data
- `infrastructure/monitoring/data/` - Prometheus metrics data
- Docker volumes cho Grafana và Loki dataQL + data folder
│ └── mongodb/ # MongoDB + data folder
├── kafka/ # Apache Kafka + data folder
├── redis/ # Redis cache + data folder
├── monitoring/ # Monitoring & Logging stack
│ ├── grafana/ # Grafana dashboards & config
│ ├── data/ # Prometheus data
│ └── *.yml # Config files
└── docker-compose.yml # Infrastructure orchestrationcấu trúc software với kiến trúc microservices sử dụng Docker và Docker Compose. Toàn bộ stack được quản lý tập trung với một file docker-compose.yml duy nhất.
## 🏗️ Cấu trúc dự án
software-template/ ├── docker-compose.yml # Main orchestration file ├── .env # Environment configuration ├── .env.example # Environment template ├── .gitignore # Git ignore rules ├── README.md # This file ├── back-end/ # Backend services │ ├── gateway/ # API Gateway (placeholder) │ ├── service1/ # Microservice 1 (placeholder) │ ├── service2/ # Microservice 2 (placeholder) │ ├── service3/ # Microservice 3 (placeholder) │ └── docker-compose.yml # Backend services config ├── front-end/ # Frontend applications │ ├── application/ # User application (placeholder) │ ├── admin-dashboard/ # Admin dashboard (placeholder) │ └── docker-compose.yml # Frontend services config └── infrastructure/ # Infrastructure services ├── databases/ # Database services │ ├── mysql/ # MySQL + data folder │ └── mongodb/ # MongoDB + data folder ├── kafka/ # Apache Kafka + data folder ├── redis/ # Redis cache + data folder └── docker-compose.yml # Infrastructure orchestration
## 🚀 Tính năng chính
- **Microservices Architecture**: Backend được chia thành các services độc lập
- **API Gateway**: Centralized entry point cho tất cả APIs
- **Multi Frontend**: Hỗ trợ cả user app và admin dashboard
- **Container-first**: Toàn bộ services chạy trên Docker
- **Infrastructure as Code**: Database, cache, message broker được containerized
## 🛠️ Tech Stack
### Backend
- API Gateway (Kong, Nginx, hoặc custom)
- Microservices (Node.js, Python, Java, Go...)
- Message Broker: Apache Kafka + Zookeeper
- Cache: Redis
### Frontend
- User Application (React, Vue, Angular...)
- Admin Dashboard (React Admin, Angular Admin...)
### Database
- MySQL 8.0 (Primary database)
- MongoDB 7.0 (NoSQL database)
### Monitoring & Logging
- **Grafana** - Dashboards và visualization
- **Prometheus** - Metrics collection và alerting
- **Loki** - Centralized logging
- **Promtail** - Log shipping agent
- **Node Exporter** - System metrics
- **cAdvisor** - Container metrics
### DevOps
- Docker & Docker Compose
- Container orchestration ready
- Infrastructure as Code
## 🚦 Cách sử dụng
### 1. Setup Environment
```bash
# Copy environment template
cp .env.example .env
# Cập nhật các giá trị trong .env theo nhu cầu
nano .env
# Khởi động tất cả services
docker-compose up -d
# Xem logs
docker-compose logs -f
# Dừng tất cả services
docker-compose down# Chỉ databases
docker-compose up -d mysql mongodb
# Chỉ cache và message broker
docker-compose up -d redis kafka zookeeper
# Chỉ monitoring stack
docker-compose up -d grafana prometheus loki promtail node-exporter cadvisor
# Infrastructure cơ bản (không có monitoring)
docker-compose up -d mysql mongodb redis kafka zookeeper# Xem trạng thái services
docker-compose ps
# Restart một service
docker-compose restart mysql
# Xem logs của service cụ thể
docker-compose logs -f mongodb
# Clean up (xóa containers, networks, volumes)
docker-compose down -vSau khi khởi động, các web interface sau sẽ có sẵn:
| Service | URL | Credentials | Description |
|---|---|---|---|
| Grafana | http://localhost:3000 | Xem trong .env |
Dashboards & Monitoring |
| Prometheus | http://localhost:9090 | Không cần | Metrics & Alerts |
| Mongo Express | http://localhost:8081 | Xem trong .env |
MongoDB Admin |
| Redis Commander | http://localhost:8082 | Xem trong .env |
Redis Admin |
| Kafka UI | http://localhost:8080 | Không cần | Kafka Management |
| cAdvisor | http://localhost:8088 | Không cần | Container Metrics |
Tất cả data được lưu trong các folder local:
infrastructure/databases/mysql/data/- MySQL datainfrastructure/databases/mongodb/data/- MongoDB datainfrastructure/redis/data/- Redis datainfrastructure/kafka/data/- Kafka data
- ✅ Infrastructure Stack: Hoàn thiện (MySQL, MongoDB, Redis, Kafka)
- ✅ Docker Orchestration: Centralized compose với environment variables
- ✅ Data Persistence: Local folder mapping
- ✅ Web Management UIs: Mongo Express, Redis Commander, Kafka UI
⚠️ Backend Services: Template đã sẵn sàng, chờ implementation⚠️ Frontend Applications: Template đã sẵn sàng, chờ implementation⚠️ API Documentation: Sẽ được thêm khi implement services
- Tạo folder trong
back-end/service-name/ - Thêm Dockerfile và source code
- Uncomment service trong
back-end/docker-compose.yml - Thêm environment variables trong
.env - Thêm metrics endpoint
/metricscho Prometheus - Configure logging để ship logs tới Loki
- Run:
docker-compose up -d service-name
- Tạo folder trong
front-end/app-name/ - Thêm Dockerfile và source code
- Uncomment application trong
front-end/docker-compose.yml - Thêm environment variables trong
.env - Configure logging và error tracking
- Run:
docker-compose up -d app-name
- Truy cập Grafana: http://localhost:3000
- Import dashboard hoặc tạo mới
- Save dashboard JSON vào
infrastructure/monitoring/grafana/dashboards/ - Dashboard sẽ auto-load khi restart Grafana
- Environment Files:
.envđược git ignore, chỉ commit.env.example - Default Passwords: Thay đổi tất cả passwords trong
.envcho production - Network: Services communicate qua Docker's default bridge network
- Ports: Chỉ expose ports cần thiết ra host
# Clone và setup
git clone <your-repo>
cd software-template
# Setup environment
cp .env.example .env
# Sửa các giá trị trong .env theo nhu cầu
# Khởi động infrastructure
docker-compose up -d
# Kiểm tra services
docker-compose ps
# Truy cập web interfaces:
# - Grafana (Monitoring): http://localhost:3000
# - Prometheus (Metrics): http://localhost:9090
# - Mongo Express: http://localhost:8081
# - Redis Commander: http://localhost:8082
# - Kafka UI: http://localhost:8080
# - cAdvisor: http://localhost:8088- Fork repository
- Tạo feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push branch:
git push origin feature/amazing-feature - Tạo Pull Request
Đây là template mở, có thể sử dụng và customize theo nhu cầu dự án.
Template version: v1.0 - Last updated: October 2025