install.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. ${CURRENT_DIR}/${PROJECT_LIBS}/
  43. echo "copy jar done"
  44. # 服务启动
  45. if [ -f ${CURRENT_DIR}/jenkins-server.sh ];then
  46. echo "./jenkins-server.sh server"
  47. cd ${CURRENT_DIR} && ./jenkins-server.sh server
  48. else
  49. echo "jenkins-server.sh not exist"
  50. exit 1;
  51. fi