Files
ZYZ/README.md
2026-03-13 01:38:40 +00:00

39 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 环境搭建
- 安装 ts 环境
`npm install -g tsc ts-node typescript`
- 安装 pinus
`npm install -g pinus`
# 运行
## 简介
服务器主要分为游戏服和账号服,游戏服以长连接为主,处理主要的游戏逻辑。账号服以短连接为主,处理账号等功能。
## 运行游戏服
`cd game-server && node tsrun.js`
## 运行 web-server
`cd web-server && node dev`
cd 到 web-server下面
`npm run stop && npm run tsc && npm run start`
## 扩容事项
1.master.ts对应环境的主机host填写内网ip地址新服务器host填写主机host地址
2.config/database.ts填写对应环境下的配置
3.新服务器执行命令(host为主机内网ip)
4.id绝不能重复
5.connector服务的clientPort端口需暴露必须加frontend=true
6.扩容脚本./pm2StarterDistribute.sh
7.手输命令示例如下:
`pm2 start ./dist/app.js --name="activity-server-2" -x -- env=dev id=activity-server-2 host=172.26.145.171 port=9061 serverType=activity`
`pm2 start ./dist/app.js --name="connector-server-4" -x -- env=alpha id=connector-server-4 host=172.26.145.171 port=9062 clientHost=121.89.211.172 clientPort=3050 serverType=connector frontend=true`
8.主机部分的server.ts内的server如果需要做rpc remotehost需要从127.0.0.1改为私网地址
---
web-server
`cd web-server`
`HOME=/root node node_modules/.bin/egg-bin dev`