chenkq před 3 dny
rodič
revize
3522d512aa

+ 5 - 7
Jenkinsfile

@@ -125,11 +125,8 @@ pipeline {
                             }
                         }
 
-                        echo "处理MODULE_NAMESPACE_RESTFUL"
-//                         //把 module 名 从 sp-xxx 变成 xxx 也就是 项目 的 namespace
-                        //if (API_NAMESPACE_RESTFUL == "storlead-mail-api") {
-                            API_NAMESPACE_RESTFUL = "api"
-                        //}
+                        // Spring context-path,须与 application-*.yml 中 server.servlet.context-path 一致
+                        API_CONTEXT_PATH = "router/email"
                         echo "处理镜像推送"
                     }
                 }
@@ -232,11 +229,12 @@ pipeline {
                         sh """
                           echo '
                           FROM ${BASE_IMAGE}
+                          RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
 
                           COPY ${params.module}/target/${params.module}.jar app.jar
                           EXPOSE ${API_PORT}
                           EXPOSE ${API_REMOTE_DEBUG_PORT}
-                          HEALTHCHECK --interval=1m --timeout=10s CMD curl -f http://localhost:${API_PORT}/${API_NAMESPACE_RESTFUL}/actuator
+                          HEALTHCHECK --interval=1m --timeout=10s CMD curl -fsS http://localhost:${API_PORT}/${API_CONTEXT_PATH}/actuator/health || exit 1
                           ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom", "-Djava.awt.headless=true","-Dspring.profiles.active=${params.profile}", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:${API_REMOTE_DEBUG_PORT}","-jar","/app.jar"]' > Dockerfile
                           docker build -t ${DOCKER_IMG_NAME} .
                          """
@@ -308,7 +306,7 @@ services:
         condition: on-failure
         max_attempts: 3
     healthcheck:
-      test: ["CMD-SHELL", "wget -q -O /dev/null http://localhost:${API_PORT}/${API_NAMESPACE_RESTFUL}/actuator || exit 1"]
+      test: ["CMD-SHELL", "curl -fsS http://localhost:${API_PORT}/${API_CONTEXT_PATH}/actuator/health || exit 1"]
       interval: 1m
       timeout: 5s
       retries: 3

+ 9 - 2
storlead-mail-api/src/main/resources/application-test.yml

@@ -1,5 +1,5 @@
 server:
-  port: 10080
+  port: 18060
   tomcat:
     max-swallow-size: -1
     basedir: /app/temp
@@ -14,7 +14,10 @@ management:
   endpoints:
     web:
       exposure:
-        include: metrics,httptrace
+        include: health,metrics,httptrace
+  endpoint:
+    health:
+      show-details: never
 
 spring:
   servlet:
@@ -147,6 +150,10 @@ environment: test
 # 站内消息、邮件模板中的前端站点根地址(覆盖 application.yml 默认值)
 domainname: https://test1.storlead.com
 
+storlead:
+  mail:
+    track-base-url: https://test1.storlead.com/router/email
+
 file:
   mode: 1
   filePath: /files