瀏覽代碼

配置修改

zhengqiang 3 年之前
父節點
當前提交
78382f0f46
共有 4 個文件被更改,包括 77 次插入12 次删除
  1. 69 0
      build.groovy
  2. 2 6
      pom.xml
  3. 4 4
      web/src/main/resources/application-test.yml
  4. 2 2
      web/src/main/resources/application.yml

+ 69 - 0
build.groovy

@@ -0,0 +1,69 @@
+pipeline {
+    agent any
+
+    environment {
+        def appName = "jp-employment"
+        def branch = "master"
+    }
+
+    tools {
+        // Install the Maven version configured as "M3" and add it to the path.
+        maven "M3"
+        jdk "jdk8"
+    }
+
+    stages {
+        stage('checkout') {
+            steps {
+                dir("${env.WORKSPACE}/code"){
+                    git branch: branch,credentialsId: 'cd13504d-d7eb-433f-be4b-4cbeedf0372d', url: 'http://47.92.161.104:10080/shuzhan/jp-employment-server.git'
+                }
+            }
+        }
+
+        stage('package') {
+            steps {
+                dir("${env.WORKSPACE}/code"){
+                    sh 'mvn clean package -Dmaven.test.skip=true -P test -s /usr/maven/apache-maven-3.3.9/conf/settings.xml'
+                }
+            }
+        }
+
+        stage('deploy') {
+            steps {
+                script {
+                    dir("${env.WORKSPACE}/code/web/target") {
+                        def host = '121.37.187.149'
+
+                        withCredentials([usernamePassword(credentialsId: '${host}',
+                                passwordVariable: 'pwd', usernameVariable: 'userName')]) {
+                            def sshServer = [:]
+
+                            sshServer.name = 'huawei server'
+                            sshServer.host ='${host}'
+
+                            sshServer.user = userName
+                            sshServer.password = pwd
+
+                            sshServer.allowAnyHosts= true
+
+                            sshCommand remote: sshServer, command: "docker stop ${appName}-server"
+
+                            if(fullUpdate){
+                                def targetFolder = '/opt/mydocker/tomcat8/jp-employment/webapps/'
+                                sshPut remote: sshServer, from: 'web-1.0.0.war', into: targetFolder
+                                sshCommand remote: sshServer, command: 'rm -rf ${targetFolder}/'
+                                sshCommand remote: sshServer, command: 'unzip ${targetFolder}/web-1.0.0.war -D jp-employment-server'
+                            }
+
+                            def appName = 'demo1'
+                            sshCommand remote: sshServer, command: "docker stop $appName"
+                            sshCommand remote: sshServer, command: "docker rm $appName"
+                            sshCommand remote: sshServer, command: "docker run --name $appName -p 9091:80 -d $imageName"
+                        }
+                    }
+                }
+            }
+        }
+    }
+}

+ 2 - 6
pom.xml

@@ -16,14 +16,12 @@
 	<groupId>com.jpsoft.employment</groupId>
 	<artifactId>parent</artifactId>
 	<version>1.0.0</version>
-	<name>enterprise-federation</name>
-	<description>企业联合会</description>
-
+	<name>jp-employment</name>
+	<description>荆开就业在线</description>
 	<properties>
 		<java.version>1.8</java.version>
 		<lombok.version>1.16.12</lombok.version>
 	</properties>
-
 	<dependencies>
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
@@ -64,7 +62,6 @@
 			<version>5.0.6</version>
 		</dependency>
 	</dependencies>
-
     <build>
         <plugins>
             <plugin>
@@ -87,5 +84,4 @@
             </plugin>
         </plugins>
     </build>
-
 </project>

+ 4 - 4
web/src/main/resources/application-test.yml

@@ -5,7 +5,7 @@ server:
 
 spring:
   datasource:
-    url: jdbc:log4jdbc:mysql://mysql57/jp_housekeeper_2.0?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+    url: jdbc:log4jdbc:mysql://mysql57/jp-employment?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
     username: root
     password: jpsoft8121234
   devtools:
@@ -15,7 +15,7 @@ spring:
     enabled: true
   redis:
     # Redis数据库索引(默认为0)
-    database: 3
+    database: 4
     # Redis服务器地址
     host: myredis
     # Redis服务器连接端口
@@ -27,7 +27,7 @@ spring:
     username: admin
     password: jpsoft
     #虚拟host 可以不设置,使用server默认host
-    virtual-host: housekeeper-test
+    virtual-host: jp-employment-test
 
 logger:
   level: WARN
@@ -38,7 +38,7 @@ springfox:
   documentation:
     swagger:
       v2:
-        host: ykt-test.xiaoxinda.com
+#        host: ykt-test.xiaoxinda.com
 
 wx:
   pay:

+ 2 - 2
web/src/main/resources/application.yml

@@ -61,7 +61,7 @@ spring:
     active: @active.profile@
   redis:
     # Redis数据库索引(默认为0)
-    database: 1
+    database: 4
     # Redis服务器地址
     host: 127.0.0.1
     #host: 127.0.0.1
@@ -103,7 +103,7 @@ jwt:
   header: Authorization
 
 mybatis:
-  typeAliasesPackage: com.jpsoft.housekeeper.**.entity
+  typeAliasesPackage: com.jpsoft.employment.**.entity
   mapperLocations: classpath*:mapper/**/*.xml
   configuration:
     default-statement-timeout: 60