From 26c82b0da3dca12d8522e5e75cde2e4f33f7d726 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Mon, 30 Mar 2020 09:02:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20spring=20cloud=20x=20jenki?= =?UTF-8?q?ns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +- labx-16/labx-16-demo-01/pom.xml | 85 +++++++++++++++++++ .../lab16/jenkinsdemo/Application.java | 13 +++ .../controller/DemoController.java | 16 ++++ .../src/main/resources/application-dev.yaml | 17 ++++ .../src/main/resources/application-local.yaml | 21 +++++ .../src/main/resources/application-pre.yaml | 21 +++++ .../src/main/resources/application-prod.yaml | 21 +++++ .../src/main/resources/application-uat.yaml | 21 +++++ labx-16/pom.xml | 19 +++++ pom.xml | 1 + 11 files changed, 239 insertions(+), 2 deletions(-) create mode 100644 labx-16/labx-16-demo-01/pom.xml create mode 100644 labx-16/labx-16-demo-01/src/main/java/cn/iocoder/springcloud/lab16/jenkinsdemo/Application.java create mode 100644 labx-16/labx-16-demo-01/src/main/java/cn/iocoder/springcloud/lab16/jenkinsdemo/controller/DemoController.java create mode 100644 labx-16/labx-16-demo-01/src/main/resources/application-dev.yaml create mode 100644 labx-16/labx-16-demo-01/src/main/resources/application-local.yaml create mode 100644 labx-16/labx-16-demo-01/src/main/resources/application-pre.yaml create mode 100644 labx-16/labx-16-demo-01/src/main/resources/application-prod.yaml create mode 100644 labx-16/labx-16-demo-01/src/main/resources/application-uat.yaml create mode 100644 labx-16/pom.xml diff --git a/README.md b/README.md index 35e8d30e..46467aa2 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,6 @@ * [《芋道 Spring Cloud 声明式调用 Feign 入门》](http://www.iocoder.cn/Spring-Cloud/Feign/?github) 对应 [labx-03](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-03) * [《芋道 Spring Cloud 服务网关 Spring Cloud Gateway 入门》](http://www.iocoder.cn/Spring-Cloud/Spring-Cloud-Gateway/?github) 对应 [labx-08](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-08) * [《芋道 Spring Cloud 链路追踪 SkyWalking 入门》](http://www.iocoder.cn/Spring-Cloud/SkyWalking/?github) 对应 [labx-14](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-14) -* TODO 监控 # Spring Cloud 专栏 @@ -187,11 +186,14 @@ ## 监控管理 +* [《芋道 Spring Boot 异常管理平台 Sentry 入门》](http://www.iocoder.cn/Spring-Boot/Sentry/?github) 对应 [lab-51](https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-51) +* [《芋道 Spring Boot 监控端点 Actuator 入门》](http://www.iocoder.cn/Spring-Boot/Actuator/?github) 对应 [lab-34](https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-34) * [《芋道 Spring Cloud 监控工具 Admin 入门》](http://www.iocoder.cn/Spring-Cloud/SB-Admin/?github) 对应 [labx-15](https://github.com/YunaiV/SpringBoot-Labs/tree/master/labx-15) +* [《芋道 Spring Boot 监控平台 Prometheus + Grafana 入门》](http://www.iocoder.cn/Spring-Boot/Prometheus-and-Grafana/?github) 对应 [lab-36](https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-36) ## 持续交付 - +TODO Jenkins ## 链路追踪 diff --git a/labx-16/labx-16-demo-01/pom.xml b/labx-16/labx-16-demo-01/pom.xml new file mode 100644 index 00000000..26713881 --- /dev/null +++ b/labx-16/labx-16-demo-01/pom.xml @@ -0,0 +1,85 @@ + + + + labx-16 + cn.iocoder.springboot.labs + 1.0-SNAPSHOT + + 4.0.0 + + labx-16-demo-01 + jar + + + 1.8 + 1.8 + 2.2.4.RELEASE + Hoxton.SR1 + 2.2.0.RELEASE + + + + + + + org.springframework.boot + spring-boot-starter-parent + ${spring.boot.version} + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + ${spring.cloud.version} + pom + import + + + com.alibaba.cloud + spring-cloud-alibaba-dependencies + ${spring.cloud.alibaba.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + + ${project.artifactId} + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/labx-16/labx-16-demo-01/src/main/java/cn/iocoder/springcloud/lab16/jenkinsdemo/Application.java b/labx-16/labx-16-demo-01/src/main/java/cn/iocoder/springcloud/lab16/jenkinsdemo/Application.java new file mode 100644 index 00000000..cefd35ef --- /dev/null +++ b/labx-16/labx-16-demo-01/src/main/java/cn/iocoder/springcloud/lab16/jenkinsdemo/Application.java @@ -0,0 +1,13 @@ +package cn.iocoder.springcloud.lab16.jenkinsdemo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/labx-16/labx-16-demo-01/src/main/java/cn/iocoder/springcloud/lab16/jenkinsdemo/controller/DemoController.java b/labx-16/labx-16-demo-01/src/main/java/cn/iocoder/springcloud/lab16/jenkinsdemo/controller/DemoController.java new file mode 100644 index 00000000..455fd7ac --- /dev/null +++ b/labx-16/labx-16-demo-01/src/main/java/cn/iocoder/springcloud/lab16/jenkinsdemo/controller/DemoController.java @@ -0,0 +1,16 @@ +package cn.iocoder.springcloud.lab16.jenkinsdemo.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/demo") +public class DemoController { + + @GetMapping("/echo") + public String echo() { + return "echo"; + } + +} diff --git a/labx-16/labx-16-demo-01/src/main/resources/application-dev.yaml b/labx-16/labx-16-demo-01/src/main/resources/application-dev.yaml new file mode 100644 index 00000000..f3aeee67 --- /dev/null +++ b/labx-16/labx-16-demo-01/src/main/resources/application-dev.yaml @@ -0,0 +1,17 @@ +server: + port: 8079 + +management: + server: + port: 8078 # 自定义端口,避免 Nginx 暴露出去 + + endpoint: + web: + exposure: + include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 + + cloud: + nacos: + # Nacos 作为注册中心的配置项,对应 NacosDiscoveryProperties 配置类 + discovery: + server-addr: 127.0.0.1:8848 # Nacos 服务器地址 diff --git a/labx-16/labx-16-demo-01/src/main/resources/application-local.yaml b/labx-16/labx-16-demo-01/src/main/resources/application-local.yaml new file mode 100644 index 00000000..5e7e7dd7 --- /dev/null +++ b/labx-16/labx-16-demo-01/src/main/resources/application-local.yaml @@ -0,0 +1,21 @@ +server: + port: 8079 + +management: + server: + port: 8078 # 自定义端口,避免 Nginx 暴露出去 + + endpoint: + web: + exposure: + include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 + +spring: + application: + name: demo-service + + cloud: + nacos: + # Nacos 作为注册中心的配置项,对应 NacosDiscoveryProperties 配置类 + discovery: + server-addr: 127.0.0.1:8848 # Nacos 服务器地址 diff --git a/labx-16/labx-16-demo-01/src/main/resources/application-pre.yaml b/labx-16/labx-16-demo-01/src/main/resources/application-pre.yaml new file mode 100644 index 00000000..5e7e7dd7 --- /dev/null +++ b/labx-16/labx-16-demo-01/src/main/resources/application-pre.yaml @@ -0,0 +1,21 @@ +server: + port: 8079 + +management: + server: + port: 8078 # 自定义端口,避免 Nginx 暴露出去 + + endpoint: + web: + exposure: + include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 + +spring: + application: + name: demo-service + + cloud: + nacos: + # Nacos 作为注册中心的配置项,对应 NacosDiscoveryProperties 配置类 + discovery: + server-addr: 127.0.0.1:8848 # Nacos 服务器地址 diff --git a/labx-16/labx-16-demo-01/src/main/resources/application-prod.yaml b/labx-16/labx-16-demo-01/src/main/resources/application-prod.yaml new file mode 100644 index 00000000..5e7e7dd7 --- /dev/null +++ b/labx-16/labx-16-demo-01/src/main/resources/application-prod.yaml @@ -0,0 +1,21 @@ +server: + port: 8079 + +management: + server: + port: 8078 # 自定义端口,避免 Nginx 暴露出去 + + endpoint: + web: + exposure: + include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 + +spring: + application: + name: demo-service + + cloud: + nacos: + # Nacos 作为注册中心的配置项,对应 NacosDiscoveryProperties 配置类 + discovery: + server-addr: 127.0.0.1:8848 # Nacos 服务器地址 diff --git a/labx-16/labx-16-demo-01/src/main/resources/application-uat.yaml b/labx-16/labx-16-demo-01/src/main/resources/application-uat.yaml new file mode 100644 index 00000000..5e7e7dd7 --- /dev/null +++ b/labx-16/labx-16-demo-01/src/main/resources/application-uat.yaml @@ -0,0 +1,21 @@ +server: + port: 8079 + +management: + server: + port: 8078 # 自定义端口,避免 Nginx 暴露出去 + + endpoint: + web: + exposure: + include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 + +spring: + application: + name: demo-service + + cloud: + nacos: + # Nacos 作为注册中心的配置项,对应 NacosDiscoveryProperties 配置类 + discovery: + server-addr: 127.0.0.1:8848 # Nacos 服务器地址 diff --git a/labx-16/pom.xml b/labx-16/pom.xml new file mode 100644 index 00000000..0a88a0ef --- /dev/null +++ b/labx-16/pom.xml @@ -0,0 +1,19 @@ + + + + labs-parent + cn.iocoder.springboot.labs + 1.0-SNAPSHOT + + 4.0.0 + + labx-16 + pom + + labx-16-demo-01 + + + + diff --git a/pom.xml b/pom.xml index 82d5e884..23cdbc65 100644 --- a/pom.xml +++ b/pom.xml @@ -78,6 +78,7 @@ lab-50 lab-51 labx-15 + labx-16