forked from xiangwang25/whale-town-end-v2
feat: integrate invitation access, world NPCs, and deployment
This commit is contained in:
@@ -53,7 +53,13 @@ cp client/.env.example client/.env.local
|
||||
pnpm --filter whale-town-admin run build
|
||||
```
|
||||
|
||||
确认 `client/.env.local` 中的 `VITE_API_BASE_URL` 指向实际后端 HTTPS 地址。该值在构建时写入管理端产物,修改后需要重新构建。
|
||||
同域部署时保持 `client/.env.local` 中的 `VITE_API_BASE_URL=/api`。该值在构建时写入管理端产物,修改后需要重新构建。
|
||||
|
||||
首次启用邀请码功能或更新到包含该功能的版本时,在重启服务前执行数据库迁移:
|
||||
|
||||
```bash
|
||||
pnpm run db:migrate
|
||||
```
|
||||
|
||||
## 4. 启动服务
|
||||
|
||||
@@ -71,30 +77,29 @@ pm2 logs whale-town-end-v2
|
||||
|
||||
## 5. 配置 Nginx
|
||||
|
||||
安装后端和管理端模板:
|
||||
安装同域部署模板:
|
||||
|
||||
```bash
|
||||
sudo cp deploy/nginx/whaletownend-v2.conf.example /etc/nginx/conf.d/whaletownend-v2.conf
|
||||
sudo cp deploy/nginx/whaletown-admin-v2.conf.example /etc/nginx/conf.d/whaletown-admin-v2.conf
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
```
|
||||
|
||||
后端模板将 REST API 转发到 `3000`,将 `/game` 转发到独立的聊天 WebSocket 端口 `3001`,并为 `/location-broadcast` 和 `/ws/notice` 保留 REST 端口上的 WebSocket Upgrade。上线前还需在 Nginx 或上游代理配置 TLS。
|
||||
模板在同一域名下提供 `/admin/` 管理端,将 `/api/` 前缀剥离后转发到 `3000`,将 `/game` 转发到独立的聊天 WebSocket 端口 `3001`,并为 `/location-broadcast` 和 `/ws/notice` 保留 REST 端口上的 WebSocket Upgrade。`whaletown-admin-v2.conf.example` 仅用于将旧管理端域名重定向到 `/admin/`,需要保留旧域名时才安装。上线前还需在 Nginx 或上游代理配置 TLS。
|
||||
|
||||
## 6. 验收
|
||||
|
||||
```bash
|
||||
curl --fail https://whaletownend.xinghangee.icu/
|
||||
curl --fail https://whaletownend.xinghangee.icu/health
|
||||
curl --fail https://whaletownend.xinghangee.icu/api-docs
|
||||
curl --fail https://whaletown.novamailio.com/api/
|
||||
curl --fail https://whaletown.novamailio.com/api/health
|
||||
curl --fail https://whaletown.novamailio.com/api/api-docs
|
||||
```
|
||||
|
||||
根接口应返回 `version: 2.0.0`,健康接口应返回 `status: ok`。还应分别验证以下 WebSocket 地址能够完成 `101 Switching Protocols`:
|
||||
|
||||
- `wss://whaletownend.xinghangee.icu/game`
|
||||
- `wss://whaletownend.xinghangee.icu/location-broadcast`
|
||||
- `wss://whaletownend.xinghangee.icu/ws/notice`
|
||||
- `wss://whaletown.novamailio.com/game`
|
||||
- `wss://whaletown.novamailio.com/location-broadcast`
|
||||
- `wss://whaletown.novamailio.com/ws/notice`
|
||||
|
||||
最后使用管理端和游戏客户端完成登录、刷新令牌、世界聊天、位置同步和通知的冒烟测试。
|
||||
|
||||
@@ -105,6 +110,7 @@ curl --fail https://whaletownend.xinghangee.icu/api-docs
|
||||
```bash
|
||||
git pull --ff-only
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run db:migrate
|
||||
pnpm run build
|
||||
pnpm --filter whale-town-admin run build
|
||||
pm2 reload whale-town-end-v2
|
||||
|
||||
Reference in New Issue
Block a user