部署脚本
This commit is contained in:
parent
5b9d8ee02e
commit
32e16aec03
|
@ -0,0 +1,55 @@
|
|||
#!/bin/bash
|
||||
|
||||
build_folder="$PWD/build"
|
||||
imagebuild_folder="$PWD/imagebuild"
|
||||
yml_folder="$PWD/yml"
|
||||
|
||||
echo "开始构建advisor镜像..."
|
||||
cd "$imagebuild_folder"/advisor || exit
|
||||
rm -rf advisor
|
||||
rm -rf confs
|
||||
cp -r "$build_folder"/advisor .
|
||||
#cp -r "$build_folder"/confs .
|
||||
sh build.sh
|
||||
echo "advisor镜像构建完成"
|
||||
|
||||
echo "开始构建collector镜像..."
|
||||
cd "$imagebuild_folder"/collector || exit
|
||||
rm -rf collector
|
||||
rm -rf confs
|
||||
cp -r "$build_folder"/collector .
|
||||
#cp -r "$build_folder"/confs .
|
||||
sh build.sh
|
||||
echo "collector镜像构建完成"
|
||||
|
||||
echo "开始构建executor镜像..."
|
||||
cd "$imagebuild_folder"/executor || exit
|
||||
rm -rf executor
|
||||
rm -rf confs
|
||||
cp -r "$build_folder"/executor .
|
||||
#cp -r "$build_folder"/confs .
|
||||
sh build.sh
|
||||
echo "executor镜像构建完成"
|
||||
|
||||
echo "开始构建manager镜像..."
|
||||
cd "$imagebuild_folder"/manager || exit
|
||||
rm -rf manager
|
||||
rm -rf confs
|
||||
cp -r "$build_folder"/manager .
|
||||
#cp -r "$build_folder"/confs .
|
||||
sh build.sh
|
||||
echo "manager镜像构建完成"
|
||||
|
||||
echo "开始构建client镜像..."
|
||||
cd "$imagebuild_folder"/client || exit
|
||||
rm -rf client
|
||||
rm -rf confs
|
||||
cp -r "$build_folder"/client .
|
||||
#cp -r "$build_folder"/confs .
|
||||
sh build.sh
|
||||
echo "client镜像构建完成"
|
||||
|
||||
echo "全部镜像构建完成"
|
||||
#echo "生成yaml脚本"
|
||||
#cd "$yml_folder" || exit
|
||||
#sh replace.sh
|
|
@ -0,0 +1,9 @@
|
|||
FROM alpine:latest
|
||||
COPY . /opt
|
||||
WORKDIR /opt/advisor
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
RUN apk add --no-cache tzdata
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
RUN chmod +x advisor
|
||||
ENTRYPOINT ["./advisor"]
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
docker build -t 112.95.163.90:5010/schadvisorservice-x86:latest .
|
||||
docker push 112.95.163.90:5010/schadvisorservice-x86:latest
|
|
@ -0,0 +1,9 @@
|
|||
FROM alpine:latest
|
||||
COPY . /opt
|
||||
WORKDIR /opt/client
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
RUN apk add --no-cache tzdata
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
RUN chmod +x client
|
||||
ENTRYPOINT ["./client","serve","http"]
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
docker build -t 112.95.163.90:5010/schclientservice-x86:latest .
|
||||
docker push 112.95.163.90:5010/schclientservice-x86:latest
|
|
@ -0,0 +1,9 @@
|
|||
FROM alpine:latest
|
||||
COPY . /opt
|
||||
WORKDIR /opt/collector
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
RUN apk add --no-cache tzdata
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
RUN chmod +x collector
|
||||
ENTRYPOINT ["./collector"]
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
docker build -t 112.95.163.90:5010/schcollectorservice-x86:latest .
|
||||
docker push 112.95.163.90:5010/schcollectorservice-x86:latest
|
|
@ -0,0 +1,9 @@
|
|||
FROM alpine:latest
|
||||
COPY . /opt
|
||||
WORKDIR /opt/executor
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
RUN apk add --no-cache tzdata
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
RUN chmod +x executor
|
||||
ENTRYPOINT ["./executor"]
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
docker build -t 112.95.163.90:5010/schexecutorservice-x86:latest .
|
||||
docker push 112.95.163.90:5010/schexecutorservice-x86:latest
|
|
@ -0,0 +1,9 @@
|
|||
FROM alpine:latest
|
||||
COPY . /opt
|
||||
WORKDIR /opt/manager
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
RUN apk add --no-cache tzdata
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
RUN chmod +x manager
|
||||
ENTRYPOINT ["./manager"]
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
docker build -t 112.95.163.90:5010/schmanagerservice-x86:latest .
|
||||
docker push 112.95.163.90:5010/schmanagerservice-x86:latest
|
|
@ -0,0 +1,29 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: schadvisor
|
||||
name: schadvisor
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: schadvisor
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: schadvisor
|
||||
spec:
|
||||
containers:
|
||||
- name: schadvisorservice
|
||||
image: 112.95.163.90:5010/schadvisorservice-x86:latest
|
||||
imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: schadvisorconfig
|
||||
mountPath: /opt/confs
|
||||
volumes:
|
||||
- name: schadvisorconfig
|
||||
configMap:
|
||||
name: schadvisor-config
|
||||
restartPolicy: Always
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: schclient
|
||||
name: schclient
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: schclient
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: schclient
|
||||
spec:
|
||||
containers:
|
||||
- name: schclientservice
|
||||
image: 112.95.163.90:5010/schclientservice-x86:latest
|
||||
imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: schclientconfig
|
||||
mountPath: /opt/confs
|
||||
volumes:
|
||||
- name: schclientconfig
|
||||
configMap:
|
||||
name: schclient-config
|
||||
nodeSelector:
|
||||
nodetype: pcm2
|
||||
restartPolicy: Always
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: schclient
|
||||
name: schclient
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- port: 7891
|
||||
protocol: TCP
|
||||
targetPort: 7891
|
||||
nodePort: 32011
|
||||
selector:
|
||||
app: schclient
|
||||
type: NodePort
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: schcollector
|
||||
name: schcollector
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: schcollector
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: schcollector
|
||||
spec:
|
||||
containers:
|
||||
- name: schcollectorservice
|
||||
image: 112.95.163.90:5010/schcollectorservice-x86:latest
|
||||
imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: schcollectorconfig
|
||||
mountPath: /opt/confs
|
||||
volumes:
|
||||
- name: schcollectorconfig
|
||||
configMap:
|
||||
name: schcollector-config
|
||||
restartPolicy: Always
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"logger": {
|
||||
"output": "stdout",
|
||||
"outputFileName": "advisor",
|
||||
"outputDirectory": "log",
|
||||
"level": "debug"
|
||||
},
|
||||
"rabbitMQ": {
|
||||
"address": "127.0.0.1:5672",
|
||||
"account": "cloudream",
|
||||
"password": "123456",
|
||||
"vhost": "/"
|
||||
},
|
||||
"cloudreamStorage": {
|
||||
"url": "http://localhost:7890"
|
||||
},
|
||||
"pcm": {
|
||||
"url": "http://localhost:7892"
|
||||
},
|
||||
"reportIntervalSec": 10
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"logger": {
|
||||
"output": "stdout",
|
||||
"level": "debug"
|
||||
},
|
||||
"rabbitMQ": {
|
||||
"address": "127.0.0.1:5672",
|
||||
"account": "cloudream",
|
||||
"password": "123456",
|
||||
"vhost": "/"
|
||||
},
|
||||
"cloudreamStorage": {
|
||||
"url": "http://localhost:7890"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"logger": {
|
||||
"output": "stdout",
|
||||
"outputFileName": "collector",
|
||||
"outputDirectory": "log",
|
||||
"level": "debug"
|
||||
},
|
||||
"rabbitMQ": {
|
||||
"address": "127.0.0.1:5672",
|
||||
"account": "cloudream",
|
||||
"password": "123456",
|
||||
"vhost": "/"
|
||||
},
|
||||
"cloudreamStorage": {
|
||||
"url": "http://localhost:7890"
|
||||
},
|
||||
"unifyOps": {
|
||||
"url": "http://localhost:7891"
|
||||
},
|
||||
"slwNodes": [
|
||||
{
|
||||
"id": 1711652475901054976,
|
||||
"name": "hwj",
|
||||
"stgNodeID": 1,
|
||||
"storageID": 1
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"logger": {
|
||||
"output": "stdout",
|
||||
"outputFileName": "executor",
|
||||
"outputDirectory": "log",
|
||||
"level": "debug"
|
||||
},
|
||||
"rabbitMQ": {
|
||||
"address": "127.0.0.1:5672",
|
||||
"account": "cloudream",
|
||||
"password": "123456",
|
||||
"vhost": "/"
|
||||
},
|
||||
"cloudreamStorage": {
|
||||
"url": "http://localhost:7890"
|
||||
},
|
||||
"pcm": {
|
||||
"url": "http://localhost:7070"
|
||||
},
|
||||
"reportIntervalSec": 10
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"logger": {
|
||||
"output": "stdout",
|
||||
"outputFileName": "manager",
|
||||
"outputDirectory": "log",
|
||||
"level": "debug"
|
||||
},
|
||||
"rabbitMQ": {
|
||||
"address": "127.0.0.1:5672",
|
||||
"account": "cloudream",
|
||||
"password": "123456",
|
||||
"vhost": "/"
|
||||
},
|
||||
"db": {
|
||||
"address": "127.0.0.1:3306",
|
||||
"account": "root",
|
||||
"password": "123456",
|
||||
"databaseName": "scheduler"
|
||||
},
|
||||
"cloudreamStorage": {
|
||||
"url": "http://localhost:7890"
|
||||
},
|
||||
"reportTimeoutSecs": 20
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: schexecutor
|
||||
name: schexecutor
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: schexecutor
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: schexecutor
|
||||
spec:
|
||||
containers:
|
||||
- name: schexecutorservice
|
||||
image: 112.95.163.90:5010/schexecutorservice-x86:latest
|
||||
imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: schexecutorconfig
|
||||
mountPath: /opt/confs
|
||||
volumes:
|
||||
- name: schexecutorconfig
|
||||
configMap:
|
||||
name: schexecutor-config
|
||||
restartPolicy: Always
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: schmanager
|
||||
name: schmanager
|
||||
namespace: default
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: schmanager
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: schmanager
|
||||
spec:
|
||||
containers:
|
||||
- name: schmanagerservice
|
||||
image: 112.95.163.90:5010/schmanagerservice-x86:latest
|
||||
imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: schmanagerconfig
|
||||
mountPath: /opt/confs
|
||||
volumes:
|
||||
- name: schmanagerconfig
|
||||
configMap:
|
||||
name: schmanager-config
|
||||
restartPolicy: Always
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 获取当前路径
|
||||
current_path=$(pwd)
|
||||
|
||||
# 拉起configmap
|
||||
cd $current_path/config
|
||||
config_files=$(ls *.json 2>/dev/null)
|
||||
|
||||
if [ -z "$config_files" ]; then
|
||||
echo "当前路径下没有.config.json文件。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for file in $config_files; do
|
||||
if [[ -f "$file" ]]; then
|
||||
name=$(echo "$file" | cut -d '.' -f1)
|
||||
kubectl create cm sch$name-config --from-file=./$file
|
||||
fi
|
||||
done
|
||||
|
||||
# 拉起pod
|
||||
cd $current_path
|
||||
yaml_files=$(ls *.yaml 2>/dev/null)
|
||||
for yaml_file in $yaml_files; do
|
||||
echo "Applying $yaml_file ..."
|
||||
kubectl apply -f $yaml_file
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 获取当前路径
|
||||
current_path=$(pwd)
|
||||
|
||||
# 删除configmap
|
||||
cd $current_path/config
|
||||
config_files=$(ls *.json 2>/dev/null)
|
||||
|
||||
if [ -z "$config_files" ]; then
|
||||
echo "当前路径下没有.config.json文件。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for file in $config_files; do
|
||||
if [[ -f "$file" ]]; then
|
||||
name=$(echo "$file" | cut -d '.' -f1)
|
||||
kubectl delete cm sch$name-config
|
||||
fi
|
||||
done
|
||||
|
||||
# 删除pod
|
||||
cd $current_path
|
||||
yaml_files=$(ls *.yaml 2>/dev/null)
|
||||
|
||||
for yaml_file in $yaml_files; do
|
||||
echo "Delete $yaml_file ..."
|
||||
kubectl delete -f $yaml_file
|
||||
done
|
||||
|
Loading…
Reference in New Issue