更新gateway

This commit is contained in:
eson 2023-11-13 17:52:02 +08:00
parent 7f6b187843
commit 67387be192
5 changed files with 51 additions and 36 deletions

2
go.mod
View File

@ -47,4 +47,4 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)
replace fusen-basic v0.0.0 => gitee.com/fusenpack/fusen-basic v0.0.5-0.20231109042013-6235d097ca40
replace fusen-basic v0.0.0 => gitee.com/fusenpack/fusen-basic v0.0.5-0.20231109081455-017a4a27ebc6

4
go.sum
View File

@ -1,6 +1,6 @@
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231109042013-6235d097ca40 h1:Ab4+L6M36S2ZIjSh2gpStnpL6d2qP5dcPLssxgBTw9E=
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231109042013-6235d097ca40/go.mod h1:VTOMNVbG/jJBGUinI+/pn8MPsbkN7+gwk2DP8vncTkA=
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231109081455-017a4a27ebc6 h1:EfC/otGhF2/ghnIQeoolOY+KtvHryPtwBD4uyCWJxtU=
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231109081455-017a4a27ebc6/go.mod h1:VTOMNVbG/jJBGUinI+/pn8MPsbkN7+gwk2DP8vncTkA=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo=
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=

2
proto

@ -1 +1 @@
Subproject commit f05c723d4dea13224cdd9dcbfeb9ed8c9a59da35
Subproject commit 6616d01aac4a969d7b260733de3673b9ee15470a

View File

@ -10,35 +10,4 @@ cd $script_dir/proto
git pull origin master
cd $script_dir
go run -gcflags="-N" proto/goutils/proto_build/main.go gateway
run_server() {
server_name="server"
gateway_name="grpc-gateway"
# 导航到相应的目录
cd $script_dir/server
echo "build $gateway_name"
go build
# 如果之前存在相同名字的 screen 会话,先将其终止
# 首先尝试关闭已存在的screen会话
existing_session=$(screen -ls | grep -w "$gateway_name")
if [ -n "$existing_session" ]; then
echo "Terminating existing screen session for $gateway_name"
screen -S "$gateway_name" -X quit
while [[ $(screen -ls | grep "\.$gateway_name\s") ]]; do
sleep 0.1s # 等待0.1秒后再次检查
echo "wait for $gateway_name"
done
fi
# 循环检查screen进程是否存在
[ -f .gitignore ] || (echo "server" > .gitignore && echo "main" >> .gitignore)
# 使用 screen 运行 go run <server_name>.go
echo "Running $gateway_name"
screen -dmS $gateway_name -L ./$server_name
}
run_server

46
run_gateway_latest.sh Executable file
View File

@ -0,0 +1,46 @@
#! /bin/bash
./update_fspkg_master.sh
# 获取当前脚本的全局路径
script_path=$(realpath "$0")
# 获取当前脚本的目录
script_dir=$(dirname "$script_path")
cd $script_dir/proto
git pull origin master
cd $script_dir
go run -gcflags="-N" proto/goutils/proto_build/main.go gateway
run_server() {
server_name="server"
gateway_name="grpc-gateway"
# 导航到相应的目录
cd $script_dir/server
echo "build $gateway_name"
go build
# 如果之前存在相同名字的 screen 会话,先将其终止
# 首先尝试关闭已存在的screen会话
existing_session=$(screen -ls | grep -w "$gateway_name")
if [ -n "$existing_session" ]; then
echo "Terminating existing screen session for $gateway_name"
screen -S "$gateway_name" -X quit
while [[ $(screen -ls | grep "\.$gateway_name\s") ]]; do
sleep 0.1s # 等待0.1秒后再次检查
echo "wait for $gateway_name"
done
fi
# 循环检查screen进程是否存在
[ -f .gitignore ] || (echo "server" > .gitignore && echo "main" >> .gitignore)
# 使用 screen 运行 go run <server_name>.go
echo "Running $gateway_name"
screen -dmS $gateway_name -L ./$server_name
}
run_server