reinit
This commit is contained in:
@@ -1,118 +0,0 @@
|
||||
# Backend Services
|
||||
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
backend/
|
||||
├── nginx/ # Nginx 配置
|
||||
├── gateway/ # WebSocket 网关服务
|
||||
├── services/
|
||||
│ └── user-svc/ # 用户微服务
|
||||
├── shared/ # 公共工具包
|
||||
│ ├── logger/ # 日志工具
|
||||
│ ├── errors/ # 错误处理
|
||||
│ ├── postgres/ # PostgreSQL 数据库
|
||||
│ ├── redis/ # Redis 缓存
|
||||
│ └── proto/ # 公共 proto 定义
|
||||
├── scripts/ # 自动化脚本
|
||||
├── docker-compose.yml # 生产环境配置
|
||||
├── docker-compose.dev.yml # 开发环境配置
|
||||
├── Makefile # 命令封装
|
||||
└── README.md # 使用说明
|
||||
```
|
||||
|
||||
## 环境要求
|
||||
|
||||
- Docker
|
||||
- Docker Compose
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 开发环境
|
||||
|
||||
1. 一键启动开发环境:
|
||||
|
||||
```bash
|
||||
make dev-start
|
||||
```
|
||||
|
||||
这会自动:
|
||||
- 生成 proto 代码
|
||||
- 构建开发环境镜像
|
||||
- 启动所有服务
|
||||
- 显示服务状态
|
||||
|
||||
2. 查看服务状态:
|
||||
|
||||
```bash
|
||||
make dev-status
|
||||
```
|
||||
|
||||
3. 查看服务日志:
|
||||
|
||||
```bash
|
||||
make dev-logs
|
||||
```
|
||||
|
||||
4. 停止开发环境:
|
||||
|
||||
```bash
|
||||
make dev-down
|
||||
```
|
||||
|
||||
### 生产环境
|
||||
|
||||
1. 构建生产环境:
|
||||
|
||||
```bash
|
||||
make build
|
||||
```
|
||||
|
||||
2. 启动生产环境:
|
||||
|
||||
```bash
|
||||
make up
|
||||
```
|
||||
|
||||
3. 停止生产环境:
|
||||
|
||||
```bash
|
||||
make down
|
||||
```
|
||||
|
||||
## 其他命令
|
||||
|
||||
### 生成 proto 代码
|
||||
|
||||
```bash
|
||||
make gen-proto
|
||||
```
|
||||
|
||||
### 运行测试
|
||||
|
||||
```bash
|
||||
make test
|
||||
```
|
||||
|
||||
## 服务端口
|
||||
|
||||
- Nginx: 80
|
||||
- Gateway: 8080
|
||||
- User Service: 50051
|
||||
- PostgreSQL: 5432
|
||||
- Redis: 6379
|
||||
|
||||
## 技术栈
|
||||
|
||||
- Go 1.26.1
|
||||
- gRPC
|
||||
- PostgreSQL
|
||||
- Redis
|
||||
- Nginx
|
||||
- Docker
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 所有服务都在 Docker 容器中运行,无宿主机依赖
|
||||
- 服务之间通过内部网络通信
|
||||
- 数据持久化使用 Docker 卷
|
||||
Reference in New Issue
Block a user