添加apollo
This commit is contained in:
@ -3,8 +3,5 @@ ENV LC_ALL=zh_CN.utf8
|
||||
ENV LANG=zh_CN.utf8
|
||||
ENV LANGUAGE=zh_CN.utf8
|
||||
RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
|
||||
|
||||
RUN mkdir -p /model
|
||||
COPY /target/classes/model/. /model/
|
||||
ADD /target/biz_service_ebtp_extend-0.0.1.jar /biz_service_ebtp_extend-0.0.1.jar
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=uat", "-javaagent:/skywalking/agent/skywalking-agent.jar", "-jar", "/biz_service_ebtp_extend-0.0.1.jar"]
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/skywalking/agent/skywalking-agent.jar", "-jar", "/biz_service_ebtp_extend-0.0.1.jar"]
|
@ -1,2 +1,2 @@
|
||||
FROM harbor.dcos.xixian.unicom.local/eshop/jdk8_springboot_agent:v1.6
|
||||
ADD target/biz_service_ebtp_extend-0.0.1.jar /app.jar
|
||||
ADD /target/biz_service_ebtp_extend-0.0.1.jar /app.jar
|
2
Dockerfile-sim
Normal file
2
Dockerfile-sim
Normal file
@ -0,0 +1,2 @@
|
||||
FROM harbor.dcos.guangzhou.unicom.local/eshop/jdk8_springboot_agent:v1.6
|
||||
ADD /target/biz_service_ebtp_extend-0.0.1.jar /app.jar
|
@ -1,10 +0,0 @@
|
||||
FROM harbor.dcos.guangzhou.unicom.local/eshop/jdk8_springboot_agent:v1.6
|
||||
ENV LC_ALL=zh_CN.utf8
|
||||
ENV LANG=zh_CN.utf8
|
||||
ENV LANGUAGE=zh_CN.utf8
|
||||
RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
|
||||
|
||||
RUN mkdir -p /model
|
||||
COPY /target/classes/model/. /model/
|
||||
ADD /target/biz_service_ebtp_extend-0.0.1.jar /biz_service_ebtp_extend-0.0.1.jar
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/skywalking/agent/skywalking-agent.jar", "-Dspring.profiles.active=test", "-jar", "/biz_service_ebtp_extend-0.0.1.jar"]
|
7
Dockerfile-uat
Normal file
7
Dockerfile-uat
Normal file
@ -0,0 +1,7 @@
|
||||
FROM harbor.dcos.guangzhou.unicom.local/eshop/skywalking_agent_springboot_8.1.0:v1.0
|
||||
ENV LC_ALL=zh_CN.utf8
|
||||
ENV LANG=zh_CN.utf8
|
||||
ENV LANGUAGE=zh_CN.utf8
|
||||
RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
|
||||
ADD /target/biz_service_ebtp_extend-0.0.1.jar /biz_service_ebtp_extend-0.0.1.jar
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/skywalking/agent/skywalking-agent.jar","-jar", "/biz_service_ebtp_extend-0.0.1.jar"]
|
17
config-sim
Normal file
17
config-sim
Normal file
@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
clusters:
|
||||
- cluster:
|
||||
insecure-skip-tls-verify: true
|
||||
server: https://10.172.48.16:44039
|
||||
name: demok8s
|
||||
contexts:
|
||||
- context:
|
||||
cluster: demok8s
|
||||
user: cluster-admin
|
||||
name: default
|
||||
current-context: default
|
||||
kind: Config
|
||||
users:
|
||||
- name: cluster-admin
|
||||
user:
|
||||
token: 2c00232d4e3b1498008315e8ab14283c
|
@ -7,23 +7,23 @@ metadata:
|
||||
namespace: default
|
||||
labels:
|
||||
app: biz-service-ebtp-extend
|
||||
|
||||
|
||||
# 必选,详细定义
|
||||
spec:
|
||||
# pod 副本数量
|
||||
replicas: 1
|
||||
|
||||
|
||||
# 滚动升级配置信息
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 1
|
||||
maxUnavailable: 1
|
||||
|
||||
|
||||
# 选择器,匹配pod模板
|
||||
selector:
|
||||
matchLabels:
|
||||
app: biz-service-ebtp-extend
|
||||
|
||||
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
@ -32,25 +32,31 @@ spec:
|
||||
annotations:
|
||||
prometheus.io/port: '18018'
|
||||
prometheus.io/jl-pod: 'true'
|
||||
|
||||
|
||||
# 定义容器模板,该模板可以包含多个容器
|
||||
spec:
|
||||
# 必选,Pod中容器列表
|
||||
containers:
|
||||
- name: biz-service-ebtp-extend
|
||||
image: harbor.dcos.guangzhou.unicom.local/eshop/biz-service-ebtp-extend:latest
|
||||
# 需要暴露的端口库号列表
|
||||
ports:
|
||||
- containerPort: 18018
|
||||
# 容器运行前需设置的环境变量列表
|
||||
env:
|
||||
# Apollo 配置中心变量设置
|
||||
- name: APOLLO_CONFIGSERVICE
|
||||
value: http://10.242.37.1488:6001
|
||||
- name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
|
||||
value: skywalking-oap-cluster.skywalking:11800
|
||||
- name: SW_AGENT_NAME
|
||||
value: biz-service-ebtp-extend
|
||||
- name: biz-service-ebtp-extend
|
||||
image: harbor.dcos.guangzhou.unicom.local/eshop/biz-service-ebtp-extend:latest
|
||||
# 需要暴露的端口库号列表
|
||||
ports:
|
||||
- containerPort: 18018
|
||||
# 容器运行前需设置的环境变量列表
|
||||
env:
|
||||
# Apollo 配置中心变量设置
|
||||
- name: APOLLO_CONFIGSERVICE
|
||||
value: http://10.242.37.1488:6001
|
||||
- name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
|
||||
value: skywalking-oap-cluster.skywalking:11800
|
||||
- name: SW_AGENT_NAME
|
||||
value: biz-service-ebtp-extend
|
||||
- name: APP_NAME
|
||||
value: biz_service_ebtp_extend_dev
|
||||
- name: MY_POD_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
---
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
@ -71,5 +77,5 @@ spec:
|
||||
app: biz-service-ebtp-extend
|
||||
status:
|
||||
loadBalancer: {}
|
||||
|
||||
|
||||
---
|
118
deployment-master.yaml
Normal file
118
deployment-master.yaml
Normal file
@ -0,0 +1,118 @@
|
||||
# 接口版本
|
||||
apiVersion: apps/v1
|
||||
# 接口类型
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: biz-service-ebtp-extend
|
||||
namespace: default
|
||||
labels:
|
||||
app: biz-service-ebtp-extend
|
||||
|
||||
# 必选,详细定义
|
||||
spec:
|
||||
# pod 副本数量
|
||||
replicas: 3
|
||||
|
||||
# 滚动升级配置信息
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 1
|
||||
maxUnavailable: 1
|
||||
|
||||
# 选择器,匹配pod模板
|
||||
selector:
|
||||
matchLabels:
|
||||
app: biz-service-ebtp-extend
|
||||
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
# 模板名称
|
||||
app: biz-service-ebtp-extend
|
||||
annotations:
|
||||
prometheus.io/port: '18018'
|
||||
prometheus.io/jl-pod: 'true'
|
||||
|
||||
# 定义容器模板,该模板可以包含多个容器
|
||||
spec:
|
||||
volumes:
|
||||
- name: log
|
||||
persistentVolumeClaim:
|
||||
claimName: log-pvc
|
||||
readOnly: false
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- labelSelector:
|
||||
matchExpressions:
|
||||
- key: app
|
||||
operator: In
|
||||
values:
|
||||
- biz-service-ebtp-extend
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
# 必选,Pod中容器列表
|
||||
containers:
|
||||
- name: biz-service-ebtp-extend
|
||||
image: harbor.dcos.xixian.unicom.local/eshop/biz-service-ebtp-extend:latest
|
||||
args: ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/pinpoint/tianyan-springboot-agent/pinpoint-bootstrap-1.8.0.jar", "-Dpinpoint.agentId=$(MY_POD_IP)","-Dpinpoint.applicationName=$(APP_NAME)", "-Dpinpoint.licence=$(AGENT_LICENCE_DEV)", "-jar", "/app.jar"]
|
||||
volumeMounts:
|
||||
- name: log
|
||||
mountPath: /log
|
||||
ports:
|
||||
- containerPort: 18018
|
||||
#livenessProbe:
|
||||
# failureThreshold: 3
|
||||
# httpGet:
|
||||
# port: 18018 #[11] pod存活检测端口,修改为该微服务配置文件中server.port的端口号,与参数[5]相同
|
||||
# path: /actuator/prometheus
|
||||
# scheme: HTTP
|
||||
# initialDelaySeconds: 300
|
||||
# periodSeconds: 60
|
||||
# successThreshold: 1
|
||||
# timeoutSeconds: 2
|
||||
#readinessProbe:
|
||||
# failureThreshold: 1
|
||||
# httpGet:
|
||||
# port: 18018 #[12] pod就绪检测端口,修改为该微服务配置文件中server.port的端口号,与参数[5]相同
|
||||
# path: /actuator/prometheus
|
||||
# scheme: HTTP
|
||||
# periodSeconds: 5
|
||||
# successThreshold: 2
|
||||
# timeoutSeconds: 2
|
||||
resources:
|
||||
requests:
|
||||
cpu: 1000m
|
||||
memory: 2Gi
|
||||
limits:
|
||||
cpu: 3000m
|
||||
memory: 6Gi
|
||||
env:
|
||||
- name: AGENT_LICENCE
|
||||
value: 527BFA7B28577578
|
||||
- name: APP_NAME
|
||||
value: biz_service_ebtp_extend
|
||||
- name: APOLLO_CONFIGSERVICE
|
||||
value: http://apollo-configservice:8080
|
||||
- name: MY_POD_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
---
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: biz-service-ebtp-extend-svc # [11] service的名字,格式为“服务名-svc”
|
||||
namespace: default
|
||||
labels:
|
||||
service: biz-service-ebtp-extend-svc # [12] service的标签,可与参数[11]相同
|
||||
annotations:
|
||||
prometheus.io/port: '18018' #[13] prometheus自动发现service的端口,也是该微服务所使用的端口,与参数[4]相同
|
||||
prometheus.io/jl-svc: 'true'
|
||||
|
||||
spec:
|
||||
ports:
|
||||
- port: 18018 #[15] 与参数4相同
|
||||
targetPort: 18018 #[16] 与参数4相同
|
||||
selector:
|
||||
app: biz-service-ebtp-extend #[17] 该service对应Deployment的名字,与参数[1]相同
|
||||
---
|
@ -11,7 +11,7 @@ metadata:
|
||||
# 必选,详细定义
|
||||
spec:
|
||||
# pod 副本数量
|
||||
replicas: 1
|
||||
replicas: 3
|
||||
|
||||
# 滚动升级配置信息
|
||||
strategy:
|
||||
@ -35,66 +35,65 @@ spec:
|
||||
|
||||
# 定义容器模板,该模板可以包含多个容器
|
||||
spec:
|
||||
# 挂载日志存储
|
||||
volumes:
|
||||
- name: log
|
||||
persistentVolumeClaim:
|
||||
claimName: log-pvc
|
||||
readOnly: false
|
||||
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- labelSelector:
|
||||
matchExpressions:
|
||||
- key: app
|
||||
operator: In
|
||||
values:
|
||||
- biz-service-ebtp-extend
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
# 必选,Pod中容器列表
|
||||
containers:
|
||||
- name: biz-service-ebtp-extend
|
||||
image: harbor.dcos.guangzhou.unicom.local/eshop/biz-service-ebtp-extend:latest
|
||||
# 在容器中挂载日志存储区
|
||||
args: ["java", "-Djava.security.egd=file:/dev/./urandom", "-javaagent:/pinpoint/tianyan-springboot-agent/pinpoint-bootstrap-1.8.0.jar", "-Dpinpoint.agentId=$(MY_POD_IP)","-Dpinpoint.applicationName=$(APP_NAME)", "-Dpinpoint.licence=$(AGENT_LICENCE_DEV)", "-jar", "/app.jar"]
|
||||
volumeMounts:
|
||||
- name: log
|
||||
mountPath: /log
|
||||
# 需要暴露的端口库号列表
|
||||
ports:
|
||||
- containerPort: 18018
|
||||
- containerPort: 18018
|
||||
resources:
|
||||
requests:
|
||||
cpu: 2000m
|
||||
memory: 4Gi
|
||||
cpu: 1000m
|
||||
memory: 2Gi
|
||||
limits:
|
||||
cpu: 4000m
|
||||
memory: 8Gi
|
||||
# 容器运行前需设置的环境变量列表
|
||||
cpu: 3000m
|
||||
memory: 6Gi
|
||||
env:
|
||||
# Apollo 配置中心变量设置
|
||||
- name: AGENT_LICENCE
|
||||
value: 527BFA7B28577578
|
||||
- name: APP_NAME
|
||||
value: biz_service_ebtp_extend_sim
|
||||
- name: APOLLO_CONFIGSERVICE
|
||||
value: http://apollo-configservice:8080
|
||||
- name: MY_POD_IP #自动获取pod ip作为agent id
|
||||
- name: MY_POD_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
- name: JAVA_TOOL_OPTIONS
|
||||
value: -XX:+UnlockExperimentalVMOptions
|
||||
-XX:+UseContainerSupport
|
||||
-XX:+UseCGroupMemoryLimitForHeap
|
||||
-XX:InitialRAMPercentage=40.0
|
||||
-XX:MinRAMPercentage=20.0
|
||||
-XX:MaxRAMPercentage=80.0
|
||||
---
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: biz-service-ebtp-extend
|
||||
name: biz-service-ebtp-extend-svc # [11] service的名字,格式为“服务名-svc”
|
||||
namespace: default
|
||||
labels:
|
||||
app: biz-service-ebtp-extend
|
||||
service: biz-service-ebtp-extend-svc # [12] service的标签,可与参数[11]相同
|
||||
annotations:
|
||||
# lb.cke.tg.unicom/target-vports: 18018-18018
|
||||
prometheus.io/port: '18018'
|
||||
prometheus.io/port: '18018' #[13] prometheus自动发现service的端口,也是该微服务所使用的端口,与参数[4]相同
|
||||
prometheus.io/jl-svc: 'true'
|
||||
|
||||
spec:
|
||||
ports:
|
||||
- port: 18018
|
||||
targetPort: 18018
|
||||
- port: 18018 #[15] 与参数4相同
|
||||
targetPort: 18018 #[16] 与参数4相同
|
||||
selector:
|
||||
app: biz-service-ebtp-extend
|
||||
status:
|
||||
loadBalancer: {}
|
||||
|
||||
app: biz-service-ebtp-extend #[17] 该service对应Deployment的名字,与参数[1]相同
|
||||
---
|
106
deployment-uat.yaml
Normal file
106
deployment-uat.yaml
Normal file
@ -0,0 +1,106 @@
|
||||
# 接口版本
|
||||
apiVersion: apps/v1
|
||||
# 接口类型
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: biz-service-ebtp-extend
|
||||
namespace: default
|
||||
labels:
|
||||
app: biz-service-ebtp-extend
|
||||
|
||||
# 必选,详细定义
|
||||
spec:
|
||||
# pod 副本数量
|
||||
replicas: 1
|
||||
|
||||
# 滚动升级配置信息
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 1
|
||||
maxUnavailable: 1
|
||||
|
||||
# 选择器,匹配pod模板
|
||||
selector:
|
||||
matchLabels:
|
||||
app: biz-service-ebtp-extend
|
||||
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
# 模板名称
|
||||
app: biz-service-ebtp-extend
|
||||
annotations:
|
||||
prometheus.io/port: '18018'
|
||||
prometheus.io/jl-pod: 'true'
|
||||
|
||||
# 定义容器模板,该模板可以包含多个容器
|
||||
spec:
|
||||
# 挂载日志存储
|
||||
volumes:
|
||||
- name: log
|
||||
persistentVolumeClaim:
|
||||
claimName: log-pvc
|
||||
readOnly: false
|
||||
|
||||
# 必选,Pod中容器列表
|
||||
containers:
|
||||
- name: biz-service-ebtp-extend
|
||||
image: harbor.dcos.guangzhou.unicom.local/eshop/biz-service-ebtp-extend:latest
|
||||
# 在容器中挂载日志存储区
|
||||
volumeMounts:
|
||||
- name: log
|
||||
mountPath: /log
|
||||
# 需要暴露的端口库号列表
|
||||
ports:
|
||||
- containerPort: 18018
|
||||
resources:
|
||||
requests:
|
||||
cpu: 2000m
|
||||
memory: 4Gi
|
||||
limits:
|
||||
cpu: 4000m
|
||||
memory: 8Gi
|
||||
# 容器运行前需设置的环境变量列表
|
||||
env:
|
||||
# Apollo 配置中心变量设置
|
||||
- name: APOLLO_CONFIGSERVICE
|
||||
value: http://apollo-configservice:8080
|
||||
- name: MY_POD_IP #自动获取pod ip作为agent id
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
- name: JAVA_TOOL_OPTIONS
|
||||
value: -XX:+UnlockExperimentalVMOptions
|
||||
-XX:+UseContainerSupport
|
||||
-XX:+UseCGroupMemoryLimitForHeap
|
||||
-XX:InitialRAMPercentage=40.0
|
||||
-XX:MinRAMPercentage=20.0
|
||||
-XX:MaxRAMPercentage=80.0
|
||||
- name: APP_NAME
|
||||
value: biz_service_ebtp_extend_uat
|
||||
- name: MY_POD_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
---
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: biz-service-ebtp-extend
|
||||
namespace: default
|
||||
labels:
|
||||
app: biz-service-ebtp-extend
|
||||
annotations:
|
||||
# lb.cke.tg.unicom/target-vports: 18018-18018
|
||||
prometheus.io/port: '18018'
|
||||
prometheus.io/jl-svc: 'true'
|
||||
spec:
|
||||
ports:
|
||||
- port: 18018
|
||||
targetPort: 18018
|
||||
selector:
|
||||
app: biz-service-ebtp-extend
|
||||
status:
|
||||
loadBalancer: {}
|
||||
|
||||
---
|
2
pro.yaml
2
pro.yaml
@ -41,7 +41,7 @@ spec:
|
||||
containers:
|
||||
- name: biz-service-ebtp-extend #[6] 必选,容器名称,可填写微服务名称
|
||||
image: harbor.dcos.xixian.unicom.local/eshop/biz-service-ebtp-extend:latest #[7] 镜像名称,请把biz-service-ebtp-extend替换为服务名称
|
||||
args: ["java","-Djava.security.egd=file:/dev/./urandom", "-javaagent:/pinpoint/tianyan-springboot-agent/pinpoint-bootstrap-1.8.0.jar", "-Dpinpoint.agentId=$(MY_POD_IP)", "-Dpinpoint.applicationName=$(APP_NAME)", "-Dpinpoint.licence=$(AGENT_LICENCE_DEV)", "-Dspring.profiles.active=pro", "-jar", "/app.jar"]
|
||||
args: ["java","-Djava.security.egd=file:/dev/./urandom", "-javaagent:/pinpoint/tianyan-springboot-agent/pinpoint-bootstrap-1.8.0.jar", "-Dpinpoint.agentId=$(MY_POD_IP)", "-Dpinpoint.applicationName=$(APP_NAME)", "-Dpinpoint.licence=$(AGENT_LICENCE_DEV)", "-jar", "/app.jar"]
|
||||
volumeMounts:
|
||||
- name: log
|
||||
mountPath: /log
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.chinaunicom.mall.ebtp.extend;
|
||||
|
||||
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@ -23,6 +24,7 @@ import io.micrometer.core.instrument.MeterRegistry;
|
||||
@EnableEurekaClient
|
||||
@MapperScan({ "com.chinaunicom.mall.ebtp.extend.**.dao" })
|
||||
@ComponentScan("com.chinaunicom.mall.ebtp.*")
|
||||
@EnableApolloConfig
|
||||
public class BizServiceEbtpExtendApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -1,3 +1,9 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: uat
|
||||
# 对应 apollo 配置中心的应用名
|
||||
app:
|
||||
id: biz-service-ebtp-extend
|
||||
|
||||
# Apollo 配置信息
|
||||
apollo:
|
||||
bootstrap:
|
||||
enabled: true
|
||||
namespace: application
|
@ -2,7 +2,7 @@
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="true">
|
||||
|
||||
<property name="logback.logdir" value="/log" />
|
||||
<property name="logback.appname" value="biz_service_ebtp_extend" />
|
||||
<property name="logback.appname" value="${APP_NAME}" />
|
||||
|
||||
<contextName>${logback.appname}</contextName>
|
||||
|
||||
|
Reference in New Issue
Block a user