diff --git a/scripts_244/auth_bootstrap.yml b/scripts_244/auth_bootstrap.yml new file mode 100644 index 00000000..59c94251 --- /dev/null +++ b/scripts_244/auth_bootstrap.yml @@ -0,0 +1,35 @@ +# Tomcat +server: + port: 18581 + +# Spring +spring: + application: + # 应用名称 + name: bonus-auth + profiles: + # 环境配置 + active: sgzb_bns_test + cloud: + nacos: + username: nacos + password: bonus@Admin123 + discovery: + # 服务注册地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + config: + # 配置中心地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + +#加密组件 +jasypt: + encryptor: + password: Encrypt + diff --git a/scripts/deploy_244.sh b/scripts_244/deploy.sh similarity index 100% rename from scripts/deploy_244.sh rename to scripts_244/deploy.sh diff --git a/scripts/deploy.sh.bk b/scripts_244/deploy.sh.bk similarity index 100% rename from scripts/deploy.sh.bk rename to scripts_244/deploy.sh.bk diff --git a/scripts_244/file_bootstrap.yml b/scripts_244/file_bootstrap.yml new file mode 100644 index 00000000..8902dabc --- /dev/null +++ b/scripts_244/file_bootstrap.yml @@ -0,0 +1,29 @@ +# Tomcat +server: + port: 18583 + +# Spring +spring: + application: + # 应用名称 + name: bonus-file + profiles: + # 环境配置 + active: sgzb_bns_test + cloud: + nacos: + username: nacos + password: bonus@Admin123 + discovery: + # 服务注册地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + config: + # 配置中心地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/scripts_244/gateway_bootstrap.yml b/scripts_244/gateway_bootstrap.yml new file mode 100644 index 00000000..f49d0c72 --- /dev/null +++ b/scripts_244/gateway_bootstrap.yml @@ -0,0 +1,58 @@ +# Tomcat +server: + port: 18580 + servlet: + context-path: zhgd +# Spring +spring: + application: + # 应用名称 + name: bonus-gateway + profiles: + # 环境配置 + active: sgzb_bns_test + cloud: + nacos: + username: nacos + password: bonus@Admin123 + discovery: + # 服务注册地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + config: + # 配置中心地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + sentinel: + # 取消控制台懒加载 + eager: true + transport: + # 控制台地址 + dashboard: 192.168.0.14:18858 + # nacos配置持久化 + datasource: + ds1: + nacos: + username: nacos + password: bonus@Admin123 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + dataId: sentinel-bonus-gateway + groupId: DEFAULT_GROUP + data-type: json + rule-type: gw-flow + + +#系统 自动 加解密开关 +system: + encryptEnabled: false + decryptEnabled: true +#加密组件 +jasypt: + encryptor: + password: Encrypt \ No newline at end of file diff --git a/scripts_244/gen_bootstrap.yml b/scripts_244/gen_bootstrap.yml new file mode 100644 index 00000000..2bf562a7 --- /dev/null +++ b/scripts_244/gen_bootstrap.yml @@ -0,0 +1,29 @@ +# Tomcat +server: + port: 18584 + +# Spring +spring: + application: + # 应用名称 + name: bonus-gen + profiles: + # 环境配置 + active: sgzb_bns_test + cloud: + nacos: + username: nacos + password: bonus@Admin123 + discovery: + # 服务注册地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + config: + # 配置中心地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/scripts_244/job_bootstrap.yml b/scripts_244/job_bootstrap.yml new file mode 100644 index 00000000..aec4f174 --- /dev/null +++ b/scripts_244/job_bootstrap.yml @@ -0,0 +1,29 @@ +# Tomcat +server: + port: 18585 + +# Spring +spring: + application: + # 应用名称 + name: bonus-job + profiles: + # 环境配置 + active: sgzb_bns_test + cloud: + nacos: + username: nacos + password: bonus@Admin123 + discovery: + # 服务注册地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + config: + # 配置中心地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/scripts/kill-ps.sh b/scripts_244/kill-ps.sh similarity index 100% rename from scripts/kill-ps.sh rename to scripts_244/kill-ps.sh diff --git a/scripts_244/material_bootstrap.yml b/scripts_244/material_bootstrap.yml new file mode 100644 index 00000000..1fceb85f --- /dev/null +++ b/scripts_244/material_bootstrap.yml @@ -0,0 +1,35 @@ +# Tomcat +server: + port: 18588 +# Spring +spring: + servlet: + multipart: + # 文件最大 + max-file-size: 20MB + # 设置总上传数据总大小 + max-request-size: 20MB + application: + # 应用名称 + name: bonus-material + profiles: + # 环境配置 + active: sgzb_bns_test + cloud: + nacos: + username: nacos + password: bonus@Admin123 + discovery: + # 服务注册地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + config: + # 配置中心地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + diff --git a/scripts_244/pipeline.sh b/scripts_244/pipeline.sh new file mode 100644 index 00000000..703f10aa --- /dev/null +++ b/scripts_244/pipeline.sh @@ -0,0 +1,80 @@ +pipeline { + agent any + environment { + // 设置自定义JDK路径,因为每个项目可能需要不同版本的jdk + JAVA_HOME = '/usr/lib/jvm/jdk1.8.0_381' + JOBNAME="${JOB_NAME}" + JENKINS_NODE_COOKIE = "dontKillMe" + #SPRING_PROFILES_ACTIVE = "dev" + } + stages { + stage('Check out') { + steps { + withCredentials([usernamePassword(credentialsId: 'f7070987-9b49-4ae1-af6d-53a3bf26799b', passwordVariable: 'Max@2023', usernameVariable: 'bonus')]) { + checkout([ + $class: 'GitSCM', + branches: [[name: '*/master']], + doGenerateSubmoduleConfigurations: false, + extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: '']], + submoduleCfg: [], + userRemoteConfigs: [[url: 'http://192.168.0.244:3000/bonus/Bonus-Cloud-Material.git']] + ]) + } + } + } + stage('Move file') { + steps { + echo 'move file start!' + sh 'chmod 777 ${WORKSPACE}/scripts/*' + // 如果需要拷贝文件,打开并编写以下脚本 + // sh '${WORKSPACE}/scripts/moveFile.sh' + } + } + stage('Build') { + steps { + echo 'build start!' + sh 'env JAVA_HOME=$JAVA_HOME /usr/local/src/apache-maven-3.9.4/bin/mvn clean package' + } + } + stage('Sonar scan') { + steps { + script { + echo 'sonar scan start!' + def scannerHome = tool 'sonar-scanner' + withSonarQubeEnv('sonarqube-server') { + sh "/usr/local/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner " + + "-Dsonar.projectKey=${JOB_NAME} " + + "-Dsonar.projectName=${JOB_NAME} " + + "-Dsonar.sourceEncoding=UTF-8 " + + "-Dsonar.language=java " + + "-Dsonar.projectVersion=1.0 " + + "-Dsonar.sources=. " + + "-Dsonar.java.source=1.8 " + + "-Dsonar.java.target=1.8 " + + "-Dsonar.scm.disabled=true " + + "-Dsonar.exclusions=test/**,node_modules/**,static/**,**/*.js,**/*.html,**/*.css,**/*.jar " + + "-Dsonar.java.binaries=**/target/classes" + } + } + } + } + stage('Deploy') { + steps { + echo 'deploy start!' + sh '''BUILD_ID=DONTKILLME sh ${WORKSPACE}/scripts/deploy.sh''' + } + } + stage('Dingding') { + steps { + echo 'Dingding start!' + script { + def webhookUrl = 'https://oapi.dingtalk.com/robot/send?access_token=eae0af98514a0db9a9a0d5cd8e337d13e7c16cd81d4a90b503e465a573020add' //替换为你自己的钉钉机器人Webhook地址 + def message = "${JOB_NAME} TEST已完成: ${env.BUILD_URL} \n 到Sonarqube查看问题:http://192.168.0.244:9000/dashboard?id=${JOB_NAME} \n 查看新包: http://192.168.0.244/${JOB_NAME}/${BUILD_NUMBER} " + echo "${message}" + sh "curl -H 'Content-Type: application/json' -d '{\"msgtype\": \"text\", \"text\": {\"content\": \"${message}\"}, \"at\": {\"atMobiles\": [\"张三,李四\"], \"isAtAll\": true}}' ${webhookUrl}" + } + } + } + } +} + diff --git a/scripts/stopServices.sh b/scripts_244/stopServices.sh similarity index 100% rename from scripts/stopServices.sh rename to scripts_244/stopServices.sh diff --git a/scripts_244/system_bootstrap.yml b/scripts_244/system_bootstrap.yml new file mode 100644 index 00000000..0c085dc4 --- /dev/null +++ b/scripts_244/system_bootstrap.yml @@ -0,0 +1,33 @@ +# Tomcat +server: + port: 18582 + +# Spring +spring: + application: + # 应用名称 + name: bonus-system + profiles: + # 环境配置 + active: sgzb_bns_test + cloud: + nacos: + username: nacos + password: bonus@Admin123 + discovery: + # 服务注册地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + config: + # 配置中心地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} +system: + supports: + phoneLogin: true + emailLogin: true \ No newline at end of file diff --git a/scripts_244/visual_bootstrap.yml b/scripts_244/visual_bootstrap.yml new file mode 100644 index 00000000..89848758 --- /dev/null +++ b/scripts_244/visual_bootstrap.yml @@ -0,0 +1,29 @@ +# Tomcat +server: + port: 18586 + +# Spring +spring: + application: + # 应用名称 + name: bonus-monitor + profiles: + # 环境配置 + active: sgzb_bns_test + cloud: + nacos: + username: nacos + password: bonus@Admin123 + discovery: + # 服务注册地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + config: + # 配置中心地址 + server-addr: 192.168.0.244:8848 + namespace: sgzb_bns + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/scripts/auth_bootstrap.yml b/scripts_56/auth_bootstrap.yml similarity index 100% rename from scripts/auth_bootstrap.yml rename to scripts_56/auth_bootstrap.yml diff --git a/scripts/deploy.sh b/scripts_56/deploy.sh similarity index 100% rename from scripts/deploy.sh rename to scripts_56/deploy.sh diff --git a/scripts_56/deploy.sh.bk b/scripts_56/deploy.sh.bk new file mode 100644 index 00000000..eea808f5 --- /dev/null +++ b/scripts_56/deploy.sh.bk @@ -0,0 +1,37 @@ +#!/bin/sh +export deploy_path=/opt/builds/${JOB_NAME} + +echo "--------moveFile start--------------" +rm -rf $deploy_path +mkdir -p $deploy_path +cd $deploy_path +rm -rf *.jar +echo "workspace is ${WORKSPACE}" +mv ${WORKSPACE}/bonus-modules/bonus-material/target/bonus-material.jar $deploy_path +chmod 777 *.jar + +echo "--------moveFile end--------------" +export bonus_material_enable=true +export bonus_material_jar=bonus-material.jar +export bonus_material_port=18588 + +if($bonus_material_enable);then + echo "--------bonus_material 开始启动--------------" + echo "--------删除bonus__material开始--------------" + P_ID=`ps -ef | grep -w $bonus_material_jar | grep -v "grep" | awk '{print $2}'` + if [ "$P_ID" == "" ]; then + echo "===bonus_material process not exists or stop success" + else + kill -9 $P_ID + echo "bonus_material killed success" + fi + echo "--------bonus_material开始部署--------------" + nohup /usr/lib/jvm/jdk1.8.0_381/bin/java -jar $bonus_material_jar >/dev/null 2>&1 & + bonus_material_pid=`lsof -i:$bonus_material_port|grep "LISTEN"|awk '{print $2}'` + until [ -n "$bonus_material_pid" ] + do + bonus_material_pid=`lsof -i:$bonus_material_port|grep "LISTEN"|awk '{print $2}'` + done + echo "bonus_material pid is $bonus_material_pid" + echo "--------bonus_material 启动成功--------------" +fi \ No newline at end of file diff --git a/scripts/file_bootstrap.yml b/scripts_56/file_bootstrap.yml similarity index 100% rename from scripts/file_bootstrap.yml rename to scripts_56/file_bootstrap.yml diff --git a/scripts/gateway_bootstrap.yml b/scripts_56/gateway_bootstrap.yml similarity index 100% rename from scripts/gateway_bootstrap.yml rename to scripts_56/gateway_bootstrap.yml diff --git a/scripts/gen_bootstrap.yml b/scripts_56/gen_bootstrap.yml similarity index 100% rename from scripts/gen_bootstrap.yml rename to scripts_56/gen_bootstrap.yml diff --git a/scripts/job_bootstrap.yml b/scripts_56/job_bootstrap.yml similarity index 100% rename from scripts/job_bootstrap.yml rename to scripts_56/job_bootstrap.yml diff --git a/scripts_56/kill-ps.sh b/scripts_56/kill-ps.sh new file mode 100644 index 00000000..3f18bc7d --- /dev/null +++ b/scripts_56/kill-ps.sh @@ -0,0 +1,66 @@ +AUTH_RESOURCE_NAME=bonus-auth.jar + +tpid=`ps -ef|grep $AUTH_RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'` +if [ ${tpid} ]; then +echo 'Stop Process...' +kill -15 $tpid +fi +sleep 5 +tpid=`ps -ef|grep $AUTH_RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'` +if [ ${tpid} ]; then +echo 'Kill Process!' +kill -9 $tpid +else +echo 'Stop Success!' +fi + + +GATEWAY_RESOURCE_NAME=bonus-gateway.jar + +tpid=`ps -ef|grep $GATEWAY_RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'` +if [ ${tpid} ]; then +echo 'Stop Process...' +kill -15 $tpid +fi +sleep 5 +tpid=`ps -ef|grep $GATEWAY_RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'` +if [ ${tpid} ]; then +echo 'Kill Process!' +kill -9 $tpid +else +echo 'Stop Success!' +fi + + +MA_RESOURCE_NAME=bonus-material.jar + +tpid=`ps -ef|grep $MA_RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'` +if [ ${tpid} ]; then +echo 'Stop Process...' +kill -15 $tpid +fi +sleep 5 +tpid=`ps -ef|grep $MA_RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'` +if [ ${tpid} ]; then +echo 'Kill Process!' +kill -9 $tpid +else +echo 'Stop Success!' +fi + +SYS_RESOURCE_NAME=bonus-system.jar + +tpid=`ps -ef|grep $SYS_RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'` +if [ ${tpid} ]; then +echo 'Stop Process...' +kill -15 $tpid +fi +sleep 5 +tpid=`ps -ef|grep $SYS_RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'` +if [ ${tpid} ]; then +echo 'Kill Process!' +kill -9 $tpid +else +echo 'Stop Success!' +fi + diff --git a/scripts/material_bootstrap.yml b/scripts_56/material_bootstrap.yml similarity index 100% rename from scripts/material_bootstrap.yml rename to scripts_56/material_bootstrap.yml diff --git a/scripts/pipeline.sh b/scripts_56/pipeline.sh similarity index 100% rename from scripts/pipeline.sh rename to scripts_56/pipeline.sh diff --git a/scripts_56/stopServices.sh b/scripts_56/stopServices.sh new file mode 100644 index 00000000..c87ef248 --- /dev/null +++ b/scripts_56/stopServices.sh @@ -0,0 +1,7 @@ +P_ID=$(pgrep -f BonusMaterialApplication) +if [ -z "$P_ID" ]; then + echo "BonusMaterialApplication is not running" +else + kill -9 "$P_ID" +fi + diff --git a/scripts/system_bootstrap.yml b/scripts_56/system_bootstrap.yml similarity index 100% rename from scripts/system_bootstrap.yml rename to scripts_56/system_bootstrap.yml diff --git a/scripts/visual_bootstrap.yml b/scripts_56/visual_bootstrap.yml similarity index 100% rename from scripts/visual_bootstrap.yml rename to scripts_56/visual_bootstrap.yml