Compare commits
4 Commits
v3.0.7-nat
...
version3-n
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06cfebccab | ||
|
|
54202d8fd7 | ||
|
|
21b8d2e6e6 | ||
| b7b3d44992 |
10
README.md
10
README.md
@@ -25,13 +25,3 @@
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
|
||||
|
||||
#### 特技
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
|
||||
@@ -2,17 +2,17 @@ apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: $APP_NAME
|
||||
app: $APP_NAME # 标签 用于选择器
|
||||
version: $APP_TAG
|
||||
name: $APP_NAME
|
||||
namespace: default #一定要写名称空间
|
||||
name: $APP_NAME # Deployment名称
|
||||
namespace: default # 一定要写名称空间
|
||||
spec:
|
||||
progressDeadlineSeconds: 600
|
||||
replicas: 1
|
||||
replicas: 1 # 副本数 1个 pod
|
||||
revisionHistoryLimit: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: $APP_NAME
|
||||
app: $APP_NAME # 选择器 匹配 pod 标签
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 50%
|
||||
@@ -21,31 +21,62 @@ spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: $APP_NAME
|
||||
app: $APP_NAME # pod 标签
|
||||
version: $APP_TAG
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: dockerhub-id #提前在项目下配置访问阿里云的账号密码
|
||||
- name: dockerhub-id #提前在项目下配置访问私有镜像仓库的账号密码
|
||||
containers:
|
||||
- image: $REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$APP_TAG
|
||||
name: $APP_NAME
|
||||
- name: $APP_NAME # 容器名称
|
||||
image: $REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$APP_TAG # 镜像地址
|
||||
imagePullPolicy: Always
|
||||
# 存活探针配置
|
||||
livenessProbe: # 存活探针:失败意味着应用彻底挂了,需要重启来恢复
|
||||
httpGet:
|
||||
path: /test
|
||||
port: 13145
|
||||
initialDelaySeconds: 10 # 延迟xx秒开始执行
|
||||
periodSeconds: 15 # 每隔15秒执行一次
|
||||
timeoutSeconds: 10 # 10秒未返回结果则超时
|
||||
failureThreshold: 10 # 探测失败后的重试次数,当达到这个次数后就判定结果为失败
|
||||
# successThreshold: 5
|
||||
path: /actuator/health/liveness # 探针路径
|
||||
port: 13145 # 探针端口
|
||||
scheme: HTTP # 协议
|
||||
initialDelaySeconds: 20 # 容器启动后延迟 xx秒开始检查
|
||||
periodSeconds: 10 # 每隔 15秒检查一次
|
||||
timeoutSeconds: 5 # 10秒未返回结果则超时
|
||||
# successThreshold: 1 # 成功 1 次就认定为健康
|
||||
failureThreshold: 3 # 探测失败后的重试次数,当达到这个次数后就判定结果为失败,重启容器
|
||||
#就绪探针配置
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health/readiness # 探针路径
|
||||
port: 13145 # 探针端口
|
||||
scheme: HTTP # 协议
|
||||
initialDelaySeconds: 10 # 容器启动后等 30 秒再开始检查
|
||||
periodSeconds: 5 # 每 5 秒检查一次,比存活探针频繁
|
||||
timeoutSeconds: 5 # 超时时间 3 秒
|
||||
# successThreshold: 1 # 成功 1 次就认为就绪
|
||||
failureThreshold: 2 # 失败 3 次才认为未就绪,会从负载均衡摘掉
|
||||
# 启动探针配置(可选,启动慢的应用必须配)
|
||||
# startupProbe:
|
||||
# httpGet:
|
||||
# path: /actuator/health/liveness # 用存活探针的路径
|
||||
# port: 13145
|
||||
# scheme: HTTP
|
||||
# initialDelaySeconds: 0 # 立即开始检查
|
||||
# periodSeconds: 5 # 每 5 秒检查一次
|
||||
# timeoutSeconds: 3 # 超时时间 3 秒
|
||||
# successThreshold: 1 # 成功 1 次就认为启动完成
|
||||
# failureThreshold: 30 # 失败 30 次(150 秒)才认为启动失败
|
||||
# 生命周期钩子,优雅关闭
|
||||
lifecycle:
|
||||
preStop:
|
||||
sleep:
|
||||
seconds: 10 #容器停止前先等 10 秒,让流量切走
|
||||
ports:
|
||||
- containerPort: 13145
|
||||
- containerPort: 13145 # 应用端口
|
||||
protocol: TCP
|
||||
# 资源限制
|
||||
resources:
|
||||
limits:
|
||||
cpu: 99m
|
||||
memory: 65Mi
|
||||
cpu: 99m # 最多 0.1核 CPU
|
||||
memory: 65Mi # 最多 65m 内存
|
||||
# 环境变量配置
|
||||
env:
|
||||
- name: TZ
|
||||
value: "Asia/Shanghai"
|
||||
|
||||
30
pom.xml
30
pom.xml
@@ -32,7 +32,7 @@
|
||||
<java.version>25</java.version>
|
||||
<maven.compiler.source>25</maven.compiler.source>
|
||||
<maven.compiler.target>25</maven.compiler.target>
|
||||
<!-- <fastjson.version>2.0.60</fastjson.version>-->
|
||||
<!-- <fastjson.version>2.0.60</fastjson.version>-->
|
||||
<openfeign.version>5.0.0</openfeign.version>
|
||||
<hutool.version>5.8.25</hutool.version>
|
||||
<docker.private.repository>registry.cn-chengdu.aliyuncs.com/bamanker</docker.private.repository>
|
||||
@@ -65,11 +65,11 @@
|
||||
<groupId>tools.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba.fastjson2</groupId>-->
|
||||
<!-- <artifactId>fastjson2</artifactId>-->
|
||||
<!-- <version>${fastjson.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba.fastjson2</groupId>-->
|
||||
<!-- <artifactId>fastjson2</artifactId>-->
|
||||
<!-- <version>${fastjson.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
@@ -87,6 +87,11 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
</dependency>
|
||||
<!-- Spring Boot Actuator,提供健康检查端点 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>dailylove</finalName>
|
||||
@@ -109,12 +114,15 @@
|
||||
<buildArgs>
|
||||
<!--开启dashboard-->
|
||||
<!-- <arg>-H:DashboardDump=dailylove -H:+DashboardAll</arg>-->
|
||||
<arg->-H:+ReportExceptionStackTraces</arg->
|
||||
<!--开启JFR-->
|
||||
<arg>--enable-monitoring=jfr</arg>
|
||||
<!-- <arg>--gc=G1</arg>-->
|
||||
<buildArg>-H:+ReportExceptionStackTraces</buildArg>
|
||||
<!--生成诊断报告-->
|
||||
<buildArg>-H:+PrintAnalysisCallTree</buildArg>
|
||||
<!--开启监控代理-->
|
||||
<buildArg>--enable-monitoring=jfr,heapdump,jvmstat</buildArg>
|
||||
<!-- <arg>--pgo</arg>-->
|
||||
<arg>-Ob</arg>
|
||||
<!---Ob: 快速构建模式,编译快但性能差点,适合开发调试-->
|
||||
<buildArg>-Ob</buildArg>
|
||||
<!-- <buildArg>--gc=G1</buildArg>-->
|
||||
<!-- <arg>-march=native</arg>-->
|
||||
<!-- <arg>-H:+BuildReport</arg>-->
|
||||
</buildArgs>
|
||||
|
||||
@@ -57,3 +57,24 @@ logging:
|
||||
com.bamanker.dailylove.service: debug #指定openfeign日志以什么级别监控哪个接口(可多个)
|
||||
|
||||
scanclass: false
|
||||
|
||||
# Actuator 配置
|
||||
management:
|
||||
# 端点配置
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
# 暴露健康端点,生产环境要慎重,别把敏感信息暴露了
|
||||
include: health,info
|
||||
# 健康端点配置
|
||||
endpoint:
|
||||
health:
|
||||
# 显示详细的健康信息,方便调试
|
||||
# 生产环境建议设为 when-authorized,需要认证才能看详情
|
||||
show-details: always
|
||||
# 开启探针支持,这个必须设置
|
||||
probes:
|
||||
enabled: true
|
||||
# 在主端口上也暴露探针路径
|
||||
# 这样 K8s 探针可以直接访问应用端口,不用单独配置 management 端口
|
||||
add-additional-paths: true
|
||||
Reference in New Issue
Block a user