19cc7a778c
- Deleted old gRPC service definitions in `game_grpc.pb.go` and `public.go`. - Added new API server implementations for objectstory, player, and shop services. - Introduced configuration files for new APIs in `etc/*.yaml`. - Created main entry points for each service in `objectstory.go`, `player.go`, and `shop.go`. - Removed unused user update handler and user API files. - Added utility functions for context management and HTTP header parsing. - Introduced PostgreSQL backup configuration in `backup/postgreSql.yaml`.
49 lines
1.2 KiB
Markdown
49 lines
1.2 KiB
Markdown
# Docker 服务器部署方案(Gitea Actions)
|
||
|
||
本方案替代 Jenkins:
|
||
|
||
1. `push` 代码后由 Gitea Actions 构建镜像并推送 Harbor。
|
||
2. 同一工作流通过 SSH 连接服务器,执行 `docker compose pull && docker compose up -d` 完成更新。
|
||
|
||
## 1) 服务器准备
|
||
|
||
在目标服务器安装:
|
||
|
||
- Docker Engine
|
||
- Docker Compose 插件(`docker compose version` 可用)
|
||
|
||
并确保部署用户有 docker 权限:
|
||
|
||
```bash
|
||
sudo usermod -aG docker <deploy-user>
|
||
```
|
||
|
||
## 2) Gitea 仓库 Secrets
|
||
|
||
在仓库中配置以下 Secrets:
|
||
|
||
- `HARBOR_REGISTRY`:例如 `harbor.example.com`
|
||
- `HARBOR_PROJECT`:例如 `juwan`
|
||
- `HARBOR_USERNAME`
|
||
- `HARBOR_PASSWORD`
|
||
- `DEPLOY_HOST`:服务器地址
|
||
- `DEPLOY_PORT`:可选,默认 `22`
|
||
- `DEPLOY_USER`:服务器 SSH 用户
|
||
- `DEPLOY_SSH_KEY`:私钥内容(PEM)
|
||
- `DEPLOY_PATH`:可选,默认 `/opt/st-1-example`
|
||
|
||
## 3) 触发规则
|
||
|
||
- 构建推送:`main/master/dev/feature/**`
|
||
- 自动部署:仅 `main/master`
|
||
|
||
如需改分支规则,编辑:
|
||
|
||
- `.gitea/workflows/build-push-harbor.yml`
|
||
|
||
## 4) 端口与服务
|
||
|
||
Compose 文件:`deploy/docker/docker-compose.yml`
|
||
|
||
默认映射:`8888:8888`,服务名:`st-example`。
|