update.sh 726 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. set -e
  3. # 复制Nginx、服务配置配置
  4. sudo cp -r ./tools/centos/* /
  5. # 复制后端服务到运行目录
  6. sudo cp -r ./server /data/wwwroot/
  7. # 创建游戏引擎服务端运行目录
  8. if [ ! -d "/data/wwwroot/game" ]; then
  9. mkdir -p /data/wwwroot/game
  10. fi
  11. # 编译后端服务
  12. cd /data/wwwroot/server/
  13. /usr/local/go/bin/go env -w GOSUMDB=off
  14. export GO111MODULE=on && export GOPROXY=https://goproxy.io && /usr/local/go/bin/go build main.go
  15. # 重启Nginx服务
  16. sudo systemctl restart nginx.service
  17. # 重启后端服务和游戏服务
  18. sudo systemctl daemon-reload
  19. sudo systemctl enable server.service
  20. sudo systemctl restart server.service
  21. sudo systemctl enable game.service
  22. sudo systemctl restart game.service