编译环境
- CPU 架构: loongarch64
- 系统版本: Kylin Linux Advanced Server V10
- JDK 版本: openjdk version “1.8.0_332”
- maven 版本: Apache Maven 3.8.6
编译 xxl-job
使用以下命令下载指定版本的 xxl-job 源码
1
git clone -b 2.3.0 https://github.com/xuxueli/xxl-job.git
编译 xxl-job
1
2cd xxl-job
mvn clean package编译完成后生成的文件在 xxl-job-admin/target 目录下
1
2
3
4
5
6
7
8ll xxl-job-admin/target/
总用量 39992
drwxr-xr-x 7 root root 131 11月 9 11:57 classes
drwxr-xr-x 3 root root 25 11月 9 11:57 generated-sources
drwxr-xr-x 2 root root 28 11月 9 11:57 maven-archiver
drwxr-xr-x 3 root root 35 11月 9 11:57 maven-status
-rw-r--r-- 1 root root 38997785 11月 9 11:57 xxl-job-admin-2.3.0.jar
-rw-r--r-- 1 root root 1950566 11月 9 11:57 xxl-job-admin-2.3.0.jar.original
构建 xxl-job-admin Docker 镜像
编写 Dockerfile,文件内容如下
1
2
3
4
5
6
7
8
9
10
11FROM cr.loongnix.cn/library/openjdk:8-buster
MAINTAINER xuxueli
ENV PARAMS=""
ENV TZ=PRC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ADD target/xxl-job-admin-*.jar /app.jar
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /app.jar $PARAMS"]官方 Dockerfile 文件地址: Dockerfile
构建镜像
1
docker build -t registry-changsha.vonebaas.com/publics/xxl-job-admin:loong64-2.3.0 .
推送镜像
1
docker push registry-changsha.vonebaas.com/publics/xxl-job-admin:loong64-2.3.0
部署 xxl-job-admin
创建 xxl-job-admin.yaml 资源清单,文件内容如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: xxl-job-admin
project: vbaas
tier: cache
name: xxl-job-admin
namespace: vbaas-cli-sit
spec:
replicas: 1
selector:
matchLabels:
app: xxl-job-admin
project: vbaas
tier: cache
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: xxl-job-admin
project: vbaas
tier: cache
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: groups
operator: In
values:
- vbaas
containers:
- env:
- name: PARAMS
value: --spring.datasource.url=jdbc:mysql://192.168.200.95:3306/xxl_job_uat?Unicode=true&characterEncoding=UTF-8
--spring.datasource.username=vbaas --spring.datasource.password=123456
image: registry-changsha.vonebaas.com/publics/xxl-job-admin:loong64-2.3.0
imagePullPolicy: IfNotPresent
name: xxl-job-admin
ports:
- containerPort: 8080
name: http-xxl-job
protocol: TCP
resources:
requests:
cpu: 100m
memory: 512Mi
imagePullSecrets:
- name: harbor-token
restartPolicy: Always
tolerations:
- effect: NoExecute
key: groups
operator: Equal
value: vbaas
---
apiVersion: v1
kind: Service
metadata:
labels:
app: xxl-job-admin
project: vbaas
tier: cache
name: xxl-job-admin
namespace: vbaas-cli-sit
spec:
ports:
- name: tcp-8080
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: xxl-job-admin
project: vbaas
tier: cache
sessionAffinity: None
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: 50m
name: xxl-job-ingress
namespace: vbaas-cli-sit
spec:
ingressClassName: traefik
rules:
- host: xxl-loong64.vonebaas.com
http:
paths:
- backend:
service:
name: xxl-job-admin
port:
number: 8080
path: /
pathType: Prefix创建资源对象
1
kubectl create -f xxl-job-admin.yaml
配置 hosts 解析
1
111.207.111.194 xxl-loong64.vonebaas.com
打开浏览器,访问
http://xxl-loong64.vonebaas.com/xxl-job-admin
,输入默认用户名密码admin/123456