help.sh 759 B

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