Skip to content

Commit 8f1e59d

Browse files
authored
Dev (#5909)
* feat: 增加zlm流媒体 docker compose部署 * feat: 增加zlm流媒体 docker compose部署 * feat: 增加restclient的apache httpclient配置连接池 * feat: 增加restclient的apache httpclient配置连接池 * style: 修改docker compose格式 * feat: 优化代码风格 * style: 优化授权码代码 * style: 优化授权码代码 * style: 优化授权码代码 * docs: 修改readme feat: 升级es版本
2 parents 559cc4a + b75dc03 commit 8f1e59d

File tree

31 files changed

+395
-68
lines changed

31 files changed

+395
-68
lines changed

.agent/RULES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ KCloud-Platform-IoT(老寇IoT云平台)是一个企业级微服务架构的
55

66
## 技术栈
77
- **JDK**: 25 (支持虚拟线程和GraalVM)
8-
- **Spring Boot**: 4.0.3
8+
- **Spring Boot**: 4.0.4
99
- **Spring Cloud**: 2025.1.0
1010
- **Spring Cloud Alibaba**: 2025.1.0.0
1111
- **Spring Framework**: 7.0.6
@@ -16,7 +16,7 @@ KCloud-Platform-IoT(老寇IoT云平台)是一个企业级微服务架构的
1616
- **Vert.x**: 5.0.7
1717
- **Nacos**: 3.1.1
1818
- **Redis/Redisson**: 4.1.0
19-
- **Elasticsearch**: 9.3.1
19+
- **Elasticsearch**: 9.3.2
2020
- **Netty**: 4.2.9.Final
2121
- **Kafka**: 4.0.1
2222
- **gRPC**: 1.78.0

KAudio-Video/docker-compose.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# /*
2+
# * Copyright (c) 2022-2026 KCloud-Platform-IoT Author or Authors. All Rights Reserved.
3+
# * <p>
4+
# * Licensed under the Apache License, Version 2.0 (the "License");
5+
# * you may not use this file except in compliance with the License.
6+
# * You may obtain a copy of the License at
7+
# * <p>
8+
# * http://www.apache.org/licenses/LICENSE-2.0
9+
# * <p>
10+
# * Unless required by applicable law or agreed to in writing, software
11+
# * distributed under the License is distributed on an "AS IS" BASIS,
12+
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# * See the License for the specific language governing permissions and
14+
# * limitations under the License.
15+
# */
16+
services:
17+
zlmediakit:
18+
image: zlmediakit/zlmediakit:master
19+
container_name: zlmediakit
20+
# 保持容器在没有守护程序的情况下运行
21+
tty: true
22+
restart: always
23+
privileged: true
24+
ports:
25+
- "11935:1935" # RTMP端口
26+
- "18080:80" # HTTP端口
27+
- "18443:443" # HTTPS端口
28+
- "18554:554" # RTSP端口
29+
- "10000:10000" # RTP端口
30+
- "10000:10000/udp" # RTP UDP端口
31+
- "18000:8000/udp" # RTSP UDP端口
32+
- "19000:9000/udp" # SRT端口
33+
environment:
34+
- TZ=Asia/Shanghai
35+
volumes:
36+
- .zlmediakit/media/config:/opt/media/conf # 配置文件目录
37+
- .zlmediakit/media/logs:/opt/media/log # 日志目录
38+
- .zlmediakit/media/www:/opt/media/www # 媒体文件目录
39+
networks:
40+
- iot_network
41+
networks:
42+
iot_network:
43+
driver: bridge

README.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
image::doc/image/logo/logo.png[LOGO,500,align=center]
1717

18-
KCloud-Platform-IoT(老寇IoT云平台)是一个企业级单体架构和微服务架构的IoT云平台。基于Spring Boot 4.0.3、Spring Cloud 2025.1.0、Spring Cloud Alibaba 2025.1.0.0 最新版本开发的云服务多租户IoT平台。 遵循SpringBoot编程思想,使用阿里COLA应用框架构建,高度模块化和可配置化。具备服务注册&发现、配置中心、灰度路由、服务限流、熔断降级、监控报警、多数据源、高亮搜索、分布式任务调度、分布式链路、分布式缓存、分布式事务、分布式存储、分布式锁等功能,用于快速构建IoT微服务项目。目前支持Shell、Docker、Kubernetes等多种部署方式,并且支持GraalVM和虚拟线程。实现RBAC权限、其中包含首页、系统管理、物联管理、系统监控、数据分析等几大模块。 遵循阿里代码规范,采用RESTFul设计风格及DDD(领域驱动设计)思想,代码简洁、架构清晰,非常适合作为基础框架使用。
18+
KCloud-Platform-IoT(老寇IoT云平台)是一个企业级单体架构和微服务架构的IoT云平台。基于Spring Boot 4.0.4、Spring Cloud 2025.1.0、Spring Cloud Alibaba 2025.1.0.0 最新版本开发的云服务多租户IoT平台。 遵循SpringBoot编程思想,使用阿里COLA应用框架构建,高度模块化和可配置化。具备服务注册&发现、配置中心、灰度路由、服务限流、熔断降级、监控报警、多数据源、高亮搜索、分布式任务调度、分布式链路、分布式缓存、分布式事务、分布式存储、分布式锁等功能,用于快速构建IoT微服务项目。目前支持Shell、Docker、Kubernetes等多种部署方式,并且支持GraalVM和虚拟线程。实现RBAC权限、其中包含首页、系统管理、物联管理、系统监控、数据分析等几大模块。 遵循阿里代码规范,采用RESTFul设计风格及DDD(领域驱动设计)思想,代码简洁、架构清晰,非常适合作为基础框架使用。
1919

2020
image:https://github.com/KouShenhai/KCloud-Platform-IoT/actions/workflows/maven.yml/badge.svg?branch=master[Maven Mvnd Ci Build Stauts,link=https://github.com/KouShenhai/KCloud-Platform-IoT/actions/workflows/maven.yml]
2121
image:https://github.com/KouShenhai/KCloud-Platform-IoT/actions/workflows/node.js.yml/badge.svg?branch=master[Node.js CI Build Stauts,link=https://github.com/KouShenhai/KCloud-Platform-IoT/actions/workflows/node.js.yml]
@@ -38,7 +38,7 @@ image:https://atomgit.com/KouShenhai_/KCloud-Platform-IoT/star/2025top.svg?theme
3838

3939
image:https://img.shields.io/static/v1?label=Spring%20Framework&message=7.0.6&color=green[Spring Framework,link=https://spring.io/projects/spring-framework]
4040
image:https://img.shields.io/static/v1?label=Spring%20Security&message=7.0.4&color=green[Spring Security,link=https://spring.io/projects/spring-security]
41-
image:https://img.shields.io/static/v1?label=Spring%20Boot&message=4.0.3&color=green[Spring Boot,link=https://spring.io/projects/spring-boot]
41+
image:https://img.shields.io/static/v1?label=Spring%20Boot&message=4.0.4&color=green[Spring Boot,link=https://spring.io/projects/spring-boot]
4242
image:https://img.shields.io/static/v1?label=Spring%20Cloud&message=2025.1.0&color=green[Spring Cloud,link=https://spring.io/projects/spring-cloud]
4343
image:https://img.shields.io/static/v1?label=Spring%20Cloud%20Alibaba&message=2025.1.0.0&color=orange[Spring Cloud Alibaba,link=https://github.com/alibaba/spring-cloud-alibaba]
4444

@@ -148,7 +148,7 @@ image::doc/image/老寇IoT云平台业务架构图.png[架构图,align=center]
148148
|===
149149
|组件 |版本
150150

151-
|Spring Boot |4.0.3
151+
|Spring Boot |4.0.4
152152
|Spring Framework |7.0.6
153153
|Spring Security |7.0.4
154154
|Spring gRPC |1.0.2
@@ -161,7 +161,7 @@ image::doc/image/老寇IoT云平台业务架构图.png[架构图,align=center]
161161
|Nacos |3.1.0
162162
|gRPC |1.77.0
163163
|Redis |8.0.1
164-
|Elasticsearch |9.3.1
164+
|Elasticsearch |9.3.2
165165
|Netty |4.2.9.Final
166166
|Kafka |4.0.4
167167
|Pulsar |4.1.2

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<div style="text-align: center"><img src="doc/image/logo/logo.png" alt="LOGO" width="500"></div>
1717

18-
KCloud-Platform-IoT(老寇IoT云平台)是一个企业级单体架构和微服务架构的IoT云平台。基于Spring Boot 4.0.3、Spring Cloud 2025.1.0、Spring Cloud Alibaba 2025.1.0.0 最新版本开发的云服务多租户IoT平台。 遵循SpringBoot编程思想,使用阿里COLA应用框架构建,高度模块化和可配置化。具备服务注册&发现、配置中心、灰度路由、服务限流、熔断降级、监控报警、多数据源、高亮搜索、分布式任务调度、分布式链路、分布式缓存、分布式事务、分布式存储、分布式锁等功能,用于快速构建IoT微服务项目。目前支持Shell、Docker、Kubernetes等多种部署方式,并且支持GraalVM和虚拟线程。实现RBAC权限、其中包含首页、系统管理、物联管理、系统监控、数据分析等几大模块。 遵循阿里代码规范,采用RESTFul设计风格及DDD(领域驱动设计)思想,代码简洁、架构清晰,非常适合作为基础框架使用。
18+
KCloud-Platform-IoT(老寇IoT云平台)是一个企业级单体架构和微服务架构的IoT云平台。基于Spring Boot 4.0.4、Spring Cloud 2025.1.0、Spring Cloud Alibaba 2025.1.0.0 最新版本开发的云服务多租户IoT平台。 遵循SpringBoot编程思想,使用阿里COLA应用框架构建,高度模块化和可配置化。具备服务注册&发现、配置中心、灰度路由、服务限流、熔断降级、监控报警、多数据源、高亮搜索、分布式任务调度、分布式链路、分布式缓存、分布式事务、分布式存储、分布式锁等功能,用于快速构建IoT微服务项目。目前支持Shell、Docker、Kubernetes等多种部署方式,并且支持GraalVM和虚拟线程。实现RBAC权限、其中包含首页、系统管理、物联管理、系统监控、数据分析等几大模块。 遵循阿里代码规范,采用RESTFul设计风格及DDD(领域驱动设计)思想,代码简洁、架构清晰,非常适合作为基础框架使用。
1919

2020
<a href="https://github.com/KouShenhai/KCloud-Platform-IoT/actions/workflows/maven.yml" target="_blank"><img src="https://github.com/KouShenhai/KCloud-Platform-IoT/actions/workflows/maven.yml/badge.svg?branch=master" alt="Maven Mvnd Ci Build Stauts"/></a>
2121
<a href="https://github.com/KouShenhai/KCloud-Platform-IoT/actions/workflows/node.js.yml" target="_blank"><img src="https://github.com/KouShenhai/KCloud-Platform-IoT/actions/workflows/node.js.yml/badge.svg?branch=master" alt="Node.js CI Build Stauts"/></a>
@@ -38,7 +38,7 @@ KCloud-Platform-IoT(老寇IoT云平台)是一个企业级单体架构和微
3838

3939
<a href="https://spring.io/projects/spring-framework" target="_blank"><img src="https://img.shields.io/static/v1?label=Spring%20Framework&message=7.0.6&color=green" alt="Spring Framework"/></a>
4040
<a href="https://spring.io/projects/spring-authorization-server" target="_blank"><img src="https://img.shields.io/static/v1?label=Spring%20Security&message=7.0.4&color=green" alt="Spring Security"/></a>
41-
<a href="https://spring.io/projects/spring-boot" target="_blank"><img src="https://img.shields.io/static/v1?label=Spring%20Boot&message=4.0.3&color=green" alt="Spring Boot"/></a>
41+
<a href="https://spring.io/projects/spring-boot" target="_blank"><img src="https://img.shields.io/static/v1?label=Spring%20Boot&message=4.0.4&color=green" alt="Spring Boot"/></a>
4242
<a href="https://spring.io/projects/spring-cloud" target="_blank"><img src="https://img.shields.io/static/v1?label=Spring%20Cloud&message=2025.1.0&color=green" alt="Spring Cloud"/></a>
4343
<a href="https://github.com/alibaba/spring-cloud-alibaba" target="_blank"><img src="https://img.shields.io/static/v1?label=Spring%20Cloud%20Alibaba&message=2025.1.0.0&color=orange" alt="Spring Cloud Alibaba"/></a>
4444

@@ -137,7 +137,7 @@ KCloud-Platform-IoT(老寇IoT云平台)是一个企业级单体架构和微
137137

138138
| 组件 | 版本 |
139139
|:--------------------:|:-----------:|
140-
| Spring Boot | 4.0.3 |
140+
| Spring Boot | 4.0.4 |
141141
| Spring Framework | 7.0.6 |
142142
| Spring Security | 7.0.4 |
143143
| Spring gRPC | 1.0.2 |
@@ -150,7 +150,7 @@ KCloud-Platform-IoT(老寇IoT云平台)是一个企业级单体架构和微
150150
| Nacos | 3.1.0 |
151151
| gRPC | 1.77.0 |
152152
| Redis | 8.0.1 |
153-
| Elasticsearch | 9.3.1 |
153+
| Elasticsearch | 9.3.2 |
154154
| Netty | 4.2.9.Final |
155155
| Kafka | 4.0.4 |
156156
| Pulsar | 4.1.2 |

doc/deploy/docker-compose/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ services:
305305
networks:
306306
- iot_network
307307
elasticsearch:
308-
image: registry.cn-shenzhen.aliyuncs.com/koushenhai/elasticsearch9:9.3.1
308+
image: registry.cn-shenzhen.aliyuncs.com/koushenhai/elasticsearch9:9.3.2
309309
container_name: elasticsearch
310310
# 保持容器在没有守护程序的情况下运行
311311
tty: true
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM docker.elastic.co/elasticsearch/elasticsearch:9.3.2
22
LABEL maintainer="laokou"
33
LABEL description="elasticsearch9"
4-
RUN elasticsearch-plugin install --batch https://release.infinilabs.com/analysis-ik/stable/elasticsearch-analysis-ik-9.3.1.zip && \
5-
elasticsearch-plugin install --batch https://release.infinilabs.com/analysis-pinyin/stable/elasticsearch-analysis-pinyin-9.3.1.zip
4+
RUN elasticsearch-plugin install --batch https://release.infinilabs.com/analysis-ik/stable/elasticsearch-analysis-ik-9.3.2.zip && \
5+
elasticsearch-plugin install --batch https://release.infinilabs.com/analysis-pinyin/stable/elasticsearch-analysis-pinyin-9.3.2.zip

doc/deploy/docker-compose/elasticsearch9/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
```shell
2-
sudo docker run -d --restart=always --name elasticsearch -p 9200:9200 -p 9300:9300 --privileged -e "discovery.type=single-node" -e "ES_JAVA_OPTS=-Xms1g -Xmx1g" -e "ELASTIC_PASSWORD=laokou123" docker.elastic.co/elasticsearch/elasticsearch:9.3.1
2+
sudo docker run -d --restart=always --name elasticsearch -p 9200:9200 -p 9300:9300 --privileged -e "discovery.type=single-node" -e "ES_JAVA_OPTS=-Xms1g -Xmx1g" -e "ELASTIC_PASSWORD=laokou123" docker.elastic.co/elasticsearch/elasticsearch:9.3.2
33

44
sudo docker cp elasticsearch:/usr/share/elasticsearch/data elasticsearch/
55
sudo docker cp elasticsearch:/usr/share/elasticsearch/plugins elasticsearch/
@@ -9,15 +9,15 @@ sudo docker cp elasticsearch:/usr/share/elasticsearch/logs elasticsearch/
99

1010
```shell
1111
sudo docker login registry.cn-shenzhen.aliyuncs.com
12-
sudo docker build -t elasticsearch9:9.3.1 .
13-
sudo docker tag xxx registry.cn-shenzhen.aliyuncs.com/koushenhai/elasticsearch9:9.3.1
14-
sudo docker push registry.cn-shenzhen.aliyuncs.com/koushenhai/elasticsearch9:9.3.1
12+
sudo docker build -t elasticsearch9:9.3.2 .
13+
sudo docker tag xxx registry.cn-shenzhen.aliyuncs.com/koushenhai/elasticsearch9:9.3.2
14+
sudo docker push registry.cn-shenzhen.aliyuncs.com/koushenhai/elasticsearch9:9.3.2
1515
```
1616

1717
```shell
1818
sudo docker login
19-
sudo docker build -t elasticsearch931:9.3.1 .
20-
sudo docker tag elasticsearch931:9.3.1 koushenhai/elasticsearch9
19+
sudo docker build -t elasticsearch932:9.3.2 .
20+
sudo docker tag elasticsearch932:9.3.2 koushenhai/elasticsearch9
2121
sudo docker push koushenhai/elasticsearch9:latest
2222
```
2323

laokou-common/laokou-common-core/src/main/java/org/laokou/common/core/config/RestClientConfig.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@ class RestClientConfig {
3838

3939
@Bean
4040
public RestClient restClient() throws NoSuchAlgorithmException, KeyManagementException {
41+
// JDK HttpClient【默认】
42+
// OKHttp3Client
43+
// Apache HttpClient
4144
log.info("{} => Initializing Default RestClient", Thread.currentThread().getName());
42-
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
43-
factory.setHttpClient(HttpUtils.getHttpClient());
45+
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(
46+
HttpUtils.getHttpClient());
4447
return RestClient.builder().requestFactory(factory).build();
4548
}
4649

laokou-common/laokou-common-core/src/main/java/org/laokou/common/core/util/HttpUtils.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import lombok.extern.slf4j.Slf4j;
2121
import org.apache.hc.client5.http.classic.methods.HttpPost;
22+
import org.apache.hc.client5.http.config.ConnectionConfig;
23+
import org.apache.hc.client5.http.config.RequestConfig;
2224
import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
2325
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
2426
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
@@ -28,6 +30,7 @@
2830
import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
2931
import org.apache.hc.core5.http.HttpEntity;
3032
import org.apache.hc.core5.http.io.entity.EntityUtils;
33+
import org.apache.hc.core5.util.Timeout;
3134
import org.laokou.common.i18n.common.constant.StringConstants;
3235
import org.laokou.common.i18n.common.exception.SystemException;
3336
import org.laokou.common.i18n.util.ObjectUtils;
@@ -105,16 +108,28 @@ public static String doFormDataPost(String url, Map<String, String> params, Map<
105108
}
106109

107110
public static CloseableHttpClient getHttpClient() throws NoSuchAlgorithmException, KeyManagementException {
108-
// 创建HttpClient对象
109-
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
110111
DefaultClientTlsStrategy tlsStrategy = new DefaultClientTlsStrategy(SslUtils.sslContext(),
111112
NoopHostnameVerifier.INSTANCE);
112-
PoolingHttpClientConnectionManager poolingHttpClientConnectionManager = PoolingHttpClientConnectionManagerBuilder
113-
.create()
113+
// 请求配置
114+
RequestConfig requestConfig = RequestConfig.custom()
115+
.setResponseTimeout(Timeout.ofSeconds(10))
116+
.setConnectionRequestTimeout(Timeout.ofSeconds(5))
117+
.build();
118+
// 连接配置
119+
ConnectionConfig connectionConfig = ConnectionConfig.custom()
120+
.setConnectTimeout(Timeout.ofSeconds(5))
121+
.setSocketTimeout(Timeout.ofSeconds(5))
122+
.setTimeToLive(Timeout.ofSeconds(90)) // 连接存活最多90s,到期自动废弃
123+
.build();
124+
// 连接池管理配置
125+
PoolingHttpClientConnectionManager cm = PoolingHttpClientConnectionManagerBuilder.create()
126+
.setMaxConnTotal(500) // 设置最大连接数
127+
.setMaxConnPerRoute(100) // 设置每个路由的最大连接数
128+
.setDefaultConnectionConfig(connectionConfig)
114129
.setTlsSocketStrategy(tlsStrategy)
115130
.build();
116-
httpClientBuilder.setConnectionManager(poolingHttpClientConnectionManager);
117-
return httpClientBuilder.build();
131+
// HttpClient
132+
return HttpClientBuilder.create().setConnectionManager(cm).setDefaultRequestConfig(requestConfig).build();
118133
}
119134

120135
}

laokou-common/laokou-common-domain/src/main/java/org/laokou/common/domain/support/KafkaDomainEventPublisher.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import lombok.RequiredArgsConstructor;
2121
import org.jspecify.annotations.NonNull;
2222
import org.laokou.common.i18n.dto.DomainEvent;
23+
import org.laokou.common.i18n.util.ObjectUtils;
2324
import org.springframework.kafka.core.KafkaTemplate;
2425
import org.springframework.stereotype.Component;
2526

@@ -34,6 +35,9 @@ public class KafkaDomainEventPublisher implements DomainEventPublisher {
3435

3536
@Override
3637
public void publish(String topic, DomainEvent payload) {
38+
if (ObjectUtils.isNull(payload)) {
39+
return;
40+
}
3741
kafkaTemplate.send(topic, payload);
3842
}
3943

0 commit comments

Comments
 (0)