This commit is contained in:
wangchuxiao
2023-02-09 20:36:34 +08:00
parent 8a1702fcf7
commit 759432794f
216 changed files with 2299 additions and 4059 deletions
+20
View File
@@ -0,0 +1,20 @@
FROM ubuntu
# 设置固定的项目路径
ENV WORKDIR /Open-IM-Server
ENV CMDDIR $WORKDIR/cmd
ENV CONFIG_NAME $WORKDIR/config/config.yaml
# 将可执行文件复制到目标目录
ADD ./open_im_admin_cms $WORKDIR/cmd/main
# 创建用于挂载的几个目录,添加可执行权限
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
chmod +x $WORKDIR/cmd/main
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config", "/Open-IM-Server/script"]
WORKDIR $CMDDIR
CMD ./main
+43
View File
@@ -0,0 +1,43 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: admin-cms-deployment
spec:
selector:
matchLabels:
app: admin-cms # 选择这个指定标签执行
replicas: 1 # 运行pod数量
template:
metadata:
labels:
app: admin-cms # 标签
spec:
containers:
- name: admin-cms
image: openim/admin_cms:v2.3.4
# imagePullPolicy: Always #每次启动都重新拉取镜像
ports:
- containerPort: 10200
volumeMounts:
- name: config
mountPath: /Open-IM-Server/config
readOnly: true
- name: usualConfig
mountPath: /Open-IM-Server/config
readOnly: true
env:
- name: CONFIG_NAME
value: "/Open-IM-Server"
- name: USUAL_CONFIG_NAME
value: "/Open-IM-Server"
volumes:
- name: config
configMap:
name: openim-config
- name: usualConfig
configMap:
name: openim-usualConfig
strategy: #更新策略
type: RollingUpdate # 滚动更新
+19
View File
@@ -0,0 +1,19 @@
FROM ubuntu
# 设置固定的项目路径
ENV WORKDIR /Open-IM-Server
ENV CMDDIR $WORKDIR/cmd
ENV CONFIG_NAME $WORKDIR/config/config.yaml
# 将可执行文件复制到目标目录
ADD ./open_im_api $WORKDIR/cmd/main
# 创建用于挂载的几个目录,添加可执行权限
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
chmod +x $WORKDIR/cmd/main
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
WORKDIR $CMDDIR
CMD ./main
+56
View File
@@ -0,0 +1,56 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-deployment
spec:
selector:
matchLabels:
app: api # 选择这个指定标签执行
replicas: 1 # 运行pod数量
template:
metadata:
labels:
app: api # 标签
spec:
containers:
- name: api
image: openim/api:v2.3.4
# imagePullPolicy: Always
ports:
- containerPort: 10002
volumeMounts:
- name: config
mountPath: /Open-IM-Server/config
readOnly: true
- name: usualConfig
mountPath: /Open-IM-Server/config
readOnly: true
env:
- name: CONFIG_NAME
value: "/Open-IM-Server"
- name: USUAL_CONFIG_NAME
value: "/Open-IM-Server"
volumes:
- name: config
configMap:
name: openim-config
- name: usualConfig
configMap:
name: openim-usualConfig
strategy: #更新策略
type: RollingUpdate # 滚动更新
---
apiVersion: v1
kind: Service
metadata:
name: api
spec:
ports:
- name: api-port
protocol: TCP
port: 10002
targetPort: 10002
selector:
app: api
type: NodePort
+19
View File
@@ -0,0 +1,19 @@
FROM ubuntu
# 设置固定的项目路径
ENV WORKDIR /Open-IM-Server
ENV CMDDIR $WORKDIR/cmd
ENV CONFIG_NAME $WORKDIR/config/config.yaml
# 将可执行文件复制到目标目录
ADD ./open_im_auth $WORKDIR/cmd/main
# 创建用于挂载的几个目录,添加可执行权限
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
chmod +x $WORKDIR/cmd/main
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
WORKDIR $CMDDIR
CMD ./main
+42
View File
@@ -0,0 +1,42 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: auth-deployment
spec:
selector:
matchLabels:
app: auth # 选择这个指定标签执行
replicas: 1 # 运行pod数量
template:
metadata:
labels:
app: auth # 标签
spec:
containers:
- name: auth
image: openim/auth:v2.3.4
# imagePullPolicy: Always
ports:
- containerPort: 10160
volumeMounts:
- name: config
mountPath: /Open-IM-Server/config
readOnly: true
- name: usualConfig
mountPath: /Open-IM-Server/config
readOnly: true
env:
- name: CONFIG_NAME
value: "/Open-IM-Server"
- name: USUAL_CONFIG_NAME
value: "/Open-IM-Server"
volumes:
- name: config
configMap:
name: openim-config
- name: usualConfig
configMap:
name: openim-usualConfig
strategy: #更新策略
type: RollingUpdate # 滚动更新
+30
View File
@@ -0,0 +1,30 @@
#/bin/sh
source ./path_info.cfg
# images version
version=v2.3.4
git pull
cd ../script/; ./build_all_service.sh
cd ../deploy_k8s/
for i in ${service[*]}
do
mv ../bin/open_im_${i} ./${i}/
done
echo "move success"
echo "start to build images"
for i in ${service[*]}
do
echo "start to build images" $i
cd $i
image="openim/${i}:$version"
docker build -t $image . -f ./${i}.Dockerfile
echo "build ${dockerfile} success"
docker push $image
echo "push ${image} success "
cd ..
done
+18
View File
@@ -0,0 +1,18 @@
FROM ubuntu
# 设置固定的项目路径
ENV WORKDIR /Open-IM-Server
ENV CMDDIR $WORKDIR/cmd
ENV CONFIG_NAME $WORKDIR/config/config.yaml
# 将可执行文件复制到目标目录
ADD ./open_im_cms_api $WORKDIR/cmd/main
# 创建用于挂载的几个目录,添加可执行权限
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
chmod +x $WORKDIR/cmd/main
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
WORKDIR $CMDDIR
CMD ./main
+56
View File
@@ -0,0 +1,56 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cms-api-deployment
spec:
selector:
matchLabels:
app: cms-api # 选择这个指定标签执行
replicas: 1 # 运行pod数量
template:
metadata:
labels:
app: cms-api # 标签
spec:
containers:
- name: cms-api
image: openim/cms_api:v2.3.4
imagePullPolicy: Always
ports:
- containerPort: 10006
volumeMounts:
- name: config
mountPath: /Open-IM-Server/config
readOnly: true
- name: usualConfig
mountPath: /Open-IM-Server/config
readOnly: true
env:
- name: CONFIG_NAME
value: "/Open-IM-Server"
- name: USUAL_CONFIG_NAME
value: "/Open-IM-Server"
volumes:
- name: config
configMap:
name: openim-config
- name: usualConfig
configMap:
name: openim-usualConfig
strategy: #更新策略
type: RollingUpdate # 滚动更新
---
apiVersion: v1
kind: Service
metadata:
name: cms-api
spec:
ports:
- name: cms-api-port
protocol: TCP
port: 10006
targetPort: 10006
selector:
app: cms-api
type: NodePort
@@ -0,0 +1,18 @@
FROM ubuntu
# 设置固定的项目路径
ENV WORKDIR /Open-IM-Server
ENV CMDDIR $WORKDIR/cmd
ENV CONFIG_NAME $WORKDIR/config/config.yaml
# 将可执行文件复制到目标目录
ADD ./open_im_conversation $WORKDIR/cmd/main
# 创建用于挂载的几个目录,添加可执行权限
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
chmod +x $WORKDIR/cmd/main
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
WORKDIR $CMDDIR
CMD ./main
+44
View File
@@ -0,0 +1,44 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: conversation-deployment
spec:
selector:
matchLabels:
app: conversation # 选择这个指定标签执行
replicas: 2 # 运行pod数量
template:
metadata:
labels:
app: conversation # 标签
spec:
containers:
- name: conversation
image: openim/conversation:v2.3.4
# imagePullPolicy: Always
ports:
- containerPort: 10230
volumeMounts:
- name: config
mountPath: /Open-IM-Server/config
readOnly: true
- name: usualConfig
mountPath: /Open-IM-Server/config
readOnly: true
env:
- name: CONFIG_NAME
value: "/Open-IM-Server"
- name: USUAL_CONFIG_NAME
value: "/Open-IM-Server"
volumes:
- name: config
configMap:
name: openim-config
- name: usualConfig
configMap:
name: openim-usualConfig
strategy: #更新策略
type: RollingUpdate # 滚动更新
+43
View File
@@ -0,0 +1,43 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: friend-deployment
spec:
selector:
matchLabels:
app: friend # 选择这个指定标签执行
replicas: 1 # 运行pod数量
template:
metadata:
labels:
app: friend # 标签
spec:
containers:
- name: friend
image: openim/friend:v2.3.4
# imagePullPolicy: Always
ports:
- containerPort: 10120
volumeMounts:
- name: config
mountPath: /Open-IM-Server/config
readOnly: true
- name: usualConfig
mountPath: /Open-IM-Server/config
readOnly: true
env:
- name: CONFIG_NAME
value: "/Open-IM-Server"
- name: USUAL_CONFIG_NAME
value: "/Open-IM-Server"
volumes:
- name: config
configMap:
name: openim-config
- name: usualConfig
configMap:
name: openim-usualConfig
strategy: #更新策略
type: RollingUpdate # 滚动更新
+19
View File
@@ -0,0 +1,19 @@
FROM ubuntu
# 设置固定的项目路径
ENV WORKDIR /Open-IM-Server
ENV CMDDIR $WORKDIR/cmd
ENV CONFIG_NAME $WORKDIR/config/config.yaml
# 将可执行文件复制到目标目录
ADD ./open_im_friend $WORKDIR/cmd/main
# 创建用于挂载的几个目录,添加可执行权限
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
chmod +x $WORKDIR/cmd/main
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
WORKDIR $CMDDIR
CMD ./main
+42
View File
@@ -0,0 +1,42 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: group-deployment
spec:
selector:
matchLabels:
app: group # 选择这个指定标签执行
replicas: 1 # 运行pod数量
template:
metadata:
labels:
app: group # 标签
spec:
containers:
- name: group
image: openim/group:v2.3.4
# imagePullPolicy: Always
ports:
- containerPort: 10150
volumeMounts:
- name: config
mountPath: /Open-IM-Server/config
readOnly: true
- name: usualConfig
mountPath: /Open-IM-Server/config
readOnly: true
env:
- name: CONFIG_NAME
value: "/Open-IM-Server"
- name: USUAL_CONFIG_NAME
value: "/Open-IM-Server"
volumes:
- name: config
configMap:
name: openim-config
- name: usualConfig
configMap:
name: openim-usualConfig
strategy: #更新策略
type: RollingUpdate # 滚动更新
+19
View File
@@ -0,0 +1,19 @@
FROM ubuntu
# 设置固定的项目路径
ENV WORKDIR /Open-IM-Server
ENV CMDDIR $WORKDIR/cmd
ENV CONFIG_NAME $WORKDIR/config/config.yaml
# 将可执行文件复制到目标目录
ADD ./open_im_group $WORKDIR/cmd/main
# 创建用于挂载的几个目录,添加可执行权限
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
chmod +x $WORKDIR/cmd/main
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
WORKDIR $CMDDIR
CMD ./main
+119
View File
@@ -0,0 +1,119 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
name: sdk-server-ingress
spec:
rules:
- host: sdk-server.openim.xxx.com
http:
paths:
- backend:
service:
name: sdk-server
port:
number: 10003
path: /
pathType: Prefix
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
name: msg-gateway-ingress
spec:
rules:
- host: msg-gateway.openim.xxx.com
http:
paths:
- backend:
service:
name: msg-gateway
port:
number: 10001
path: /
pathType: Prefix
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/Access-Control-Allow-Origin: '*'
nginx.ingress.kubernetes.io/cors-allow-headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,x-auth-token,Pagination
nginx.ingress.kubernetes.io/cors-allow-methods: 'PUT, GET, POST, OPTIONS'
nginx.ingress.kubernetes.io/cors-allow-origin: '*'
nginx.ingress.kubernetes.io/enable-cors: 'true'
nginx.ingress.kubernetes.io/service-weight: ''
name: api-ingress
spec:
rules:
- host: api.openim.xxx.com
http:
paths:
- backend:
service:
name: api
port:
number: 10002
path: /
pathType: Prefix
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/Access-Control-Allow-Origin: '*'
nginx.ingress.kubernetes.io/cors-allow-headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,x-auth-token,Pagination
nginx.ingress.kubernetes.io/cors-allow-methods: 'PUT, GET, POST, OPTIONS'
nginx.ingress.kubernetes.io/cors-allow-origin: '*'
nginx.ingress.kubernetes.io/enable-cors: 'true'
nginx.ingress.kubernetes.io/service-weight: ''
name: demo-ingress
spec:
rules:
- host: demo.openim.xxx.com
http:
paths:
- backend:
service:
name: demo
port:
number: 10004
path: /
pathType: Prefix
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/Access-Control-Allow-Origin: '*'
nginx.ingress.kubernetes.io/cors-allow-headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,x-auth-token,Pagination
nginx.ingress.kubernetes.io/cors-allow-methods: 'PUT, GET, POST, OPTIONS'
nginx.ingress.kubernetes.io/cors-allow-origin: '*'
nginx.ingress.kubernetes.io/enable-cors: 'true'
nginx.ingress.kubernetes.io/service-weight: ''
name: cms-api-ingress
spec:
rules:
- host: cms-api.openim.xxx.com
http:
paths:
- backend:
service:
name: cms-api
port:
number: 10006
path: /
pathType: Prefix
+100
View File
@@ -0,0 +1,100 @@
#### openIM k8s部署文档
### 1. 修改配置文件
在Open-IM-SERVER根目录下修改config/config.yaml配置文件, 请确保以下修改的所有地址必须保证k8s pod能够访问
1. 修改ETCD配置为自己的ETCD ip地址, 最好和k8s本身使用的ETCD分开
2. 修改MySQL配置
3. 修改Mongo配置
4. 修改Redis配置
5. 修改Kafka配置
6. 将rpcRegisterIP修改为空, 此地址为每个rpc注册到ETCD的地址, 置空每个rpc将会将pod地址注册到ETCD, 才能正确rpc请求(重要)
7. 如果使用minio作为对象存储, 还需要修改minio的地址
8. 其他如果使用离线推送,需要修改push离线推送配置
9. 修改demo中的imAPIURL字段为openIM api的ingress或者service地址, 需要让demo的pod能正确请求到(重要)
10. 其他非必须配置修改, 如短信,推送等
### 2. 项目根目录创建im configMap到k8s openim namespace
1. 为open-IM项目创建单独命名空间
```
kubectl create namespace openim
```
2. 在项目根目录通过config/config.yaml
```
kubectl -n openim create configmap config --from-file=config/config.yaml
kubectl -n openim create configmap usualConfig --from-file=config/usualConfig.yaml
```
查看configmap
```
kubectl -n openim get configmap
```
### 3(可选). 修改每个deployment.yml
每个rpc的deployment在Open-IM-SERVER根目录deploy_k8s下
给需要调度的node打上标签
```
kubectl get nodes
kubectl label node k8s-node1 role=openIMworker
```
在deployment的spec.template.spec加上
```
nodeSelector:
role: openIMworker
```
创建资源清单时添加上nodeSelector属性对应即可,
修改每种服务数量,建议至少每种2个rpc。
如果修改了config/config.yaml某些配置比如端口,同时需要修改对应deployment端口和ingress端口
### 4. 修改ingress.yaml配置文件
1. 需要安装ingress controller, 这里使用的是ingress-nginx, 使用其他类型的ingress controller需要更改ingress.class, 将host改为自己部署服务的host
### 5. 执行./kubectl_start.sh脚本
1. 脚本给予可执行权限
```
chmod +x ./kubectl_start.sh ./kubectl_stop.sh
```
2. 启动k8s service和deployment
```
./kubectl_start.sh
```
3. 启动k8s ingress
```
kubectl -n openim apply -f ingress.yaml
```
kubectl 启动所有deployment, services, ingress
### 6. 查看k8s deployment service ingress状态
```
kubectl -n openim get services
kubectl -n openim get deployment
kubectl -n openim get ingress
kubectl -n openim get pods
```
检测服务可达
```
telnet msg-gateway.openim.xxx.com {{your_ingress_port}}
telnet sdk-server.openim.xxx.com {{your_ingress_port}}
telnet api.openim.xxx.com {{your_ingress_port}}
telnet cms-api.openim.xxx.com {{your_ingress_port}}
telnet demo.openim.xxx.com {{your_ingress_port}}
```
#### openIM k8s更新
1. 暂存配置文件,拉取代码
```
git stash push config/config.yaml
git pull
```
2. 合并配置文件, 解决冲突
```
git stash pop
```
3. 重新生成configmap
```
kubectl -n openim create configmap config --from-file=config/config.yaml
```
4.修改所有deployment文件的spec.template.spec.image 改为新版本后在/deploy_k8s下重新执行
```
./kubectl_stop.sh
./kubectl_start.sh
```
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
source ./path_info.cfg
#mkdir -p /db/sdk #path for jssdk sqlite
for i in ${service[*]}
do
kubectl -n openim apply -f ./${i}/deployment.yaml
done
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
service=(
#api service file
api
cms-api
#rpc service file
user
friend
group
auth
admin-cms
office
organization
conversation
cache
msg-gateway
msg-transfer
msg
push
sdk-server
demo
)
for i in ${service[*]}
do
kubectl -n openim delete deployment "${i}-deployment"
done
kubectl -n openim delete service api
kubectl -n openim delete service cms-api
kubectl -n openim delete service sdk-server
kubectl -n openim delete service msg-gateway
kubectl -n openim delete service demo
echo done
+42
View File
@@ -0,0 +1,42 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: msg-deployment
spec:
selector:
matchLabels:
app: msg # 选择这个指定标签执行
replicas: 1 # 运行pod数量
template:
metadata:
labels:
app: msg # 标签
spec:
containers:
- name: msg
image: openim/msg:v2.3.4
# imagePullPolicy: Always
ports:
- containerPort: 10130
volumeMounts:
- name: config
mountPath: /Open-IM-Server/config
readOnly: true
- name: usualConfig
mountPath: /Open-IM-Server/config
readOnly: true
env:
- name: CONFIG_NAME
value: "/Open-IM-Server"
- name: USUAL_CONFIG_NAME
value: "/Open-IM-Server"
volumes:
- name: config
configMap:
name: openim-config
- name: usualConfig
configMap:
name: openim-usualConfig
strategy: #更新策略
type: RollingUpdate # 滚动更新
+20
View File
@@ -0,0 +1,20 @@
FROM ubuntu
# 设置固定的项目路径
ENV WORKDIR /Open-IM-Server
ENV CMDDIR $WORKDIR/cmd
ENV CONFIG_NAME $WORKDIR/config/config.yaml
# 将可执行文件复制到目标目录
ADD ./open_im_msg $WORKDIR/cmd/main
# 创建用于挂载的几个目录,添加可执行权限
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
chmod +x $WORKDIR/cmd/main
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
WORKDIR $CMDDIR
CMD ./main
+61
View File
@@ -0,0 +1,61 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: msg-gateway-deployment
spec:
selector:
matchLabels:
app: msg-gateway # 选择这个指定标签执行
replicas: 1 # 运行pod数量
template:
metadata:
labels:
app: msg-gateway # 标签
spec:
containers:
- name: msg-gateway
image: openim/msg_gateway:v2.3.4
# imagePullPolicy: Always
ports:
- name: rpc-port
containerPort: 10140
- name: ws-port
containerPort: 10001
volumeMounts:
- name: config
mountPath: /Open-IM-Server/config
readOnly: true
- name: usualConfig
mountPath: /Open-IM-Server/config
readOnly: true
env:
- name: CONFIG_NAME
value: "/Open-IM-Server"
- name: USUAL_CONFIG_NAME
value: "/Open-IM-Server"
volumes:
- name: config
configMap:
name: openim-config
- name: usualConfig
configMap:
name: openim-usualConfig
strategy: #更新策略
type: RollingUpdate # 滚动更新
---
apiVersion: v1
kind: Service
metadata:
name: msg-gateway
spec:
ports:
- name: msg-gateway-port
protocol: TCP
port: 10001
targetPort: ws-port
selector:
app: msg-gateway
type: NodePort
@@ -0,0 +1,19 @@
FROM ubuntu
# 设置固定的项目路径
ENV WORKDIR /Open-IM-Server
ENV CMDDIR $WORKDIR/cmd
ENV CONFIG_NAME $WORKDIR/config/config.yaml
# 将可执行文件复制到目标目录
ADD ./open_im_msg_gateway $WORKDIR/cmd/main
# 创建用于挂载的几个目录,添加可执行权限
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
chmod +x $WORKDIR/cmd/main
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
WORKDIR $CMDDIR
CMD ./main
+40
View File
@@ -0,0 +1,40 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: msg-transfer-deployment
spec:
selector:
matchLabels:
app: msg-transfer # 选择这个指定标签执行
replicas: 1 # 运行pod数量
template:
metadata:
labels:
app: msg-transfer # 标签
spec:
containers:
- name: msg-transfer
image: openim/msg_transfer:v2.3.4
# imagePullPolicy: Always
volumeMounts:
- name: config
mountPath: /Open-IM-Server/config
readOnly: true
- name: usualConfig
mountPath: /Open-IM-Server/config
readOnly: true
env:
- name: CONFIG_NAME
value: "/Open-IM-Server"
- name: USUAL_CONFIG_NAME
value: "/Open-IM-Server"
volumes:
- name: config
configMap:
name: openim-config
- name: usualConfig
configMap:
name: openim-usualConfig
strategy: #更新策略
type: RollingUpdate # 滚动更新
@@ -0,0 +1,19 @@
FROM ubuntu
# 设置固定的项目路径
ENV WORKDIR /Open-IM-Server
ENV CMDDIR $WORKDIR/cmd
ENV CONFIG_NAME $WORKDIR/config/config.yaml
# 将可执行文件复制到目标目录
ADD ./open_im_msg_transfer $WORKDIR/cmd/main
# 创建用于挂载的几个目录,添加可执行权限
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
chmod +x $WORKDIR/cmd/main
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
WORKDIR $CMDDIR
CMD ./main
+42
View File
@@ -0,0 +1,42 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: office-deployment
spec:
selector:
matchLabels:
app: office # 选择这个指定标签执行
replicas: 1 # 运行pod数量
template:
metadata:
labels:
app: office # 标签
spec:
containers:
- name: office
image: openim/office:v2.3.4
# imagePullPolicy: Always
ports:
- containerPort: 10210
volumeMounts:
- name: config
mountPath: /Open-IM-Server/config
readOnly: true
- name: usualConfig
mountPath: /Open-IM-Server/config
readOnly: true
env:
- name: CONFIG_NAME
value: "/Open-IM-Server"
- name: USUAL_CONFIG_NAME
value: "/Open-IM-Server"
volumes:
- name: config
configMap:
name: openim-config
- name: usualConfig
configMap:
name: openim-usualConfig
strategy: #更新策略
type: RollingUpdate # 滚动更新
+20
View File
@@ -0,0 +1,20 @@
FROM ubuntu
# 设置固定的项目路径
ENV WORKDIR /Open-IM-Server
ENV CMDDIR $WORKDIR/cmd
ENV CONFIG_NAME $WORKDIR/config/config.yaml
# 将可执行文件复制到目标目录
ADD ./open_im_office $WORKDIR/cmd/main
# 创建用于挂载的几个目录,添加可执行权限
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
chmod +x $WORKDIR/cmd/main
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
WORKDIR $CMDDIR
CMD ./main
+19
View File
@@ -0,0 +1,19 @@
#/bin/sh
service=(
#api service file
api
cmsapi
#rpc service file
user
friend
group
auth
admincms
office
conversation
msggateway
msgtransfer
msg
push
sdkserver
)
+42
View File
@@ -0,0 +1,42 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: push-deployment
spec:
selector:
matchLabels:
app: push # 选择这个指定标签执行
replicas: 1 # 运行pod数量
template:
metadata:
labels:
app: push # 标签
spec:
containers:
- name: push
image: openim/push:v2.3.4
# imagePullPolicy: Always
ports:
- containerPort: 10170
volumeMounts:
- name: config
mountPath: /Open-IM-Server/config
readOnly: true
- name: usualConfig
mountPath: /Open-IM-Server/config
readOnly: true
env:
- name: CONFIG_NAME
value: "/Open-IM-Server"
- name: USUAL_CONFIG_NAME
value: "/Open-IM-Server"
volumes:
- name: config
configMap:
name: openim-config
- name: usualConfig
configMap:
name: openim-usualConfig
strategy: #更新策略
type: RollingUpdate # 滚动更新
+20
View File
@@ -0,0 +1,20 @@
FROM ubuntu
# 设置固定的项目路径
ENV WORKDIR /Open-IM-Server
ENV CMDDIR $WORKDIR/cmd
ENV CONFIG_NAME $WORKDIR/config/config.yaml
# 将可执行文件复制到目标目录
ADD ./open_im_push $WORKDIR/cmd/main
# 创建用于挂载的几个目录,添加可执行权限
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
chmod +x $WORKDIR/cmd/main
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
WORKDIR $CMDDIR
CMD ./main
+57
View File
@@ -0,0 +1,57 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: sdk-server-deployment
spec:
selector:
matchLabels:
app: sdk-server # 选择这个指定标签执行
replicas: 1 # 运行pod数量
template:
metadata:
labels:
app: sdk-server # 标签
spec:
containers:
- name: sdk-server
image: openim/sdk_server:v2.3.4
# imagePullPolicy: Always
ports:
- containerPort: 10003
volumeMounts:
- name: config
mountPath: /Open-IM-Server/config
readOnly: true
- name: local-db
mountPath: /db/sdk
env:
- name: CONFIG_NAME
value: "/Open-IM-Server"
command: ["/Open-IM-Server/main"]
args: ["-openIM_ws_address", "ws_addr", "-sdkws_port", "10003", "-openIM_api_address", "api_address", "-openIM_log_level", "6"]
volumes:
- name: config
configMap:
name: openim-config
- name: local-db
hostPath:
path: /db/sdk
strategy: #更新策略
type: RollingUpdate # 滚动更新
---
apiVersion: v1
kind: Service
metadata:
name: sdk-server
spec:
ports:
- name: sdk-server-port
protocol: TCP
port: 10003
targetPort: 10003
selector:
app: sdk-server
type: NodePort
+18
View File
@@ -0,0 +1,18 @@
FROM ubuntu
# 设置固定的项目路径
ENV WORKDIR /Open-IM-Server
ENV CMDDIR $WORKDIR/cmd
ENV CONFIG_NAME $WORKDIR/config/config.yaml
# 将可执行文件复制到目标目录
ADD ./open_im_sdk_server $WORKDIR/main
# 创建用于挂载的几个目录,添加可执行权限
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
chmod +x $WORKDIR/main
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script","/Open-IM-Server/db/sdk"]
WORKDIR $CMDDIR
CMD ./main
+40
View File
@@ -0,0 +1,40 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: user-deployment
spec:
selector:
matchLabels:
app: user # 选择这个指定标签执行
replicas: 1 # 运行pod数量
template:
metadata:
labels:
app: user # 标签
spec:
containers:
- name: user
image: openim/user:v2.3.4
# imagePullPolicy: Always
volumeMounts:
- name: config
mountPath: /Open-IM-Server/config
readOnly: true
- name: usualConfig
mountPath: /Open-IM-Server/config
readOnly: true
env:
- name: CONFIG_NAME
value: "/Open-IM-Server"
- name: USUAL_CONFIG_NAME
value: "/Open-IM-Server"
volumes:
- name: config
configMap:
name: openim-config
- name: usualConfig
configMap:
name: openim-usualConfig
strategy: #更新策略
type: RollingUpdate # 滚动更新
+19
View File
@@ -0,0 +1,19 @@
FROM ubuntu
# 设置固定的项目路径
ENV WORKDIR /Open-IM-Server
ENV CMDDIR $WORKDIR/cmd
ENV CONFIG_NAME $WORKDIR/config/config.yaml
# 将可执行文件复制到目标目录
ADD ./open_im_user $WORKDIR/cmd/main
# 创建用于挂载的几个目录,添加可执行权限
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/script && \
chmod +x $WORKDIR/cmd/main
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script"]
WORKDIR $CMDDIR
CMD ./main