Compare commits
7 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
b366fdb706 | |
|
|
3e0c244de4 | |
|
|
e178a14737 | |
|
|
2adf026f0b | |
|
|
8124047101 | |
|
|
157e3511fd | |
|
|
0085f6bfc5 |
|
|
@ -31,7 +31,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>2.3.4.RELEASE</version>
|
||||
<version>${springboot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
<version>2.7.6</version>
|
||||
<version>2.8.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
|
@ -75,6 +75,8 @@
|
|||
<version>9.0.38</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package cn.org.gitlink.notification.common.utils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
@ -96,7 +98,7 @@ public class RedisUtil {
|
|||
if (key.length == 1) {
|
||||
redisTemplate.delete(key[0]);
|
||||
} else {
|
||||
redisTemplate.delete(CollectionUtils.arrayToList(key));
|
||||
redisTemplate.delete((Collection) CollectionUtils.arrayToList(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,40 @@
|
|||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
<!-- knife4j -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
@ -41,6 +75,7 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ package cn.org.gitlink.notification.executor;
|
|||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@ComponentScan("cn.org.gitlink.notification.*")
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@EnableDiscoveryClient
|
||||
public class ExecutorApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ExecutorApplication.class, args);}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,27 @@ logging:
|
|||
config: classpath:logback.xml
|
||||
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: microservices-gns-executor
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: ${nacos_ip}:${nacos_port}
|
||||
username: ${nacos_username}
|
||||
password: ${nacos_password}
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: ${nacos_ip}:${nacos_port}
|
||||
username: ${nacos_username}
|
||||
password: ${nacos_password}
|
||||
kafka:
|
||||
producer:
|
||||
bootstrap_servers: kafka1:9092,kafka2:9092
|
||||
|
|
@ -44,7 +65,7 @@ spring:
|
|||
timeout: 1000
|
||||
|
||||
datasource:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://mysql:3306/gitlink_notification?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2B8&allowMultiQueries=true&useSSL=false
|
||||
username: gitlink
|
||||
password: giTlinK0^827
|
||||
|
|
|
|||
|
|
@ -18,6 +18,14 @@ GNS_EXECUTOR_CONTAINER_NAME=gns_executor
|
|||
GNS_READER_CONTAINER_NAME=gns_reader
|
||||
GNS_WRITER_CONTAINER_NAME=gns_writer
|
||||
|
||||
#============================================ nacos config ============================================
|
||||
NACOS_CONTAINER_NAME=cmdb-nacos
|
||||
NACOS_NETWORK_NAME=docker-microservices-offline_default
|
||||
NACOS_IP=cmdb-nacos
|
||||
NACOS_PORT=8848
|
||||
NACOS_USERNAME=nacos
|
||||
NACOS_PASSWORD=nacos
|
||||
|
||||
#============================================ Ports config ============================================
|
||||
|
||||
MYSQL_LOCAL_PORT=33306
|
||||
|
|
|
|||
|
|
@ -10,4 +10,4 @@ FROM openjdk:11.0.12-jre-slim
|
|||
COPY executor/target/gns-executor-1.0.0.jar /data/gns-executor-app.jar
|
||||
WORKDIR /data
|
||||
EXPOSE 8083
|
||||
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS gns-executor-app.jar"]
|
||||
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS gns-executor-app.jar $NACOS_OPTS"]
|
||||
|
|
@ -0,0 +1,419 @@
|
|||
# ConfigMap 用于存储环境变量
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: gns-config
|
||||
namespace: gns
|
||||
data:
|
||||
MYSQL_DATABASE: "gitlink_notification"
|
||||
---
|
||||
# Redis Deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: gns-redis
|
||||
namespace: gns
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: gns-redis
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: gns-redis
|
||||
spec:
|
||||
containers:
|
||||
- name: gns-redis
|
||||
image: redis:5.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: TZ
|
||||
value: "Asia/Shanghai"
|
||||
ports:
|
||||
- containerPort: 6379
|
||||
volumeMounts:
|
||||
- name: redis-data
|
||||
mountPath: /data
|
||||
- name: redis-logs
|
||||
mountPath: /logs
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: gns-config
|
||||
volumes:
|
||||
- name: redis-data
|
||||
hostPath:
|
||||
path: /data/gitlink-notification-system/docker-data/redis/data
|
||||
- name: redis-logs
|
||||
hostPath:
|
||||
path: /data/gitlink-notification-system/docker-data/redis/logs
|
||||
|
||||
---
|
||||
# Redis Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: gns-redis
|
||||
namespace: gns
|
||||
spec:
|
||||
selector:
|
||||
app: gns-redis
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 6379
|
||||
targetPort: 6379
|
||||
type: ClusterIP
|
||||
---
|
||||
# Zookeeper Deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: gns-zookeeper
|
||||
namespace: gns
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: gns-zookeeper
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: gns-zookeeper
|
||||
spec:
|
||||
containers:
|
||||
- name: gns-zookeeper
|
||||
image: confluentinc/cp-zookeeper:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: ZOOKEEPER_CLIENT_PORT
|
||||
value: "2181"
|
||||
- name: ZOOKEEPER_TICK_TIME
|
||||
value: "2000"
|
||||
ports:
|
||||
- containerPort: 2181
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: gns-config
|
||||
volumes:
|
||||
- name: zookeeper-data
|
||||
hostPath:
|
||||
path: /data/gitlink-notification-system/docker-data/zookeeper
|
||||
|
||||
---
|
||||
# Zookeeper Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: gns-zookeeper
|
||||
namespace: gns
|
||||
spec:
|
||||
selector:
|
||||
app: gns-zookeeper
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 2181
|
||||
targetPort: 2181
|
||||
type: ClusterIP
|
||||
---
|
||||
# Kafka1 Deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: gns-kafka1
|
||||
namespace: gns
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: gns-kafka1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: gns-kafka1
|
||||
spec:
|
||||
containers:
|
||||
- name: gns-kafka1
|
||||
image: confluentinc/cp-kafka:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: KAFKA_BROKER_ID
|
||||
value: "1"
|
||||
- name: KAFKA_ZOOKEEPER_CONNECT
|
||||
value: "gns-zookeeper:2181"
|
||||
- name: KAFKA_ADVERTISED_LISTENERS
|
||||
value: "PLAINTEXT://gns-kafka1:9092,PLAINTEXT_HOST://localhost:29092"
|
||||
- name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
|
||||
value: "PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT"
|
||||
- name: KAFKA_INTER_BROKER_LISTENER_NAME
|
||||
value: "PLAINTEXT"
|
||||
- name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
|
||||
value: "1"
|
||||
ports:
|
||||
- containerPort: 9092
|
||||
- containerPort: 29092
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: gns-config
|
||||
volumes:
|
||||
- name: kafka-data
|
||||
hostPath:
|
||||
path: /data/gitlink-notification-system/docker-data/kafka/gns_kafka1/lib
|
||||
- name: kafka-logs
|
||||
hostPath:
|
||||
path: /data/gitlink-notification-system/docker-data/kafka/gns_kafka1/logs
|
||||
- name: kafka-conf
|
||||
hostPath:
|
||||
path: /data/gitlink-notification-system/docker-data/kafka/gns_kafka1/conf
|
||||
|
||||
---
|
||||
# Kafka1 Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: gns-kafka1
|
||||
namespace: gns
|
||||
spec:
|
||||
selector:
|
||||
app: gns-kafka1
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 9092
|
||||
targetPort: 9092
|
||||
name: kafka1-9092
|
||||
- protocol: TCP
|
||||
port: 29092
|
||||
targetPort: 29092
|
||||
name: kafka1-29092
|
||||
type: ClusterIP
|
||||
---
|
||||
# Kafka2 Deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: gns-kafka2
|
||||
namespace: gns
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: gns-kafka2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: gns-kafka2
|
||||
spec:
|
||||
containers:
|
||||
- name: gns-kafka2
|
||||
image: confluentinc/cp-kafka:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: KAFKA_BROKER_ID
|
||||
value: "2"
|
||||
- name: KAFKA_ZOOKEEPER_CONNECT
|
||||
value: "gns-zookeeper:2181"
|
||||
- name: KAFKA_ADVERTISED_LISTENERS
|
||||
value: "PLAINTEXT://gns-kafka2:9092,PLAINTEXT_HOST://localhost:39092"
|
||||
- name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
|
||||
value: "PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT"
|
||||
- name: KAFKA_INTER_BROKER_LISTENER_NAME
|
||||
value: "PLAINTEXT"
|
||||
- name: KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR
|
||||
value: "1"
|
||||
ports:
|
||||
- containerPort: 9092
|
||||
- containerPort: 39092
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: gns-config
|
||||
volumes:
|
||||
- name: kafka-data
|
||||
hostPath:
|
||||
path: /data/gitlink-notification-system/docker-data/kafka/gns_kafka2/lib
|
||||
- name: kafka-logs
|
||||
hostPath:
|
||||
path: /data/gitlink-notification-system/docker-data/kafka/gns_kafka2/logs
|
||||
- name: kafka-conf
|
||||
hostPath:
|
||||
path: /data/gitlink-notification-system/docker-data/kafka/gns_kafka2/conf
|
||||
|
||||
---
|
||||
# Kafka2 Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: gns-kafka2
|
||||
namespace: gns
|
||||
spec:
|
||||
selector:
|
||||
app: gns-kafka2
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 9092
|
||||
targetPort: 9092
|
||||
name: kafka2-9092
|
||||
- protocol: TCP
|
||||
port: 39092
|
||||
targetPort: 39092
|
||||
name: kafka2-29092
|
||||
type: ClusterIP
|
||||
---
|
||||
# GNS Reader Deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: gns-reader
|
||||
namespace: gns
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: gns-reader
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: gns-reader
|
||||
spec:
|
||||
containers:
|
||||
- name: gns-reader
|
||||
image: gitlink/gns-reader:1.0.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: NACOS_OPTS
|
||||
value: "--nacos_ip=gitlink-nacos.microservices.svc --nacos_port=8848 --nacos_username=nacos --nacos_password=nacos"
|
||||
- name: TZ
|
||||
value: "Asia/Shanghai"
|
||||
ports:
|
||||
- containerPort: 8081
|
||||
volumeMounts:
|
||||
- name: logs
|
||||
mountPath: /data/logs
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: gns-config
|
||||
volumes:
|
||||
- name: logs
|
||||
hostPath:
|
||||
path: /data/gitlink-notification-system/docker-data/gitlink
|
||||
---
|
||||
# GNS Reader Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: gns-reader
|
||||
namespace: gns
|
||||
spec:
|
||||
selector:
|
||||
app: gns-reader
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 8081
|
||||
targetPort: 8081
|
||||
type: ClusterIP
|
||||
---
|
||||
# GNS Writer Deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: gns-writer
|
||||
namespace: gns
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: gns-writer
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: gns-writer
|
||||
spec:
|
||||
containers:
|
||||
- name: gns-writer
|
||||
image: gitlink/gns-writer:1.0.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: NACOS_OPTS
|
||||
value: "--nacos_ip=gitlink-nacos.microservices.svc --nacos_port=8848 --nacos_username=nacos --nacos_password=nacos"
|
||||
- name: TZ
|
||||
value: "Asia/Shanghai"
|
||||
ports:
|
||||
- containerPort: 8082
|
||||
volumeMounts:
|
||||
- name: logs
|
||||
mountPath: /data/logs
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: gns-config
|
||||
volumes:
|
||||
- name: logs
|
||||
hostPath:
|
||||
path: /data/gitlink-notification-system/docker-data/gitlink
|
||||
|
||||
---
|
||||
# GNS Writer Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: gns-writer
|
||||
namespace: gns
|
||||
spec:
|
||||
selector:
|
||||
app: gns-writer
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 8082
|
||||
targetPort: 8082
|
||||
type: ClusterIP
|
||||
---
|
||||
# GNS Executor Deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: gns-executor
|
||||
namespace: gns
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: gns-executor
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: gns-executor
|
||||
spec:
|
||||
containers:
|
||||
- name: gns-executor
|
||||
image: gitlink/gns-executor:1.0.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: NACOS_OPTS
|
||||
value: "--nacos_ip=gitlink-nacos.microservices.svc --nacos_port=8848 --nacos_username=nacos --nacos_password=nacos"
|
||||
- name: TZ
|
||||
value: "Asia/Shanghai"
|
||||
ports:
|
||||
- containerPort: 8083
|
||||
volumeMounts:
|
||||
- name: logs
|
||||
mountPath: /data/logs
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: gns-config
|
||||
volumes:
|
||||
- name: logs
|
||||
hostPath:
|
||||
path: /data/gitlink-notification-system/docker-data/gitlink
|
||||
|
||||
---
|
||||
# GNS Executor Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: gns-executor
|
||||
namespace: gns
|
||||
spec:
|
||||
selector:
|
||||
app: gns-executor
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 8083
|
||||
targetPort: 8083
|
||||
type: ClusterIP
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: gns-mysql-pv
|
||||
namespace: gns
|
||||
spec:
|
||||
capacity:
|
||||
storage: 10Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: "gns-mysql-pv" # 确保这个 storageClassName 与 PVC 中的匹配
|
||||
hostPath:
|
||||
path: "/data/gitlink-notification-system/docker-data/mysql"
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# PersistentVolumeClaim 用于存储卷
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: gns-mysql-pvc
|
||||
namespace: gns
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: "gns-mysql-pv"
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
---
|
||||
# Secret 用于存储敏感信息
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: gns-secret
|
||||
namespace: gns
|
||||
type: Opaque
|
||||
data:
|
||||
MYSQL_ROOT_PASSWORD: "Z2l0TGlOa184Mjc="
|
||||
MYSQL_USER: "Z2l0bGluaw=="
|
||||
MYSQL_PASSWORD: "Z2lUbGluSzBeODI3"
|
||||
#---
|
||||
## gns-mysql-pv 用于存储 MySQL 数据
|
||||
#apiVersion: v1
|
||||
#kind: PersistentVolume
|
||||
#metadata:
|
||||
# name: gns-mysql-pv
|
||||
# namespace: gns
|
||||
#spec:
|
||||
# capacity:
|
||||
# storage: 10Gi
|
||||
# accessModes:
|
||||
# - ReadWriteOnce
|
||||
# storageClassName: "gns-mysql-pv" # 确保这个 storageClassName 与 PVC 中的匹配
|
||||
# hostPath:
|
||||
# path: "/data/gitlink-notification-system/docker-data/mysql"
|
||||
#---
|
||||
## PersistentVolumeClaim 用于存储卷
|
||||
#apiVersion: v1
|
||||
#kind: PersistentVolumeClaim
|
||||
#metadata:
|
||||
# name: gns-mysql-pvc
|
||||
# namespace: gns
|
||||
#spec:
|
||||
# accessModes:
|
||||
# - ReadWriteOnce
|
||||
# storageClassName: "gns-mysql-pv"
|
||||
# resources:
|
||||
# requests:
|
||||
# storage: 10Gi
|
||||
---
|
||||
# MySQL Deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: gns-mysql
|
||||
namespace: gns
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: gns-mysql
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: gns-mysql
|
||||
spec:
|
||||
containers:
|
||||
- name: gns-mysql
|
||||
image: mysql:5.7
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: MYSQL_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gns-secret
|
||||
key: MYSQL_ROOT_PASSWORD
|
||||
- name: MYSQL_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gns-secret
|
||||
key: MYSQL_USER
|
||||
- name: MYSQL_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gns-secret
|
||||
key: MYSQL_PASSWORD
|
||||
- name: MYSQL_DATABASE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: gns-config
|
||||
key: MYSQL_DATABASE
|
||||
- name: TZ
|
||||
value: "Asia/Shanghai"
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
volumeMounts:
|
||||
- name: mysql-data
|
||||
mountPath: /var/lib/mysql
|
||||
- name: sql-scripts
|
||||
mountPath: /docker-entrypoint-initdb.d
|
||||
command: ["/entrypoint.sh"]
|
||||
args: ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci","--bind-address=0.0.0.0"]
|
||||
volumes:
|
||||
- name: mysql-data
|
||||
hostPath:
|
||||
path: /data/gitlink-notification-system/docker-data/mysql
|
||||
type: DirectoryOrCreate
|
||||
- name: sql-scripts
|
||||
hostPath:
|
||||
path: /data/gitlink-notification-system/db
|
||||
---
|
||||
# MySQL Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: gns-mysql-service
|
||||
namespace: gns
|
||||
spec:
|
||||
selector:
|
||||
app: gns-mysql
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 3306
|
||||
targetPort: 3306
|
||||
type: ClusterIP
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#先在middleware目录下配置好.env中的参数
|
||||
cd ../
|
||||
|
||||
#构建基础镜像
|
||||
docker-compose -f services.yml build
|
||||
|
||||
#创建gns的命名空间
|
||||
kubectl create namespace gns
|
||||
|
||||
#应用MySQL部署配置文件
|
||||
kubectl apply -f gns-mysql.yaml
|
||||
|
||||
#应用GNS部署配置文件
|
||||
kubectl apply -f gns-deployment.yaml
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
docker load -i gns-executor-1.0.0.tar.gz
|
||||
docker load -i gns-reader-1.0.0.tar.gz
|
||||
docker load -i gns-writer-1.0.0.tar.gz
|
||||
docker load -i cp-kafka-latest.tar.gz
|
||||
docker load -i cp-zookeeper-latest.tar.gz
|
||||
docker load -i mysql-5.7.35.tar.gz
|
||||
docker load -i redis-6.2.5.tar.gz
|
||||
|
|
@ -10,4 +10,4 @@ FROM openjdk:11.0.12-jre-slim
|
|||
COPY reader/target/gns-reader-1.0.0.jar /data/gns-reader-app.jar
|
||||
WORKDIR /data
|
||||
EXPOSE 8081
|
||||
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS gns-reader-app.jar"]
|
||||
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS gns-reader-app.jar $NACOS_OPTS"]
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
docker save gitlink/gns-executor:1.0.0 | gzip > gns-executor-1.0.0.tar.gz
|
||||
docker save gitlink/gns-reader:1.0.0 | gzip > gns-reader-1.0.0.tar.gz
|
||||
docker save gitlink/gns-writer:1.0.0 | gzip > gns-writer-1.0.0.tar.gz
|
||||
docker save confluentinc/cp-kafka:latest | gzip > cp-kafka-latest.tar.gz
|
||||
docker save confluentinc/cp-zookeeper:latest | gzip > cp-zookeeper-latest.tar.gz
|
||||
docker save mysql:5.7.35 | gzip > mysql-5.7.35.tar.gz
|
||||
docker save redis:6.2.5 | gzip > redis-6.2.5.tar.gz
|
||||
|
|
@ -111,8 +111,10 @@ services:
|
|||
context: ../
|
||||
dockerfile: middleware/reader.Dockerfile
|
||||
networks:
|
||||
- microservices_network
|
||||
- gitlink_network
|
||||
environment:
|
||||
- NACOS_OPTS=--nacos_ip=${NACOS_IP} --nacos_port=${NACOS_PORT} --nacos_username=${NACOS_USERNAME} --nacos_password=${NACOS_PASSWORD}
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ${DOCKER_DATA_PATH}/gitlink/:/data/logs/
|
||||
|
|
@ -121,6 +123,8 @@ services:
|
|||
- kafka2
|
||||
- redis
|
||||
- mysql
|
||||
external_links:
|
||||
- ${NACOS_CONTAINER_NAME}
|
||||
ports:
|
||||
- ${GNS_READER_LOCAL_PORT}:8081
|
||||
restart: always
|
||||
|
|
@ -133,8 +137,10 @@ services:
|
|||
context: ../
|
||||
dockerfile: middleware/writer.Dockerfile
|
||||
networks:
|
||||
- microservices_network
|
||||
- gitlink_network
|
||||
environment:
|
||||
- NACOS_OPTS=--nacos_ip=${NACOS_IP} --nacos_port=${NACOS_PORT} --nacos_username=${NACOS_USERNAME} --nacos_password=${NACOS_PASSWORD}
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ${DOCKER_DATA_PATH}/gitlink/:/data/logs/
|
||||
|
|
@ -143,6 +149,8 @@ services:
|
|||
- kafka2
|
||||
- redis
|
||||
- mysql
|
||||
external_links:
|
||||
- ${NACOS_CONTAINER_NAME}
|
||||
ports:
|
||||
- ${GNS_WRITER_LOCAL_PORT}:8082
|
||||
restart: always
|
||||
|
|
@ -155,16 +163,20 @@ services:
|
|||
context: ../
|
||||
dockerfile: middleware/executor.Dockerfile
|
||||
networks:
|
||||
- microservices_network
|
||||
- gitlink_network
|
||||
volumes:
|
||||
- ${DOCKER_DATA_PATH}/gitlink/:/data/logs/
|
||||
environment:
|
||||
- NACOS_OPTS=--nacos_ip=${NACOS_IP} --nacos_port=${NACOS_PORT} --nacos_username=${NACOS_USERNAME} --nacos_password=${NACOS_PASSWORD}
|
||||
- TZ=Asia/Shanghai
|
||||
depends_on:
|
||||
- kafka1
|
||||
- kafka2
|
||||
- redis
|
||||
- mysql
|
||||
external_links:
|
||||
- ${NACOS_CONTAINER_NAME}
|
||||
ports:
|
||||
- ${GNS_EXECUTOR_LOCAL_PORT}:8083
|
||||
restart: always
|
||||
|
|
@ -172,10 +184,11 @@ services:
|
|||
networks:
|
||||
gitlink_network:
|
||||
driver: bridge
|
||||
name: gitlink_network
|
||||
driver_opts:
|
||||
com.docker.network.enable_ipv6: "true"
|
||||
|
||||
microservices_network:
|
||||
external:
|
||||
name: ${NACOS_NETWORK_NAME}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,4 +10,4 @@ FROM openjdk:11.0.12-jre-slim
|
|||
COPY writer/target/gns-writer-1.0.0.jar /data/gns-writer-app.jar
|
||||
WORKDIR /data
|
||||
EXPOSE 8082
|
||||
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS gns-writer-app.jar"]
|
||||
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS gns-writer-app.jar $NACOS_OPTS"]
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<configuration>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
|
|
@ -35,24 +36,26 @@
|
|||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- mybatis-plus begin -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<version>3.5.5</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus</artifactId>
|
||||
<version>3.4.0</version>
|
||||
<version>3.5.5</version>
|
||||
</dependency>
|
||||
<!-- mybatis-plus end -->
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.38</version>
|
||||
<version>8.0.31</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
@ -75,7 +78,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<version>2.3.4.RELEASE</version>
|
||||
<version>${springboot.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package cn.org.gitlink.notification.model.config;
|
||||
|
||||
import cn.org.gitlink.notification.model.handler.MetaHandler;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
@ -13,13 +15,28 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||
@MapperScan("cn.org.gitlink.notification.model.dao")
|
||||
public class MyBatisPlusConfig {
|
||||
|
||||
// /**
|
||||
// * 分页插件
|
||||
// */
|
||||
// @Bean
|
||||
// public PaginationInnerInterceptor paginationInterceptor() {
|
||||
// PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor();
|
||||
// return paginationInterceptor;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 分页插件
|
||||
*/
|
||||
@Bean
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
|
||||
return paginationInterceptor;
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor(DbType.MYSQL);
|
||||
// 配置分页参数
|
||||
paginationInterceptor.setMaxLimit(500L);
|
||||
// 设置分页参数的封装方式,默认为false,即不封装分页参数
|
||||
paginationInterceptor.setOverflow(false);
|
||||
interceptor.addInnerInterceptor(paginationInterceptor);
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
34
pom.xml
34
pom.xml
|
|
@ -26,30 +26,26 @@
|
|||
<skipTests>true</skipTests>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<springboot.version>2.3.4.RELEASE</springboot.version>
|
||||
<!-- <springboot.version>2.3.12.RELEASE</springboot.version>-->
|
||||
<springboot.version>2.7.7</springboot.version>
|
||||
<spring-boot.version>2.7.7</spring-boot.version>
|
||||
<spring-cloud.version>2021.0.5</spring-cloud.version>
|
||||
<spring-cloud-alibaba.version>2021.0.4.0</spring-cloud-alibaba.version>
|
||||
<swagger.fox.version>3.0.0</swagger.fox.version>
|
||||
<knife4j-spring-ui.version>3.0.3</knife4j-spring-ui.version>
|
||||
<knife4j-spring-boot-starter.version>3.0.3</knife4j-spring-boot-starter.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>swagger-bootstrap-ui</artifactId>
|
||||
<version>1.9.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-discovery-spring-boot-starter</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>2.0.5</version>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
|
|
@ -59,7 +55,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.10</version>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,41 @@
|
|||
<artifactId>gns-model</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
<!-- knife4j -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
@ -37,6 +72,7 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ package cn.org.gitlink.notification.reader;
|
|||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@ComponentScan("cn.org.gitlink.notification.*")
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@EnableDiscoveryClient
|
||||
public class ReaderApiApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ReaderApiApplication.class, args);
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ package cn.org.gitlink.notification.reader.config;
|
|||
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
|
|
@ -15,6 +14,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|||
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
@EnableWebMvc
|
||||
@EnableKnife4j
|
||||
public class SwaggerConfig {
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -5,7 +5,24 @@ logging:
|
|||
config: classpath:logback.xml
|
||||
|
||||
spring:
|
||||
|
||||
application:
|
||||
# 应用名称
|
||||
name: microservices-gns-reader
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: ${nacos_ip}:${nacos_port}
|
||||
username: ${nacos_username}
|
||||
password: ${nacos_password}
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: ${nacos_ip}:${nacos_port}
|
||||
username: ${nacos_username}
|
||||
password: ${nacos_password}
|
||||
redis:
|
||||
database: 0
|
||||
host: redis
|
||||
|
|
@ -19,7 +36,7 @@ spring:
|
|||
timeout: 1000
|
||||
|
||||
datasource:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://mysql:3306/gitlink_notification?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2B8&allowMultiQueries=true&useSSL=false
|
||||
username: gitlink
|
||||
password: giTlinK0^827
|
||||
|
|
|
|||
|
|
@ -32,6 +32,39 @@
|
|||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
<!-- knife4j -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
@ -39,6 +72,7 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
|
|
|||
|
|
@ -2,12 +2,14 @@ package cn.org.gitlink.notification;
|
|||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@ComponentScan("cn.org.gitlink.notification.*")
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@EnableDiscoveryClient
|
||||
public class WriterApiApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(WriterApiApplication.class, args);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,24 @@ logging:
|
|||
config: classpath:logback.xml
|
||||
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: microservices-gns-writer
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: ${nacos_ip}:${nacos_port}
|
||||
username: ${nacos_username}
|
||||
password: ${nacos_password}
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: ${nacos_ip}:${nacos_port}
|
||||
username: ${nacos_username}
|
||||
password: ${nacos_password}
|
||||
kafka:
|
||||
producer:
|
||||
bootstrap_servers: kafka1:9092,kafka2:9092
|
||||
|
|
@ -30,7 +48,7 @@ spring:
|
|||
timeout: 1000
|
||||
|
||||
datasource:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://mysql:3306/gitlink_notification?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2B8&allowMultiQueries=true&useSSL=false
|
||||
username: gitlink
|
||||
password: giTlinK0^827
|
||||
|
|
|
|||
Loading…
Reference in New Issue