forked from Thirdparty/wvp
1
0
Fork 0

Compare commits

...

8 Commits

Author SHA1 Message Date
axzsd 090b31f678 add: log 2023-10-20 14:59:04 +08:00
axzsd 3b68a00018 add: road 2023-10-20 13:59:35 +08:00
axzsd c8a9bf78b5 add: road 2023-10-20 11:59:41 +08:00
axzsd 57d94a8e67 add: road 2023-10-20 11:59:31 +08:00
axzsd e3cb461913 add: road 2023-10-20 11:11:37 +08:00
axzsd 9ef65b88ad add: road 2023-10-20 11:06:26 +08:00
axzsd 67028e889f add: road 2023-10-20 11:05:07 +08:00
axzsd c2d22a196e add: road 2023-10-20 10:58:33 +08:00
9 changed files with 365 additions and 53 deletions

19
builds/Dockerfile-roadbed Normal file
View File

@ -0,0 +1,19 @@
FROM openjdk:8u342-slim
LABEL Author="axzsd" \
Email="atva725@qq.com" \
Description="智慧涉路作业平台视频WVP"
WORKDIR /opt
COPY target/*.jar app.jar
ENV SPRING_PROFILES_ACTIVE="dev"
ENV JAVA_OPTIONS "-Xms512m -Xmx1024m \
-Dfile.encoding=UTF-8 \
-Djava.awt.headless=true \
-Dsun.net.client.defaultConnectTimeout=10000 \
-Dsun.net.client.defaultReadTimeout=30000"
EXPOSE 80 5061
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTIONS -Dspring.profiles.active=${SPRING_PROFILES_ACTIVE} app.jar"]

View File

@ -0,0 +1,44 @@
pipeline {
agent any
environment {
REGISTRY='registry.cn-chengdu.aliyuncs.com'
INTERIOR_REGISTRY='registry-vpc.cn-chengdu.aliyuncs.com'
IMAGE_NAMESPACE='chkj'
IMAGE_NAME='roadbed-iot-vmp-vmanager'
DOCKER_FILE="builds/Dockerfile-roadbed"
K8S_FILE="builds/deploy-roadbed.yml"
}
stages {
stage('compile & buildImage->push') {
steps {
withMaven(maven: 'M3', jdk: '8') {
sh 'mvn clean package -Dmaven.test.skip=true'
}
withDockerServer([credentialsId: 'chkj-docker-client-cert', uri: 'tcp://8.137.98.119']) {
withCredentials([usernamePassword(credentialsId: 'ch-aliyun-registry', passwordVariable: 'DOCKER_PASSWORD', usernameVariable: 'DOCKER_USERNAME')]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $INTERIOR_REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
sh 'docker build -f $DOCKER_FILE -t $INTERIOR_REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$BUILD_ID .'
sh 'echo "push start..."'
sh 'docker push $INTERIOR_REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$BUILD_ID'
}
}
}
}
stage('ack deploy') {
agent none
steps {
configFileProvider([configFile(fileId: '87b5c827-bd51-40af-99f4-31a800614e92', targetLocation: 'K8S-CONFIG', variable: 'KUBECONFIG')]) {
sh 'export tag=$BUILD_ID && envsubst < $K8S_FILE | kubectl apply -f -'
}
}
}
}
}

84
builds/deploy-roadbed.yml Normal file
View File

@ -0,0 +1,84 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: roadbed-iot-vmp-vmanager-api
namespace: kube-qa
labels:
app: roadbed-iot-vmp-vmanager-api
spec:
replicas: 1
selector:
matchLabels:
app: roadbed-iot-vmp-vmanager-api
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: roadbed-iot-vmp-vmanager-api
spec:
containers:
- name: roadbed-iot-vmp-vmanager-api
image: ${REGISTRY}/${IMAGE_NAMESPACE}/${IMAGE_NAME}:${tag}
imagePullPolicy: Always
ports:
- name: web
containerPort: 80
protocol: TCP
- name: sip
containerPort: 5061
env:
- name: TZ
value: Asia/Shanghai
- name: SPRING_PROFILES_ACTIVE
value: road
readinessProbe:
initialDelaySeconds: 20
periodSeconds: 10
timeoutSeconds: 10
httpGet:
scheme: HTTP
port: 80
path: /actuator/health
resources:
limits:
cpu: 2000m
memory: 1024Gi
requests:
cpu: 100m
memory: 512Mi
volumes:
- name: data-volume
persistentVolumeClaim:
claimName: zhslzy-pvc-nfs
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: ch-aliyun-registry
restartPolicy: Always
securityContext: { }
terminationGracePeriodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
name: roadbed-iot-vmp-vmanager-api
namespace: kube-qa
labels:
name: roadbed-iot-vmp-vmanager-api
spec:
selector:
app: roadbed-iot-vmp-vmanager-api
type: NodePort
ports:
- name: web
port: 80
targetPort: web
protocol: TCP
- name: sip
port: 5061
targetPort: sip
protocol: TCP
nodePort: 5061

66
pom.xml
View File

@ -41,6 +41,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
@ -143,7 +147,10 @@
<artifactId>jedis</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
@ -169,4 +176,61 @@
</plugins>
</build>
<distributionManagement>
<repository>
<id>store</id>
<url>http://nexus-oss.hengxintec.com/repository/store/</url>
</repository>
<snapshotRepository>
<id>store</id>
<url>http://nexus-oss.hengxintec.com/repository/store/</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>central</id>
<url>https://maven.aliyun.com/repository/central</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>maven-public</id>
<url>http://nexus-oss.hengxintec.com/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://maven.aliyun.com/repository/central</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>maven-public</id>
<url>http://nexus-oss.hengxintec.com/repository/maven-public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -11,7 +11,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
//@EnableTransactionManagement
//@EnableFeignClients(basePackages = { "com.genersoft.iot.vmp", "org.integrain" })
//@ServletComponentScan("com.genersoft.iot.vmp")
@EnableAutoConfiguration
public class VManageBootstrap extends LogManager {
public static void main(String[] args) {
SpringApplication.run(VManageBootstrap.class, args);

View File

@ -1,5 +1,7 @@
package com.genersoft.iot.vmp.gb28181.event.offline;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
@ -9,23 +11,25 @@ import org.springframework.stereotype.Component;
import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
/**
/**
* @Description:,redis线
* @author: swwheihei
* @date: 202056 11:35:46
* @date: 202056 11:35:46
*/
@Component
public class KeepliveTimeoutListener extends KeyExpirationEventMessageListener {
@Autowired
private EventPublisher publisher;
@Autowired
private EventPublisher publisher;
private static final Logger log = LoggerFactory.getLogger(KeepliveTimeoutListener.class);
public KeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer) {
super(listenerContainer);
}
public KeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer) {
super(listenerContainer);
}
/**
/**
* keykeykeeplive_deviceId
*
* @param message
* @param pattern
*/
@ -33,12 +37,14 @@ public class KeepliveTimeoutListener extends KeyExpirationEventMessageListener {
public void onMessage(Message message, byte[] pattern) {
// 获取失效的key
String expiredKey = message.toString();
if(!expiredKey.startsWith(VideoManagerConstants.KEEPLIVEKEY_PREFIX)){
System.out.println("收到redis过期监听但开头不是"+VideoManagerConstants.KEEPLIVEKEY_PREFIX+",忽略");
return;
if (!expiredKey.startsWith(VideoManagerConstants.KEEPLIVEKEY_PREFIX)) {
if (log.isDebugEnabled()) {
log.debug("收到redis过期监听但开头不是" + VideoManagerConstants.KEEPLIVEKEY_PREFIX + ",忽略");
}
return;
}
String deviceId = expiredKey.substring(VideoManagerConstants.KEEPLIVEKEY_PREFIX.length(),expiredKey.length());
String deviceId = expiredKey.substring(VideoManagerConstants.KEEPLIVEKEY_PREFIX.length(), expiredKey.length());
publisher.outlineEventPublish(deviceId, VideoManagerConstants.EVENT_OUTLINE_TIMEOUT);
}
}

View File

@ -0,0 +1,48 @@
spring:
application:
name: iot-vmp-vmanager
# 影子数据存储方式支持redis、jdbc
database: redis
# 通信方式支持kafka、http
communicate: http
redis:
# Redis服务器IP
#host: 10.24.20.63
host: 117.33.142.185
#端口号
port: 6369
database: 1
#访问密码,若你的redis服务器没有设置密码就不需要用密码去连接
password: 20221122@dev
#超时时间
timeout: 10000
datasource:
name: eiot
url: jdbc:mysql://117.33.142.185:3307/eiot_road?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true
username: root
password: axzsd110
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
server:
port: 80
sip:
# ip: 10.200.64.63
ip: 127.0.0.1
port: 5061
# 根据国标6.1.2中规定domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码由省级、市级、区级、基层编号组成参照GB/T 2260-2007
# 后两位为行业编码定义参照附录D.3
# 3701020049标识山东济南历下区 信息行业接入
domain: 3701020049
id: 37010200492000000001
# 默认设备认证密码,后续扩展使用设备单独密码
password: admin123
media:
# ip: 10.200.64.88
ip: 113.141.178.17
port: 10000
endpoints:
actuator:
enabled: false
health:
enabled: true
path: /actuator/health

View File

@ -0,0 +1,48 @@
spring:
application:
name: iot-vmp-vmanager
# 影子数据存储方式支持redis、jdbc
database: redis
# 通信方式支持kafka、http
communicate: http
redis:
# Redis服务器IP
#host: 10.24.20.63
host: redis.kube-qa.svc.cluster.local
#端口号
port: 6379
database: 1
#访问密码,若你的redis服务器没有设置密码就不需要用密码去连接
password: 20221122@dev
#超时时间
timeout: 10000
datasource:
name: eiot
url: jdbc:mysql://mysql-5-0.mysql-5.kube-qa.svc.cluster.local:3306/eiot_road?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true
username: root
password: axzsd110
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
server:
port: 80
sip:
# ip: 10.200.64.63
ip: 127.0.0.1
port: 5061
# 根据国标6.1.2中规定domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码由省级、市级、区级、基层编号组成参照GB/T 2260-2007
# 后两位为行业编码定义参照附录D.3
# 3701020049标识山东济南历下区 信息行业接入
domain: 3701020049
id: 37010200492000000001
# 默认设备认证密码,后续扩展使用设备单独密码
password: admin123
media:
# ip: 10.200.64.88
ip: zlmediakit-0.zlmediakit.kube-qa.svc.cluster.local
port: 10000
endpoints:
actuator:
enabled: false
health:
enabled: true
path: /actuator/health

View File

@ -1,42 +1,42 @@
spring:
application:
name: iot-vmp-vmanager
# 影子数据存储方式支持redis、jdbc
database: redis
# 通信方式支持kafka、http
communicate: http
redis:
# Redis服务器IP
#host: 10.24.20.63
host: 127.0.0.1
#端口号
port: 6379
datebase: 0
#访问密码,若你的redis服务器没有设置密码就不需要用密码去连接
password:
#超时时间
timeout: 10000
datasource:
name: eiot
url: jdbc:mysql://10.24.20.63:3306/eiot?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true
username: root
password: 123456
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
application:
name: iot-vmp-vmanager
# 影子数据存储方式支持redis、jdbc
database: redis
# 通信方式支持kafka、http
communicate: http
redis:
# Redis服务器IP
#host: 10.24.20.63
host: 127.0.0.1
#端口号
port: 6379
datebase: 0
#访问密码,若你的redis服务器没有设置密码就不需要用密码去连接
password:
#超时时间
timeout: 10000
datasource:
name: eiot
url: jdbc:mysql://10.24.20.63:3306/eiot?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true
username: root
password: 123456
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
server:
port: 8080
port: 8080
sip:
# ip: 10.200.64.63
ip: 192.168.0.102
port: 5060
# 根据国标6.1.2中规定domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码由省级、市级、区级、基层编号组成参照GB/T 2260-2007
# 后两位为行业编码定义参照附录D.3
# 3701020049标识山东济南历下区 信息行业接入
domain: 3701020049
id: 37010200492000000001
# 默认设备认证密码,后续扩展使用设备单独密码
password: admin123
# ip: 10.200.64.63
ip: 192.168.0.102
port: 5060
# 根据国标6.1.2中规定domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码由省级、市级、区级、基层编号组成参照GB/T 2260-2007
# 后两位为行业编码定义参照附录D.3
# 3701020049标识山东济南历下区 信息行业接入
domain: 3701020049
id: 37010200492000000001
# 默认设备认证密码,后续扩展使用设备单独密码
password: admin123
media:
# ip: 10.200.64.88
ip: 192.168.0.102
port: 10000
# ip: 10.200.64.88
ip: 192.168.0.102
port: 10000