Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

44 lines
1.7KB

  1. #!/bin/bash
  2. cd /home/sp/go/src/SFM_Loan_RestApi/
  3. go build
  4. rm -rf /tmp/sfm_loan_rest_api_dist
  5. mkdir -p /tmp/sfm_loan_rest_api_dist/local-lib
  6. mkdir -p /tmp/sfm_loan_rest_api_dist/var-sfmapi
  7. mkdir -p /tmp/sfm_loan_rest_api_dist/var-sfmapi/log
  8. mkdir -p /tmp/sfm_loan_rest_api_dist/var-sfmapi/tmp
  9. # for /usr/local/lib/sfmapi
  10. cp apiv1 /tmp/sfm_loan_rest_api_dist/local-lib/
  11. cp deploy/config.prod.json /tmp/sfm_loan_rest_api_dist/local-lib/config.json
  12. cp -a html /tmp/sfm_loan_rest_api_dist/local-lib/
  13. cp -a assets /tmp/sfm_loan_rest_api_dist/local-lib/
  14. # for /var/sfmapi
  15. cp -a uploads /tmp/sfm_loan_rest_api_dist/var-sfmapi/
  16. cp -a tmp /tmp/sfm_loan_rest_api_dist/var-sfmapi/
  17. # make sure remote service are all available
  18. ssh root@c5016.biukop.com.au 'mkdir -p /usr/local/lib/sfmapi/ && mkdir -p /var/sfmapi/tmp/dist'
  19. scp deploy/dependency.sh root@c5016.biukop.com.au:/usr/local/lib/sfmapi/
  20. scp deploy/local_update.sh root@c5016.biukop.com.au:/usr/local/lib/sfmapi/
  21. scp deploy/sfmapi.service root@c5016.biukop.com.au:/usr/local/lib/sfmapi/sfmapi.service
  22. ssh root@c5016.biukop.com.au 'chmod +x /usr/local/lib/sfmapi/dependency.sh && /usr/local/lib/sfmapi/dependency.sh'
  23. #dump mysql database
  24. echo "dump datebase with stored procedures"
  25. mysqldump -u root -psp --routines syd_credit > /tmp/sfm_loan_rest_api_dist/syd_credit.sql
  26. gzip -f /tmp/sfm_loan_rest_api_dist/syd_credit.sql
  27. echo "copy it to remote server"
  28. scp /tmp/sfm_loan_rest_api_dist/syd_credit.sql.gz root@c5016.biukop.com.au:/var/sfmapi/tmp/dist/
  29. echo "sync files to remote server"
  30. rsync -avh --delete /tmp/sfm_loan_rest_api_dist/ root@c5016.biukop.com.au:/var/sfmapi/tmp/dist/
  31. # remote update
  32. ssh root@c5016.biukop.com.au '/usr/local/lib/sfmapi/local_update.sh'
  33. # remove binary file
  34. rm -f /home/sp/go/src/SFM_Loan_RestApi/apiv1