install.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/sh
  2. # 克隆项目源码,编译打包,部署到服务器
  3. CURRENT_DIR=`pwd`
  4. PROJECT_NAME="cooleshow"
  5. PROJECT_LIBS="libs"
  6. GIT_URL="http://10.206.0.11/yonge/cooleshow.git"
  7. GIT_BRANCH="master"
  8. # 删除旧的项目
  9. rm -rf ${PROJECT_NAME}
  10. echo "delete ${PROJECT_NAME} done"
  11. # 克隆项目
  12. git clone ${GIT_URL} -b ${GIT_BRANCH}
  13. echo "git clone done"
  14. cp build.sh ${PROJECT_NAME}
  15. # 进入项目目录编译打包
  16. cd ${PROJECT_NAME} && ./build.sh
  17. if [ $? -eq 0 ];then
  18. echo 'mvn compile ok!';
  19. else
  20. echo 'mvn compile failed!';
  21. exit 1;
  22. fi
  23. # 复制项目jar包到服务器
  24. rm -rf ${CURRENT_DIR}/${PROJECT_LIBS} && mkdir -p ${CURRENT_DIR}/${PROJECT_LIBS}
  25. echo "create jar dir done"
  26. cp service.md \
  27. cooleshow-user/user-admin/target/user-admin.jar \
  28. audio-analysis/target/audio-analysis.jar \
  29. cooleshow-auth/auth-server/target/auth-server.jar \
  30. cooleshow-bbs/target/cooleshow-bbs.jar \
  31. cooleshow-user/user-classroom/target/user-classroom.jar \
  32. cooleshow-cms/target/cooleshow-cms.jar \
  33. cooleshow-gateway/gateway-web/target/gateway-web.jar \
  34. cooleshow-mall/mall-admin/target/mall-admin.jar \
  35. cooleshow-mall/mall-portal/target/mall-portal.jar \
  36. cooleshow-user/user-student/target/user-student.jar \
  37. cooleshow-task/target/cooleshow-task.jar \
  38. cooleshow-user/user-teacher/target/user-teacher.jar \
  39. cooleshow-user/user-website/target/user-website.jar \
  40. cooleshow-user/user-tenant/target/user-tenant.jar \
  41. cooleshow-websocket/target/cooleshow-websocket.jar \
  42. cooleshow-app/target/cooleshow-app.jar \
  43. ${CURRENT_DIR}/${PROJECT_LIBS}/
  44. echo "copy jar done"
  45. # 服务启动
  46. if [ -f ${CURRENT_DIR}/jenkins-server.sh ];then
  47. echo "./jenkins-server.sh server"
  48. cd ${CURRENT_DIR} && ./jenkins-server.sh server
  49. else
  50. echo "jenkins-server.sh not exist"
  51. exit 1;
  52. fi