chore: update project documentation, audit reports, and initialize IDE configuration files
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 29s
CI / E2E Tests (push) Has been skipped
CodeQL Analysis / CodeQL (javascript-typescript) (push) Failing after 2m42s
Deploy / Build Web Image (push) Failing after 27s
Deploy / Build AI Services Image (push) Failing after 29s
E2E Tests / Playwright E2E (push) Failing after 43s
Deploy / Build API Image (push) Failing after 1m31s
Security Scanning / Dependency Audit (pnpm) (push) Failing after 6s
Security Scanning / Trivy Scan — API Image (push) Failing after 5m35s
Security Scanning / Trivy Scan — AI Services Image (push) Failing after 3m45s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
Security Scanning / Trivy Scan — Web Image (push) Failing after 13m51s
Security Scanning / Trivy Filesystem Scan (push) Failing after 14m46s
Security Scanning / Security Gate (push) Has been cancelled
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 29s
CI / E2E Tests (push) Has been skipped
CodeQL Analysis / CodeQL (javascript-typescript) (push) Failing after 2m42s
Deploy / Build Web Image (push) Failing after 27s
Deploy / Build AI Services Image (push) Failing after 29s
E2E Tests / Playwright E2E (push) Failing after 43s
Deploy / Build API Image (push) Failing after 1m31s
Security Scanning / Dependency Audit (pnpm) (push) Failing after 6s
Security Scanning / Trivy Scan — API Image (push) Failing after 5m35s
Security Scanning / Trivy Scan — AI Services Image (push) Failing after 3m45s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
Security Scanning / Trivy Scan — Web Image (push) Failing after 13m51s
Security Scanning / Trivy Filesystem Scan (push) Failing after 14m46s
Security Scanning / Security Gate (push) Has been cancelled
This commit is contained in:
@@ -1,119 +1,119 @@
|
||||
# Development Environment
|
||||
# Môi Trường Phát Triển
|
||||
|
||||
## Prerequisites
|
||||
## Yêu Cầu Cài Đặt
|
||||
|
||||
- **Docker Engine 24+** & Docker Compose v2
|
||||
- **Node.js 22 LTS**
|
||||
- **pnpm 10.27+** — install via `corepack enable && corepack prepare pnpm@latest --activate`
|
||||
- **pnpm 10.27+** — cài đặt qua `corepack enable && corepack prepare pnpm@latest --activate`
|
||||
|
||||
## Quick Start
|
||||
## Khởi Động Nhanh
|
||||
|
||||
```bash
|
||||
# 1. Copy environment variables
|
||||
# 1. Sao chép các biến môi trường
|
||||
cp .env.example .env
|
||||
|
||||
# 2. Start all infrastructure services
|
||||
# 2. Khởi động tất cả dịch vụ hạ tầng
|
||||
docker compose up -d
|
||||
|
||||
# 3. Verify all services are healthy
|
||||
# 3. Kiểm tra tất cả dịch vụ đang hoạt động bình thường
|
||||
docker compose ps
|
||||
|
||||
# 4. Install dependencies
|
||||
# 4. Cài đặt các phụ thuộc
|
||||
pnpm install
|
||||
|
||||
# 5. Generate Prisma client
|
||||
# 5. Tạo Prisma client
|
||||
pnpm db:generate
|
||||
|
||||
# 6. Run database migrations
|
||||
# 6. Chạy các migration cơ sở dữ liệu
|
||||
pnpm db:migrate:dev
|
||||
|
||||
# 7. Seed the database (optional)
|
||||
# 7. Seed dữ liệu vào cơ sở dữ liệu (tuỳ chọn)
|
||||
pnpm db:seed
|
||||
|
||||
# 8. Start API and Web in dev mode
|
||||
# 8. Khởi động API và Web ở chế độ phát triển
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
API runs at `http://localhost:3001/api/v1`, Web at `http://localhost:3000`.
|
||||
API chạy tại `http://localhost:3001/api/v1`, Web tại `http://localhost:3000`.
|
||||
|
||||
> **Swagger UI**: `http://localhost:3001/api/v1/docs` — interactive API documentation.
|
||||
> **Swagger UI**: `http://localhost:3001/api/v1/docs` — tài liệu API tương tác.
|
||||
|
||||
## Infrastructure Services
|
||||
## Các Dịch Vụ Hạ Tầng
|
||||
|
||||
| Service | Port(s) | Description | Dashboard/UI |
|
||||
| Dịch vụ | Cổng | Mô tả | Bảng điều khiển/UI |
|
||||
|---------|---------|-------------|--------------|
|
||||
| PostgreSQL + PostGIS | 5432 | Database with spatial queries | — |
|
||||
| Redis | 6379 | Cache, sessions, queue | — |
|
||||
| Typesense | 8108 | Full-text search engine | `http://localhost:8108/health` |
|
||||
| MinIO | 9000 / 9001 | S3-compatible object storage | `http://localhost:9001` (console) |
|
||||
| AI Services | 8000 | FastAPI — AVM + moderation | `http://localhost:8000/health` |
|
||||
| Prometheus | 9090 | Metrics collection | `http://localhost:9090` |
|
||||
| Grafana | 3002 | Dashboards & monitoring | `http://localhost:3002` |
|
||||
| PostgreSQL + PostGIS | 5432 | Cơ sở dữ liệu với truy vấn không gian địa lý | — |
|
||||
| Redis | 6379 | Cache, phiên đăng nhập, hàng đợi | — |
|
||||
| Typesense | 8108 | Công cụ tìm kiếm toàn văn bản | `http://localhost:8108/health` |
|
||||
| MinIO | 9000 / 9001 | Lưu trữ đối tượng tương thích S3 | `http://localhost:9001` (console) |
|
||||
| AI Services | 8000 | FastAPI — AVM + kiểm duyệt nội dung | `http://localhost:8000/health` |
|
||||
| Prometheus | 9090 | Thu thập số liệu giám sát | `http://localhost:9090` |
|
||||
| Grafana | 3002 | Bảng điều khiển & giám sát | `http://localhost:3002` |
|
||||
|
||||
## Common Commands
|
||||
## Các Lệnh Thông Dụng
|
||||
|
||||
### Docker Compose
|
||||
|
||||
```bash
|
||||
# Start services
|
||||
# Khởi động các dịch vụ
|
||||
docker compose up -d
|
||||
|
||||
# View logs (all or specific service)
|
||||
# Xem nhật ký (tất cả hoặc từng dịch vụ cụ thể)
|
||||
docker compose logs -f
|
||||
docker compose logs -f postgres
|
||||
|
||||
# Stop services (data preserved in volumes)
|
||||
# Dừng các dịch vụ (dữ liệu được giữ nguyên trong volume)
|
||||
docker compose down
|
||||
|
||||
# Stop and remove all data
|
||||
# Dừng và xoá toàn bộ dữ liệu
|
||||
docker compose down -v
|
||||
|
||||
# Restart a single service
|
||||
# Khởi động lại một dịch vụ đơn lẻ
|
||||
docker compose restart redis
|
||||
|
||||
# Check service health
|
||||
# Kiểm tra tình trạng dịch vụ
|
||||
docker compose ps
|
||||
```
|
||||
|
||||
### Development
|
||||
### Phát Triển
|
||||
|
||||
```bash
|
||||
pnpm dev # Start all apps in watch mode
|
||||
pnpm build # Build all packages
|
||||
pnpm lint # ESLint across monorepo
|
||||
pnpm typecheck # TypeScript type checking
|
||||
pnpm format # Prettier formatting
|
||||
pnpm test # Run unit/integration tests
|
||||
pnpm dev # Khởi động tất cả ứng dụng ở chế độ theo dõi
|
||||
pnpm build # Build tất cả các gói
|
||||
pnpm lint # ESLint trên toàn bộ monorepo
|
||||
pnpm typecheck # Kiểm tra kiểu TypeScript
|
||||
pnpm format # Định dạng bằng Prettier
|
||||
pnpm test # Chạy kiểm thử đơn vị/tích hợp
|
||||
```
|
||||
|
||||
### Database
|
||||
### Cơ Sở Dữ Liệu
|
||||
|
||||
```bash
|
||||
pnpm db:generate # Regenerate Prisma client
|
||||
pnpm db:migrate:dev # Create and apply migrations
|
||||
pnpm db:seed # Seed database
|
||||
pnpm db:studio # Open Prisma Studio (visual editor)
|
||||
pnpm db:reset # Reset database (destructive)
|
||||
pnpm db:generate # Tạo lại Prisma client
|
||||
pnpm db:migrate:dev # Tạo và áp dụng các migration
|
||||
pnpm db:seed # Seed dữ liệu vào cơ sở dữ liệu
|
||||
pnpm db:studio # Mở Prisma Studio (trình chỉnh sửa trực quan)
|
||||
pnpm db:reset # Đặt lại cơ sở dữ liệu (thao tác phá huỷ dữ liệu)
|
||||
```
|
||||
|
||||
### E2E Testing
|
||||
### Kiểm Thử E2E
|
||||
|
||||
```bash
|
||||
pnpm test:e2e # Run all E2E tests
|
||||
pnpm test:e2e:api # API tests only
|
||||
pnpm test:e2e:web # Web UI tests only
|
||||
pnpm test:e2e:report # Open HTML test report
|
||||
pnpm test:e2e # Chạy tất cả kiểm thử E2E
|
||||
pnpm test:e2e:api # Chỉ kiểm thử API
|
||||
pnpm test:e2e:web # Chỉ kiểm thử giao diện Web
|
||||
pnpm test:e2e:report # Mở báo cáo kiểm thử HTML
|
||||
```
|
||||
|
||||
## Connecting to Services
|
||||
## Kết Nối Đến Các Dịch Vụ
|
||||
|
||||
### PostgreSQL
|
||||
|
||||
```bash
|
||||
# Via psql
|
||||
# Qua psql
|
||||
psql postgresql://goodgo:goodgo_secret@localhost:5432/goodgo
|
||||
|
||||
# Verify PostGIS
|
||||
# Xác minh PostGIS
|
||||
psql postgresql://goodgo:goodgo_secret@localhost:5432/goodgo -c "SELECT PostGIS_Version();"
|
||||
```
|
||||
|
||||
@@ -132,7 +132,7 @@ curl http://localhost:8108/health
|
||||
### MinIO
|
||||
|
||||
- **API**: `http://localhost:9000`
|
||||
- **Console**: `http://localhost:9001` (login with `MINIO_ACCESS_KEY` / `MINIO_SECRET_KEY` from your `.env`)
|
||||
- **Console**: `http://localhost:9001` (đăng nhập bằng `MINIO_ACCESS_KEY` / `MINIO_SECRET_KEY` từ file `.env`)
|
||||
|
||||
### AI Services
|
||||
|
||||
@@ -143,13 +143,13 @@ curl http://localhost:8000/health
|
||||
### Grafana
|
||||
|
||||
- **URL**: `http://localhost:3002`
|
||||
- **Login**: `admin` / `admin` (default, configurable via `.env`)
|
||||
- **Đăng nhập**: `admin` / `admin` (mặc định, có thể cấu hình qua `.env`)
|
||||
|
||||
## Troubleshooting
|
||||
## Xử Lý Sự Cố
|
||||
|
||||
- **Port conflict** — Change ports in `.env` (e.g., `DB_PORT=5433`)
|
||||
- **Permission issues** — Run `docker compose down -v` and restart
|
||||
- **PostGIS not available** — Ensure using `postgis/postgis:16-3.4` image
|
||||
- **Prisma client out of date** — Run `pnpm db:generate` after pulling schema changes
|
||||
- **AI service not starting** — Check `docker compose logs ai-services` for Python dependency errors
|
||||
- **Typesense unhealthy** — Verify `TYPESENSE_API_KEY` matches in `.env` and Docker config
|
||||
- **Xung đột cổng** — Thay đổi cổng trong `.env` (ví dụ: `DB_PORT=5433`)
|
||||
- **Lỗi quyền truy cập** — Chạy `docker compose down -v` rồi khởi động lại
|
||||
- **PostGIS không khả dụng** — Đảm bảo đang sử dụng image `postgis/postgis:16-3.4`
|
||||
- **Prisma client lỗi thời** — Chạy `pnpm db:generate` sau khi kéo các thay đổi schema
|
||||
- **AI service không khởi động được** — Kiểm tra `docker compose logs ai-services` để xem lỗi phụ thuộc Python
|
||||
- **Typesense không khoẻ mạnh** — Xác minh `TYPESENSE_API_KEY` khớp trong `.env` và cấu hình Docker
|
||||
|
||||
Reference in New Issue
Block a user