mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-02 17:32:11 +08:00
feat 单容器单进程模式部署新增sdk部署
This commit is contained in:
parent
7a46389da8
commit
01b7fa4fa0
@ -7,11 +7,9 @@ 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
|
||||
|
||||
23
deploy/dockerfiles/Dockerfile.sdk
Normal file
23
deploy/dockerfiles/Dockerfile.sdk
Normal file
@ -0,0 +1,23 @@
|
||||
FROM alpine:3.13
|
||||
|
||||
# 设置固定的项目路径
|
||||
ENV WORKDIR /app
|
||||
ENV CONFIG_NAME $WORKDIR/config/config.yaml
|
||||
|
||||
# 定义环境变量
|
||||
ARG API_ENDPOINT=0.0.0.0:10000
|
||||
ENV API_ENDPOINT ${API_ENDPOINT}
|
||||
|
||||
ARG WS_ENDPOINT=0.0.0.0:17778
|
||||
ENV WS_ENDPOINT ${WS_ENDPOINT}
|
||||
|
||||
# 将可执行文件复制到目标目录
|
||||
ADD ./open_im_sdk_server $WORKDIR/main
|
||||
|
||||
# 创建用于挂载的几个目录,添加可执行权限
|
||||
RUN mkdir $WORKDIR/logs $WORKDIR/config $WORKDIR/db && \
|
||||
chmod +x $WORKDIR/main
|
||||
|
||||
|
||||
WORKDIR $WORKDIR
|
||||
CMD ./main
|
||||
@ -1,4 +1,5 @@
|
||||
version: "3.7"
|
||||
#fixme Clone openIM Server project before using docker-compose,project address:https://github.com/OpenIMSDK/Open-IM-Server.git
|
||||
networks:
|
||||
openim:
|
||||
external: true
|
||||
@ -15,7 +16,6 @@ services:
|
||||
- ./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
|
||||
@ -29,6 +29,30 @@ services:
|
||||
max-size: "1g"
|
||||
max-file: "2"
|
||||
|
||||
# 如果需要sdk,则可以拉起
|
||||
sdk:
|
||||
networks:
|
||||
- openim
|
||||
image: openim/sdk
|
||||
container_name: openim_sdk
|
||||
ports:
|
||||
- 30000:30000 # sdk,必须开
|
||||
environment:
|
||||
- "API_ENDPOINT=http://openim_api:10000"
|
||||
- "WS_ENDPOINT=http://openim_msg_gateway:17778"
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
- ./db/sdk:/app/db/sdk
|
||||
restart: always
|
||||
depends_on:
|
||||
- api
|
||||
- msg_gateway
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "1g"
|
||||
max-file: "2"
|
||||
|
||||
msg_gateway:
|
||||
networks:
|
||||
- openim
|
||||
@ -39,14 +63,7 @@ services:
|
||||
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:
|
||||
@ -61,14 +78,7 @@ services:
|
||||
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:
|
||||
@ -83,14 +93,7 @@ services:
|
||||
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:
|
||||
@ -105,7 +108,6 @@ services:
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
- ./config/config.yaml:/app/config/config.yaml
|
||||
- ./db/sdk:/app/db/sdk
|
||||
restart: always
|
||||
# depends_on:
|
||||
# - kafka
|
||||
@ -127,14 +129,7 @@ services:
|
||||
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:
|
||||
@ -149,14 +144,7 @@ services:
|
||||
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:
|
||||
@ -166,14 +154,7 @@ services:
|
||||
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:
|
||||
@ -183,14 +164,7 @@ services:
|
||||
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:
|
||||
@ -200,14 +174,7 @@ services:
|
||||
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:
|
||||
@ -219,5 +186,4 @@ services:
|
||||
volumes:
|
||||
- ./logs:/app/logs
|
||||
- ./config/config.yaml:/app/config/config.yaml
|
||||
- ./db/sdk:/app/db/sdk
|
||||
restart: always
|
||||
@ -2,11 +2,15 @@
|
||||
### 以docker-compose 形式单独部署
|
||||
```sh
|
||||
# 查看 ./Makefile ,先编译各个需要的源码到 ../bin
|
||||
|
||||
# 目前没有处理 Open-IM-SDK-Core ,如果需要的话,建议单独拉取代码,然后执行其Makefile中的命令编译打包镜像
|
||||
# make build-win
|
||||
# make build-image
|
||||
|
||||
# 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
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -344,5 +343,4 @@ func init() {
|
||||
if err = yaml.Unmarshal(bytes, &Config); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
fmt.Println("load config: ", Config)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user