update.sh 795 B

1234567891011121314151617181920212223242526272829303132
  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. sudo chmod +x /data/wwwroot/game/*
  13. # 编译后端服务
  14. cd /data/wwwroot/server/
  15. /usr/local/go/bin/go env -w GOSUMDB=off
  16. export GO111MODULE=on && export GOPROXY=https://goproxy.io && /usr/local/go/bin/go build main.go
  17. # 重启Nginx服务
  18. sudo systemctl restart nginx.service
  19. # 重启后端服务和游戏服务
  20. sudo systemctl daemon-reload
  21. sudo systemctl enable server.service
  22. sudo systemctl restart server.service
  23. sudo systemctl enable game.service
  24. sudo systemctl restart game.service