上传编译脚本以及部署编译文档
This commit is contained in:
parent
aaa39e13ea
commit
b882b96d21
@ -1,5 +1,6 @@
|
|||||||
set GOOS=linux
|
set GOOS=linux
|
||||||
set CGO_ENABLED=0
|
set CGO_ENABLED=0
|
||||||
|
cd ../
|
||||||
del bin/mainte,bin/gateway,bin/worker
|
del bin/mainte,bin/gateway,bin/worker
|
||||||
go build -o ./bin/mainte ./services/mainte/main.go
|
go build -o ./bin/mainte ./services/mainte/main.go
|
||||||
go build -o ./bin/gateway ./services/gateway/main.go
|
go build -o ./bin/gateway ./services/gateway/main.go
|
@ -1,6 +1,7 @@
|
|||||||
SET CGO_ENABLED=0
|
SET CGO_ENABLED=0
|
||||||
SET GOOS=windows
|
SET GOOS=windows
|
||||||
SET GOARCH=amd64
|
SET GOARCH=amd64
|
||||||
|
cd ../
|
||||||
go build -o build/gateway.exe services/gateway/main.go
|
go build -o build/gateway.exe services/gateway/main.go
|
||||||
go build -o build/worker.exe services/worker/main.go
|
go build -o build/worker.exe services/worker/main.go
|
||||||
go build -o build/web.exe services/web/main.go
|
go build -o build/web.exe services/web/main.go
|
1
linux_bulid.sh → bin/bulid_linux.sh
Executable file → Normal file
1
linux_bulid.sh → bin/bulid_linux.sh
Executable file → Normal file
@ -1,6 +1,7 @@
|
|||||||
CGO_ENABLED=0
|
CGO_ENABLED=0
|
||||||
GO111MODULE=on
|
GO111MODULE=on
|
||||||
GOOS=linux
|
GOOS=linux
|
||||||
|
cd ../
|
||||||
go build -o ./bin/mainte ./services/mainte/main.go
|
go build -o ./bin/mainte ./services/mainte/main.go
|
||||||
go build -o ./bin/gateway ./services/gateway/main.go
|
go build -o ./bin/gateway ./services/gateway/main.go
|
||||||
go build -o ./bin/worker ./services/worker/main.go
|
go build -o ./bin/worker ./services/worker/main.go
|
82
bin/编译部署文档.md
Normal file
82
bin/编译部署文档.md
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
## 梦工厂编译部署文档
|
||||||
|
|
||||||
|
### 编译项目代码
|
||||||
|
1. 拉取git仓库代码:git clone http://git.legu.cc/liwei_3d/go_dreamfactory.git
|
||||||
|
2. 进入 go_dreamfactory 目录 执行:go mod tidy (需要安装golang 版本 go1.18.2以上环境:https://www.jianshu.com/p/35a161738d83)
|
||||||
|
3. 进入 go_dreamfactory/bin 目录下,执行 bulid_linux.sh 脚本 编译执行文件
|
||||||
|
4. 拷贝bin目录作为发布文件
|
||||||
|
|
||||||
|
### 安装部署依赖环境
|
||||||
|
1. 安装 MongoDB 教程 https://segmentfault.com/a/1190000039268500
|
||||||
|
2. 安装 Redis 教程
|
||||||
|
- 单节点 https://segmentfault.com/a/1190000023178516
|
||||||
|
- 集群:https://blog.csdn.net/jiang1986829/article/details/108667854
|
||||||
|
3. 安装 Consul https://blog.csdn.net/jeikerxiao/article/details/78114413
|
||||||
|
|
||||||
|
### 修改配置文件
|
||||||
|
1. 进入发布文件(bin 目录) 下 conf 目录
|
||||||
|
2. 修改配置文件中 MongoDB,Redis,Consul 相关配置
|
||||||
|
```
|
||||||
|
rpcx: #rpcx 系统配置
|
||||||
|
Debug: true
|
||||||
|
AutoConnect: true #自动连接到集群服务节点
|
||||||
|
RpcxStartType: 1 #0 服务端 1是客户端
|
||||||
|
ConsulServers: ["10.0.0.9:8500"] #Consul 服务地址
|
||||||
|
cache: #缓存系统
|
||||||
|
Redis_IsCluster: false #是否是集群
|
||||||
|
Redis_Addr: ["10.0.0.9:6986"] #Redis 服务地址
|
||||||
|
Redis_Password: "li13451234" #Redis 服务密码
|
||||||
|
Redis_DB: 6 #Redis 数据存储db
|
||||||
|
db: #存储系统
|
||||||
|
MongodbUrl: "mongodb://10.0.0.9:27019" #Mongodb服务地址
|
||||||
|
MongodbDatabase: "dreamfactory" #梦工厂数据库名
|
||||||
|
```
|
||||||
|
3. 修改区服id
|
||||||
|
```
|
||||||
|
tag : "dreamfactory_liwei" #服务集群标签 在梦工厂中作为区服id 同区服内的服务可以互相通信,不同区服的不能互相通信
|
||||||
|
```
|
||||||
|
4. 配置跨服服务器 此配置只在gateway服务器上
|
||||||
|
```
|
||||||
|
gateway:
|
||||||
|
Debug: true
|
||||||
|
SpanServiceTag: "dreamfactory_span" #服务服务集群
|
||||||
|
ListenPort: 7891
|
||||||
|
```
|
||||||
|
5. 配置多个worker服务
|
||||||
|
- 配置多个worker 只需要拷贝 worker_1.yaml 文件到 worker_2.yaml 文件
|
||||||
|
- 修改 worker_2.yaml 下配置文件中
|
||||||
|
```
|
||||||
|
id: "worker_1" #修改worker_1 到worker_2, 服务的唯一id 在同一集群下唯一即可
|
||||||
|
ip: "127.0.0.1" #运行主机Ip 保证同集群下服务可以通过此ip互相访问
|
||||||
|
port: 9569 #rpc通信端口 不被占用即可
|
||||||
|
|
||||||
|
log: #日志系统
|
||||||
|
FileName: "./log/worker_1.log" #修改日志文件地址 以免和其他worker冲突 日志文件存放地址
|
||||||
|
```
|
||||||
|
|
||||||
|
### 部署梦工厂服务
|
||||||
|
1. 将修改完毕的发布文件(bin 目录)考本到目标主机服务器上,选择适合目录保存
|
||||||
|
2. 进入发布文件 执行 ./start.sh 脚本 正常执行
|
||||||
|
```
|
||||||
|
[root@master bin]# ./start.sh
|
||||||
|
starting mainte...
|
||||||
|
start success
|
||||||
|
starting worker_1...
|
||||||
|
start success
|
||||||
|
starting gateway_1...
|
||||||
|
start success
|
||||||
|
```
|
||||||
|
3. 程序启动后会自动生成 log目录,进入log 目录 查看各个服务文件启动日志是否正常 ,每个服务会对应一个日志文件 日志文件名在 服务配置中有配置,正常启动
|
||||||
|
```
|
||||||
|
2022/07/22 11:45:56.681 INFO rpcx/service.go:80 Sys log Init success !
|
||||||
|
2022/07/22 11:45:56.682 INFO rpcx/service.go:86 Sys event Init success !
|
||||||
|
2022/07/22 11:45:56.682 INFO rpcx/service.go:92 Sys codec Init success !
|
||||||
|
2022/07/22 11:45:56.682 INFO rpcx/service.go:98 Sys rpcx Init success !
|
||||||
|
2022/07/22 11:45:56.682 INFO services/servicebase.go:24 init sys.configure success!
|
||||||
|
2022/07/22 11:45:56.682 INFO cbase/servicebase.go:66 服务[gateway_1] 初始化完成!
|
||||||
|
2022/07/22 11:45:56.682 INFO cbase/servicebase.go:89 服务[gateway_1:1.0.0.0] 启动完成!
|
||||||
|
2022/07/22 11:45:56.682 INFO cbase/servicebase.go:109 注册模块【gateway】
|
||||||
|
|
||||||
|
```
|
||||||
|
4. 是同网页工具以及客户端 测试服务是否正常
|
||||||
|
1. 网页工具 http://10.0.1.11:8848/#/protocol/index 修改页面中服务器连接地址 点击连接,测试user.login协议
|
Loading…
Reference in New Issue
Block a user