mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-05 20:11:14 +08:00
feat: refactoring main
Signed-off-by: kubbot & kubecub <3293172751ysy@gmail.com>
This commit is contained in:
parent
6f3d17b927
commit
2b6f382c4a
@ -1,6 +0,0 @@
|
||||
# 先设为忽略所有内容
|
||||
**/**
|
||||
|
||||
|
||||
# 然后逐个排除
|
||||
!open_im_*
|
158
deploy/Makefile
158
deploy/Makefile
@ -1,158 +0,0 @@
|
||||
|
||||
GREEN_PREFIX="\033[32m"
|
||||
COLOR_SUFFIX="\033[0m"
|
||||
SKY_BLUE_PREFIX="\033[36m"
|
||||
|
||||
|
||||
# 编译所有需要的组件源码
|
||||
win-build-all:
|
||||
go env -w GOOS=linux
|
||||
|
||||
make build-api && make build-msg-gateway && make build-msg-transfer && make build-push && make build-timer-task
|
||||
make build-rpc-user && make build-rpc-friend && make build-rpc-group && make build-rpc-msg && make build-rpc-auth
|
||||
make build-demo
|
||||
|
||||
go env -w GOOS=windows
|
||||
|
||||
# 编译 open_im_api
|
||||
build-api:
|
||||
echo -e ${GREEN_PREFIX} "open_im_api building..." ${COLOR_SUFFIX}
|
||||
go build -ldflags="-w -s" -o open_im_api ../cmd/open_im_api/main.go
|
||||
echo -e ${GREEN_PREFIX} "open_im_api build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 编译 open_im_msg_gateway
|
||||
build-msg-gateway:
|
||||
echo -e ${GREEN_PREFIX} "open_im_msg_gateway building..." ${COLOR_SUFFIX}
|
||||
go build -ldflags="-w -s" -o open_im_msg_gateway ../cmd/open_im_msg_gateway/main.go
|
||||
echo -e ${GREEN_PREFIX} "open_im_msg_gateway build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 编译 open_im_msg_transfer
|
||||
build-msg-transfer:
|
||||
echo -e ${GREEN_PREFIX} "open_im_msg_transfer building..." ${COLOR_SUFFIX}
|
||||
go build -ldflags="-w -s" -o open_im_msg_transfer ../cmd/open_im_msg_transfer/main.go
|
||||
echo -e ${GREEN_PREFIX} "open_im_msg_transfer build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 编译 open_im_push
|
||||
build-push:
|
||||
echo -e ${GREEN_PREFIX} "open_im_push building..." ${COLOR_SUFFIX}
|
||||
go build -ldflags="-w -s" -o open_im_push ../cmd/open_im_push/main.go
|
||||
echo -e ${GREEN_PREFIX} "open_im_push build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 编译 open_im_timer_task
|
||||
build-timer-task:
|
||||
echo -e ${GREEN_PREFIX} "open_im_timer_task building..." ${COLOR_SUFFIX}
|
||||
go build -ldflags="-w -s" -o open_im_timer_task ../cmd/open_im_timer_task/main.go
|
||||
echo -e ${GREEN_PREFIX} "open_im_timer_task build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 编译 build-rpc-user
|
||||
build-rpc-user:
|
||||
echo -e ${SKY_BLUE_PREFIX} "open_im_rpc_user building..." ${COLOR_SUFFIX}
|
||||
go build -ldflags="-w -s" -o open_im_rpc_user ../cmd/rpc/open_im_user/main.go
|
||||
echo -e ${SKY_BLUE_PREFIX} "open_im_rpc_user build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 编译 build-rpc-friend
|
||||
build-rpc-friend:
|
||||
echo -e ${SKY_BLUE_PREFIX} "open_im_rpc_friend building..." ${COLOR_SUFFIX}
|
||||
go build -ldflags="-w -s" -o open_im_rpc_friend ../cmd/rpc/open_im_friend/main.go
|
||||
echo -e ${SKY_BLUE_PREFIX} "open_im_rpc_friend build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 编译 build-rpc-group
|
||||
build-rpc-group:
|
||||
echo -e ${SKY_BLUE_PREFIX} "open_im_rpc_group building..." ${COLOR_SUFFIX}
|
||||
go build -ldflags="-w -s" -o open_im_rpc_group ../cmd/rpc/open_im_group/main.go
|
||||
echo -e ${SKY_BLUE_PREFIX} "open_im_rpc_group build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 编译 build-rpc-auth
|
||||
build-rpc-auth:
|
||||
echo -e ${SKY_BLUE_PREFIX} "open_im_rpc_auth building..." ${COLOR_SUFFIX}
|
||||
go build -ldflags="-w -s" -o open_im_rpc_auth ../cmd/rpc/open_im_auth/main.go
|
||||
echo -e ${SKY_BLUE_PREFIX} "open_im_rpc_auth build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 编译 build-rpc-msg
|
||||
build-rpc-msg:
|
||||
echo -e ${SKY_BLUE_PREFIX} "open_im_rpc_msg building..." ${COLOR_SUFFIX}
|
||||
go build -ldflags="-w -s" -o open_im_rpc_msg ../cmd/rpc/open_im_msg/main.go
|
||||
echo -e ${SKY_BLUE_PREFIX} "open_im_rpc_msg build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 编译 open_im_demo
|
||||
build-demo:
|
||||
echo -e ${SKY_BLUE_PREFIX} "open_im_demo building..." ${COLOR_SUFFIX}
|
||||
go build -ldflags="-w -s" -o open_im_demo ../cmd/open_im_demo/main.go
|
||||
echo -e ${SKY_BLUE_PREFIX} "open_im_demo build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 打包所有组件为镜像
|
||||
image-all:
|
||||
make image-api && make image-msg-gateway && make image-msg-transfer & make image-push && make image-timer-task
|
||||
make image-rpc-user && make image-rpc-friend && make image-rpc-group && make image-rpc-msg && make image-rpc-auth
|
||||
make image-demo
|
||||
|
||||
# 打包 open_im_api
|
||||
image-api:
|
||||
echo -e ${GREEN_PREFIX} "IMAGE:openim/api building..." ${COLOR_SUFFIX}
|
||||
docker build -t openim/api:latest -f ./dockerfiles/Dockerfile.api .
|
||||
echo -e ${GREEN_PREFIX} "IMAGE:openim/api build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 打包 open_im_msg_gateway
|
||||
image-msg-gateway:
|
||||
echo -e ${GREEN_PREFIX} "IMAGE:openim/msg_gateway building..." ${COLOR_SUFFIX}
|
||||
docker build -t openim/msg_gateway:latest -f ./dockerfiles/Dockerfile.msg_gateway .
|
||||
echo -e ${GREEN_PREFIX} "IMAGE:openim/msg_gateway build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 打包 open_im_msg_transfer
|
||||
image-msg-transfer:
|
||||
echo -e ${GREEN_PREFIX} "IMAGE:openim/msg_transfer building..." ${COLOR_SUFFIX}
|
||||
docker build -t openim/msg_transfer:latest -f ./dockerfiles/Dockerfile.msg_transfer .
|
||||
echo -e ${GREEN_PREFIX} "IMAGE:openim/msg_transfer build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 打包 open_im_push
|
||||
image-push:
|
||||
echo -e ${GREEN_PREFIX} "IMAGE:openim/push building..." ${COLOR_SUFFIX}
|
||||
docker build -t openim/push:latest -f ./dockerfiles/Dockerfile.push .
|
||||
echo -e ${GREEN_PREFIX} "IMAGE:openim/push build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 打包 open_im_timer_task
|
||||
image-timer-task:
|
||||
echo -e ${GREEN_PREFIX} "IMAGE:openim/timer_task building..." ${COLOR_SUFFIX}
|
||||
docker build -t openim/timer_task:latest -f ./dockerfiles/Dockerfile.timer_task .
|
||||
echo -e ${GREEN_PREFIX} "IMAGE:openim/timer_task build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 打包 build-rpc-user
|
||||
image-rpc-user:
|
||||
echo -e ${SKY_BLUE_PREFIX} "IMAGE:openim/rpc_user building..." ${COLOR_SUFFIX}
|
||||
docker build -t openim/rpc_user:latest -f ./dockerfiles/Dockerfile.rpc_user .
|
||||
echo -e ${SKY_BLUE_PREFIX} "IMAGE:openim/rpc_user build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 打包 build-rpc-friend
|
||||
image-rpc-friend:
|
||||
echo -e ${SKY_BLUE_PREFIX} "IMAGE:openim/rpc_friend building..." ${COLOR_SUFFIX}
|
||||
docker build -t openim/rpc_friend:latest -f ./dockerfiles/Dockerfile.rpc_friend .
|
||||
echo -e ${SKY_BLUE_PREFIX} "IMAGE:openim/rpc_friend build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 打包 build-rpc-group
|
||||
image-rpc-group:
|
||||
echo -e ${SKY_BLUE_PREFIX} "IMAGE:openim/rpc_group building..." ${COLOR_SUFFIX}
|
||||
docker build -t openim/rpc_group:latest -f ./dockerfiles/Dockerfile.rpc_group .
|
||||
echo -e ${SKY_BLUE_PREFIX} "IMAGE:openim/rpc_group build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 打包 build-rpc-auth
|
||||
image-rpc-auth:
|
||||
echo -e ${SKY_BLUE_PREFIX} "IMAGE:openim/rpc_auth building..." ${COLOR_SUFFIX}
|
||||
docker build -t openim/rpc_auth:latest -f ./dockerfiles/Dockerfile.rpc_auth .
|
||||
echo -e ${SKY_BLUE_PREFIX} "IMAGE:openim/rpc_auth build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 打包 build-rpc-msg
|
||||
image-rpc-msg:
|
||||
echo -e ${SKY_BLUE_PREFIX} "IMAGE:openim/rpc_msg building..." ${COLOR_SUFFIX}
|
||||
docker build -t openim/rpc_msg:latest -f ./dockerfiles/Dockerfile.rpc_msg .
|
||||
echo -e ${SKY_BLUE_PREFIX} "IMAGE:openim/rpc_msg build ok" ${COLOR_SUFFIX}
|
||||
|
||||
# 打包 open_im_demo
|
||||
image-demo:
|
||||
echo -e ${SKY_BLUE_PREFIX} "IMAGE:openim/demo building..." ${COLOR_SUFFIX}
|
||||
docker build -t openim/demo:latest -f ./dockerfiles/Dockerfile.demo .
|
||||
echo -e ${SKY_BLUE_PREFIX} "IMAGE:openim/demo build ok" ${COLOR_SUFFIX}
|
||||
|
||||
.PHONY: win-build-all build-api build-msg-gateway build-msg-transfer build-push
|
||||
build-timer-task build-rpc-user build-rpc-friend build-rpc-group build-rpc-msg build-demo
|
||||
image-all image-api image-msg-gateway image-msg-transfer image-push
|
||||
image-timer-task image-rpc-user image-rpc-friend image-rpc-group image-rpc-msg image-demo
|
@ -1,183 +0,0 @@
|
||||
# The class cannot be named by Pascal or camel case.
|
||||
# If it is not used, the corresponding structure will not be set,
|
||||
# and it will not be read naturally.
|
||||
serverversion: 1.0.3
|
||||
#---------------Infrastructure configuration---------------------#
|
||||
etcd:
|
||||
etcdSchema: openIM
|
||||
etcdAddr: [ openim_etcd:2379 ]
|
||||
|
||||
mysql:
|
||||
dbMysqlAddress: [ openim_mysql:3306 ] # openim_mysql 是对应的mysql服务的host
|
||||
dbMysqlUserName: openIM
|
||||
dbMysqlPassword: openIM
|
||||
dbMysqlDatabaseName: openIM
|
||||
dbTableName: eMsg
|
||||
dbMsgTableNum: 1
|
||||
dbMaxOpenConns: 20
|
||||
dbMaxIdleConns: 10
|
||||
dbMaxLifeTime: 120
|
||||
|
||||
mongo:
|
||||
dbUri: ""#当dbUri值不为空则直接使用该值
|
||||
dbAddress: [ openim_mongo:27017 ]
|
||||
dbDirect: false
|
||||
dbTimeout: 10
|
||||
dbDatabase: openIM
|
||||
dbSource: admin
|
||||
dbUserName:
|
||||
dbPassword:
|
||||
dbMaxPoolSize: 20
|
||||
dbRetainChatRecords: 7
|
||||
|
||||
redis:
|
||||
dbAddress: openim_redis:6379
|
||||
dbMaxIdle: 128
|
||||
dbMaxActive: 0
|
||||
dbIdleTimeout: 120
|
||||
dbPassWord: openIM
|
||||
|
||||
kafka:
|
||||
ws2mschat:
|
||||
addr: [ openim_kafka:9092 ]
|
||||
topic: "ws2ms_chat"
|
||||
ms2pschat:
|
||||
addr: [ openim_kafka:9092 ]
|
||||
topic: "ms2ps_chat"
|
||||
consumergroupid:
|
||||
msgToMongo: mongo
|
||||
msgToMySql: mysql
|
||||
msgToPush: push
|
||||
|
||||
|
||||
|
||||
#---------------Internal service configuration---------------------#
|
||||
|
||||
# The service ip default is empty,
|
||||
# automatically obtain the machine's valid network card ip as the service ip,
|
||||
# otherwise the configuration ip is preferred
|
||||
serverip: 0.0.0.0
|
||||
|
||||
# endpoints 内部组件间访问的端点host名称,访问时,可以内部直接访问 host:port 来访问
|
||||
# 新增的这一段配置节,主要是位了注册到etcd时,可以使用同一network下的容器名(host)来访问不同的容器,拆分到不同容器后原来全部使用serverip的形式不能用了
|
||||
endpoints:
|
||||
api: openim_api
|
||||
push: openim_push
|
||||
msg_gateway: openim_msg_gateway
|
||||
rpc_auth: openim_rpc_auth
|
||||
rpc_friend: openim_rpc_friend
|
||||
rpc_group: openim_rpc_group
|
||||
rpc_msg: openim_rpc_msg
|
||||
rpc_user: openim_rpc_user
|
||||
|
||||
api:
|
||||
openImApiPort: [ 10000 ]
|
||||
sdk:
|
||||
openImSdkWsPort: [ 30000 ]
|
||||
cmsapi:
|
||||
openImCmsApiPort: [ 8000 ]
|
||||
|
||||
credential:
|
||||
tencent:
|
||||
appID:
|
||||
region:
|
||||
bucket:
|
||||
secretID:
|
||||
secretKey:
|
||||
|
||||
|
||||
rpcport:
|
||||
openImUserPort: [ 10100 ]
|
||||
openImFriendPort: [ 10200 ]
|
||||
openImOfflineMessagePort: [ 10300]
|
||||
openImOnlineRelayPort: [ 10400 ]
|
||||
openImGroupPort: [ 10500 ]
|
||||
openImAuthPort: [ 10600 ]
|
||||
openImPushPort: [ 10700 ]
|
||||
openImStatisticsPort: [ 10800 ]
|
||||
openImMessageCmsPort: [ 10900 ]
|
||||
openImAdminCmsPort: [ 11000 ]
|
||||
|
||||
rpcregistername:
|
||||
openImUserName: User
|
||||
openImFriendName: Friend
|
||||
openImOfflineMessageName: OfflineMessage
|
||||
openImPushName: Push
|
||||
openImOnlineMessageRelayName: OnlineMessageRelay
|
||||
openImGroupName: Group
|
||||
openImAuthName: Auth
|
||||
|
||||
log:
|
||||
storageLocation: ../logs/
|
||||
rotationTime: 24
|
||||
remainRotationCount: 5
|
||||
remainLogLevel: 6
|
||||
elasticSearchSwitch: false
|
||||
elasticSearchAddr: [ 127.0.0.1:9201 ]
|
||||
elasticSearchUser: ""
|
||||
elasticSearchPassword: ""
|
||||
|
||||
modulename:
|
||||
longConnSvrName: msg_gateway
|
||||
msgTransferName: msg_transfer
|
||||
pushName: push
|
||||
|
||||
longconnsvr:
|
||||
openImWsPort: [ 17778 ]
|
||||
websocketMaxConnNum: 10000
|
||||
websocketMaxMsgLen: 4096
|
||||
websocketTimeOut: 10
|
||||
|
||||
push:
|
||||
tpns:
|
||||
ios:
|
||||
accessID:
|
||||
secretKey:
|
||||
android:
|
||||
accessID:
|
||||
secretKey:
|
||||
jpns:
|
||||
appKey:
|
||||
masterSecret:
|
||||
pushUrl:
|
||||
pushIntent:
|
||||
manager:
|
||||
appManagerUid: ["openIM123456","openIM654321"]
|
||||
secrets: ["openIM1","openIM2"]
|
||||
|
||||
secret: tuoyun
|
||||
|
||||
multiloginpolicy: 1
|
||||
|
||||
#token config
|
||||
tokenpolicy:
|
||||
accessSecret: "open_im_server"
|
||||
# Token effective time day as a unit
|
||||
accessExpire: 7
|
||||
|
||||
messagecallback:
|
||||
callbackSwitch: false
|
||||
callbackUrl: "http://www.xxx.com/msg/judge"
|
||||
#TimeOut use second as unit
|
||||
callbackTimeOut: 10
|
||||
|
||||
|
||||
#---------------demo configuration---------------------#
|
||||
#The following configuration items are applied to openIM Demo configuration
|
||||
demoswitch: true
|
||||
demo:
|
||||
openImDemoPort: [ 42233 ]
|
||||
alismsverify:
|
||||
accessKeyId:
|
||||
accessKeySecret:
|
||||
signName:
|
||||
verificationCodeTemplateCode:
|
||||
superCode: 666666
|
||||
mail:
|
||||
title:
|
||||
senderMail:
|
||||
senderAuthorizationCode:
|
||||
smtpAddr:
|
||||
smtpPort:
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
FROM alpine:3.13
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /app
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_api $WORKDIR/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
chmod +x $WORKDIR/main
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./main
|
@ -1,16 +0,0 @@
|
||||
FROM alpine:3.13
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /app
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_demo $WORKDIR/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
chmod +x $WORKDIR/main
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./main
|
@ -1,16 +0,0 @@
|
||||
FROM alpine:3.13
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /app
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_msg_gateway $WORKDIR/main
|
||||
|
||||
# 创建用于挂载的几个目录,重命名可执行文件为 main,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
chmod +x $WORKDIR/main
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./main
|
@ -1,16 +0,0 @@
|
||||
FROM alpine:3.13
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /app
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_msg_transfer $WORKDIR/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
chmod +x $WORKDIR/main
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./main
|
@ -1,16 +0,0 @@
|
||||
FROM alpine:3.13
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /app
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_push $WORKDIR/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
chmod +x $WORKDIR/main
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./main
|
@ -1,16 +0,0 @@
|
||||
FROM alpine:3.13
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /app
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_rpc_auth $WORKDIR/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
chmod +x $WORKDIR/main
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./main
|
@ -1,16 +0,0 @@
|
||||
FROM alpine:3.13
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /app
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_rpc_friend $WORKDIR/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
chmod +x $WORKDIR/main
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./main
|
@ -1,16 +0,0 @@
|
||||
FROM alpine:3.13
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /app
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_rpc_group $WORKDIR/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
chmod +x $WORKDIR/main
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./main
|
@ -1,16 +0,0 @@
|
||||
FROM alpine:3.13
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /app
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_rpc_msg $WORKDIR/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
chmod +x $WORKDIR/main
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./main
|
@ -1,16 +0,0 @@
|
||||
FROM alpine:3.13
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /app
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_rpc_user $WORKDIR/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
chmod +x $WORKDIR/main
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./main
|
@ -1,16 +0,0 @@
|
||||
FROM alpine:3.13
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /app
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_timer_task $WORKDIR/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
chmod +x $WORKDIR/main
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./main
|
101
deploy/env.yaml
101
deploy/env.yaml
@ -1,101 +0,0 @@
|
||||
version: "3.7"
|
||||
networks:
|
||||
openim:
|
||||
external: true
|
||||
|
||||
services:
|
||||
mysql:
|
||||
networks:
|
||||
- openim
|
||||
image: mysql:5.7
|
||||
# ports:
|
||||
# #- 13306:3306
|
||||
# - 23306:33060
|
||||
container_name: openim_mysql
|
||||
volumes:
|
||||
- ./components/mysql/data:/var/lib/mysql
|
||||
- /etc/localtime:/etc/localtime
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: openIM
|
||||
restart: always
|
||||
|
||||
mongodb:
|
||||
networks:
|
||||
- openim
|
||||
image: mongo:4.4.5-bionic
|
||||
# ports:
|
||||
# - 37017:27017
|
||||
container_name: openim_mongo
|
||||
volumes:
|
||||
- ./components/mongodb/data/db:/data/db
|
||||
- ./components/mongodb/data/logs:/data/logs
|
||||
- ./components/mongodb/data/conf:/etc/mongo
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
# - MONGO_INITDB_ROOT_USERNAME=openIM
|
||||
# - MONGO_INITDB_ROOT_PASSWORD=openIM
|
||||
restart: always
|
||||
|
||||
redis:
|
||||
networks:
|
||||
- openim
|
||||
image: redis:6.2.4-alpine
|
||||
# ports:
|
||||
# - 16379:6379
|
||||
container_name: openim_redis
|
||||
volumes:
|
||||
- ./components/redis/data:/data
|
||||
#redis config file
|
||||
#- ./components/redis/config/redis.conf:/usr/local/redis/config/redis.conf
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
restart: always
|
||||
sysctls:
|
||||
net.core.somaxconn: 1024
|
||||
command: redis-server --requirepass openIM --appendonly yes
|
||||
|
||||
|
||||
zookeeper:
|
||||
networks:
|
||||
- openim
|
||||
image: wurstmeister/zookeeper
|
||||
# ports:
|
||||
# - 2181:2181
|
||||
container_name: openim_zookeeper
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
restart: always
|
||||
|
||||
kafka:
|
||||
networks:
|
||||
- openim
|
||||
image: wurstmeister/kafka
|
||||
container_name: openim_kafka
|
||||
restart: always
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
KAFKA_BROKER_ID: 0
|
||||
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
||||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
|
||||
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
|
||||
depends_on:
|
||||
- zookeeper
|
||||
|
||||
etcd:
|
||||
networks:
|
||||
- openim
|
||||
image: quay.io/coreos/etcd
|
||||
# ports:
|
||||
# - 2379:2379
|
||||
# - 2380:2380
|
||||
container_name: openim_etcd
|
||||
volumes:
|
||||
- /etc/timezone:/etc/timezone
|
||||
- /etc/localtime:/etc/localtime
|
||||
environment:
|
||||
ETCDCTL_API: 3
|
||||
restart: always
|
||||
command: /usr/local/bin/etcd --name etcd0 --data-dir /etcd-data --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380 --initial-advertise-peer-urls http://0.0.0.0:2380 --initial-cluster etcd0=http://0.0.0.0:2380 --initial-cluster-token tkn --initial-cluster-state new
|
||||
|
@ -1,223 +0,0 @@
|
||||
version: "3.7"
|
||||
networks:
|
||||
openim:
|
||||
external: true
|
||||
|
||||
services:
|
||||
api:
|
||||
networks:
|
||||
- openim
|
||||
image: openim/api
|
||||
container_name: openim_api
|
||||
ports:
|
||||
- 10000:10000 # API,必须开
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
# Dockerfile 里定义了配置文件的路径环境变量,CONFIG_NAME,默认指向了 /app/config/config.yaml
|
||||
- ./config/config.yaml:/app/config/config.yaml
|
||||
- ./db/sdk:/app/db/sdk
|
||||
restart: always
|
||||
# depends_on:
|
||||
# - kafka
|
||||
# # - mysql
|
||||
# # - mongodb
|
||||
# - redis
|
||||
# - etcd
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "1g"
|
||||
max-file: "2"
|
||||
|
||||
msg_gateway:
|
||||
networks:
|
||||
- openim
|
||||
image: openim/msg_gateway
|
||||
container_name: openim_msg_gateway
|
||||
ports:
|
||||
- 17778:17778 # 消息,必须开
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
- ./config/config.yaml:/app/config/config.yaml
|
||||
- ./db/sdk:/app/db/sdk
|
||||
restart: always
|
||||
# depends_on:
|
||||
# - kafka
|
||||
# # - mysql
|
||||
# # - mongodb
|
||||
# - redis
|
||||
# - etcd
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "1g"
|
||||
max-file: "2"
|
||||
|
||||
msg_transfer:
|
||||
networks:
|
||||
- openim
|
||||
image: openim/msg_transfer
|
||||
container_name: openim_msg_transfer
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
- ./config/config.yaml:/app/config/config.yaml
|
||||
- ./db/sdk:/app/db/sdk
|
||||
restart: always
|
||||
# depends_on:
|
||||
# - kafka
|
||||
# # - mysql
|
||||
# # - mongodb
|
||||
# - redis
|
||||
# - etcd
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "1g"
|
||||
max-file: "2"
|
||||
|
||||
push:
|
||||
networks:
|
||||
- openim
|
||||
image: openim/push
|
||||
container_name: openim_push
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
- ./config/config.yaml:/app/config/config.yaml
|
||||
- ./db/sdk:/app/db/sdk
|
||||
restart: always
|
||||
# depends_on:
|
||||
# - kafka
|
||||
# # - mysql
|
||||
# # - mongodb
|
||||
# - redis
|
||||
# - etcd
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "1g"
|
||||
max-file: "2"
|
||||
|
||||
timer_task:
|
||||
networks:
|
||||
- openim
|
||||
image: openim/timer_task
|
||||
container_name: openim_timer_task
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
- ./config/config.yaml:/app/config/config.yaml
|
||||
- ./db/sdk:/app/db/sdk
|
||||
restart: always
|
||||
# depends_on:
|
||||
# - kafka
|
||||
# # - mysql
|
||||
# # - mongodb
|
||||
# - redis
|
||||
# - etcd
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "1g"
|
||||
max-file: "2"
|
||||
|
||||
rpc_user:
|
||||
networks:
|
||||
- openim
|
||||
image: openim/rpc_user
|
||||
container_name: openim_rpc_user
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
- ./config/config.yaml:/app/config/config.yaml
|
||||
- ./db/sdk:/app/db/sdk
|
||||
restart: always
|
||||
# depends_on:
|
||||
# - kafka
|
||||
# # - mysql
|
||||
# # - mongodb
|
||||
# - redis
|
||||
# - etcd
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "1g"
|
||||
max-file: "2"
|
||||
|
||||
rpc_friend:
|
||||
networks:
|
||||
- openim
|
||||
image: openim/rpc_friend
|
||||
container_name: openim_rpc_friend
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
- ./config/config.yaml:/app/config/config.yaml
|
||||
- ./db/sdk:/app/db/sdk
|
||||
restart: always
|
||||
# depends_on:
|
||||
# - kafka
|
||||
# # - mysql
|
||||
# # - mongodb
|
||||
# - redis
|
||||
# - etcd
|
||||
|
||||
rpc_group:
|
||||
networks:
|
||||
- openim
|
||||
image: openim/rpc_group
|
||||
container_name: openim_rpc_group
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
- ./config/config.yaml:/app/config/config.yaml
|
||||
- ./db/sdk:/app/db/sdk
|
||||
restart: always
|
||||
# depends_on:
|
||||
# - kafka
|
||||
# # - mysql
|
||||
# # - mongodb
|
||||
# - redis
|
||||
# - etcd
|
||||
|
||||
rpc_auth:
|
||||
networks:
|
||||
- openim
|
||||
image: openim/rpc_auth
|
||||
container_name: openim_rpc_auth
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
- ./config/config.yaml:/app/config/config.yaml
|
||||
- ./db/sdk:/app/db/sdk
|
||||
restart: always
|
||||
# depends_on:
|
||||
# - kafka
|
||||
# # - mysql
|
||||
# # - mongodb
|
||||
# - redis
|
||||
# - etcd
|
||||
|
||||
rpc_msg:
|
||||
networks:
|
||||
- openim
|
||||
image: openim/rpc_msg
|
||||
container_name: openim_rpc_msg
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
- ./config/config.yaml:/app/config/config.yaml
|
||||
- ./db/sdk:/app/db/sdk
|
||||
restart: always
|
||||
# depends_on:
|
||||
# - kafka
|
||||
# # - mysql
|
||||
# # - mongodb
|
||||
# - redis
|
||||
# - etcd
|
||||
|
||||
demo:
|
||||
networks:
|
||||
- openim
|
||||
image: openim/demo
|
||||
container_name: openim_demo
|
||||
ports:
|
||||
- 42233:42233
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
- ./config/config.yaml:/app/config/config.yaml
|
||||
- ./db/sdk:/app/db/sdk
|
||||
restart: always
|
@ -1,30 +0,0 @@
|
||||
|
||||
### 以docker-compose 形式单独部署
|
||||
```sh
|
||||
# 查看 ./Makefile ,先编译各个需要的源码到 ../bin
|
||||
# win-* 表示在win平台编译位linux二进制,其实就是处理了 go env -w GOOS=linux
|
||||
make win-build-all
|
||||
|
||||
# 得到各个二进制程序之后,打包为镜像
|
||||
# 目前没有处理 Open-IM-SDK-Core ,需要的话可以自己单独处理这个模块
|
||||
make image-all
|
||||
|
||||
# docker-compose.yaml 分成了两部分,一部分是openIM的镜像容器 openim.yaml,一部分是依赖的环境 env.yaml
|
||||
# 两部分使用一个外部的网络来联通,所以首先创建用到的 network
|
||||
docker network create openim --attachable=true -d bridge
|
||||
|
||||
# 处理openim组件需要的挂载目录,主要是处理config目录
|
||||
mkdir ./config
|
||||
cp ./config.example.yaml ./config/config.yaml # 修改 ./config/config.yaml 内容,比如各个依赖组件的 host
|
||||
|
||||
# 然后拉起env.yaml
|
||||
docker-compose -f ./env.yaml up -d
|
||||
|
||||
# 等env 容器全部拉起成功之后,拉起openim.yaml
|
||||
docker-compose -f ./openim.yaml up -d
|
||||
|
||||
# 查看容器运行,推荐使用下 portainer ,web查看容器情况,查看日志等等
|
||||
docker container ps -a | grep openim
|
||||
|
||||
# 正常应该是查看api,demo等的容器日志,看到gin打印的路由日志才算是成功
|
||||
```
|
@ -1,34 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: admin-cms-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: admin-cms # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: admin-cms # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: admin-cms
|
||||
image: openim/admin_cms:v2.0.10
|
||||
ports:
|
||||
- containerPort: 10200
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
|
@ -1,46 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: api-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: api # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: api # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: api
|
||||
image: openim/api:v2.0.10
|
||||
ports:
|
||||
- containerPort: 10002
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: api
|
||||
spec:
|
||||
ports:
|
||||
- name: api-port
|
||||
protocol: TCP
|
||||
port: 10002
|
||||
targetPort: 10002
|
||||
selector:
|
||||
app: api
|
@ -1,33 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: auth-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: auth # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: auth # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: auth
|
||||
image: openim/auth:v2.0.10
|
||||
ports:
|
||||
- containerPort: 10160
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
33
deploy_k8s/cache/deployment.yaml
vendored
33
deploy_k8s/cache/deployment.yaml
vendored
@ -1,33 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: cache-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cache # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cache # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: cache
|
||||
image: openim/cache:v2.0.10
|
||||
ports:
|
||||
- containerPort: 10240
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
@ -1,46 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: cms-api-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cms-api # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cms-api # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: cms-api
|
||||
image: openim/cms_api:v2.0.10
|
||||
ports:
|
||||
- containerPort: 10006
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
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
|
@ -1,35 +0,0 @@
|
||||
---
|
||||
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.0.10
|
||||
ports:
|
||||
- containerPort: 10230
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
|
@ -1,46 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: demo-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: demo # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: demo # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: demo
|
||||
image: openim/demo:v2.0.10
|
||||
ports:
|
||||
- containerPort: 10004
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: demo
|
||||
spec:
|
||||
ports:
|
||||
- name: demo
|
||||
protocol: TCP
|
||||
port: 10004
|
||||
targetPort: 10004
|
||||
selector:
|
||||
app: demo
|
@ -1,34 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: friend-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: friend # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: friend # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: friend
|
||||
image: openim/friend:v2.0.10
|
||||
ports:
|
||||
- containerPort: 10120
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
||||
|
@ -1,33 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: group-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: group # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: group # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: group
|
||||
image: openim/group:v2.0.10
|
||||
ports:
|
||||
- containerPort: 10150
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
@ -1,101 +0,0 @@
|
||||
---
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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
|
@ -1,34 +0,0 @@
|
||||
#### openIM k8s部署文档
|
||||
### 1. 修改配置文件
|
||||
在Open-IM-SERVER目录下修改config/config.yaml配置文件, 将MySQL, Kafka, MongoDB等配置修改。
|
||||
使用demo需要修改demo/imAPIURL地址 让demo能请求到im的api
|
||||
|
||||
### 2. 项目根目录创建im configMap到k8s openim namespace
|
||||
kubectl create namespace openim
|
||||
kubectl -n openim create configmap config --from-file=config/config.yaml
|
||||
openim 为im项目的namespace, 可选
|
||||
|
||||
### 3(可选). 修改每个deployment.yml
|
||||
kubectl get nodes
|
||||
kubectl label node k8s-node1 role=kube-Node
|
||||
应需要调度的node打上标签
|
||||
nodeSelector:
|
||||
node: kube-Node
|
||||
创建资源清单时添加上nodeSelector属性对应即可
|
||||
修改每种服务数量,建议至少每种2个rpc。
|
||||
|
||||
jssdk 需要在sdk_server/deployment.yaml修改启动端口等
|
||||
|
||||
### 4. 修改ingress.yaml配置文件
|
||||
|
||||
### 5. 执行./kubectl_start.sh脚本
|
||||
需要安装ingress controller
|
||||
chmod +x ./kubectl_start.sh ./kubectl_stop.sh
|
||||
./kubectl_start.sh
|
||||
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
|
@ -1,31 +0,0 @@
|
||||
service=(
|
||||
#api service file
|
||||
api
|
||||
cms_api
|
||||
#rpc service file
|
||||
user
|
||||
friend
|
||||
group
|
||||
auth
|
||||
admin_cms
|
||||
message_cms
|
||||
statistics
|
||||
office
|
||||
organization
|
||||
conversation
|
||||
cache
|
||||
msg_gateway
|
||||
transfer
|
||||
msg
|
||||
push
|
||||
sdk_server
|
||||
demo
|
||||
)
|
||||
|
||||
#mkdir -p /db/sdk #path for jssdk sqlite
|
||||
|
||||
for i in ${service[*]}
|
||||
do
|
||||
kubectl -n openim apply -f ./${i}/deployment.yaml
|
||||
done
|
||||
|
@ -1,36 +0,0 @@
|
||||
service=(
|
||||
#api service file
|
||||
api
|
||||
cms-api
|
||||
#rpc service file
|
||||
user
|
||||
friend
|
||||
group
|
||||
auth
|
||||
admin-cms
|
||||
message-cms
|
||||
statistics
|
||||
office
|
||||
organization
|
||||
conversation
|
||||
cache
|
||||
msg-gateway
|
||||
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
|
@ -1,33 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: message-cms-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: message-cms # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: message-cms # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: message-cms
|
||||
image: openim/message_cms:v2.0.10
|
||||
ports:
|
||||
- containerPort: 10190
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
@ -1,33 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: msg-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: msg # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: msg # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: msg
|
||||
image: openim/msg:v2.0.10
|
||||
ports:
|
||||
- containerPort: 10130
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
@ -1,51 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: msg-gateway-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: msg-gateway # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: msg-gateway # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: msg-gateway
|
||||
image: openim/msg_gateway:v2.0.10
|
||||
ports:
|
||||
- name: rpc-port
|
||||
containerPort: 10140
|
||||
- name: ws-port
|
||||
containerPort: 10001
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
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: demo
|
||||
|
||||
|
@ -1,33 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: office-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: office # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: office # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: office
|
||||
image: openim/office:v2.0.10
|
||||
ports:
|
||||
- containerPort: 10210
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
@ -1,33 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: organization-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: organization # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: organization # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: organization
|
||||
image: openim/organization:v2.0.10
|
||||
ports:
|
||||
- containerPort: 10220
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
@ -1,33 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: push-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: push # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: push # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: push
|
||||
image: openim/push:v2.0.10
|
||||
ports:
|
||||
- containerPort: 10170
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
@ -1,55 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sdk-server-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: sdk-server # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: sdk-server # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: sdk-server
|
||||
image: openim/sdk_server:v2.0.10
|
||||
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_api_port", "10002", "-openIM_ws_port", "10001", "-sdk_ws_port", "10003", "-openIM_log_level", "6"]
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: 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: demo
|
||||
|
||||
|
@ -1,33 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: statistics-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: statistics # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: statistics # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: statistics
|
||||
image: openim/statistics:v2.0.10
|
||||
ports:
|
||||
- containerPort: 10180
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
@ -1,31 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: transfer-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: transfer # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: transfer # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: transfer
|
||||
image: openim/transfer:v2.0.10
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
@ -1,31 +0,0 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: user-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: user # 选择这个指定标签执行
|
||||
replicas: 2 # 运行pod数量
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: user # 标签
|
||||
spec:
|
||||
containers:
|
||||
- name: user
|
||||
image: openim/user:v2.0.10
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /Open-IM-Server/config
|
||||
readOnly: true
|
||||
env:
|
||||
- name: CONFIG_NAME
|
||||
value: "/Open-IM-Server"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
strategy: #更新策略
|
||||
type: RollingUpdate # 滚动更新
|
Loading…
x
Reference in New Issue
Block a user