mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-26 13:12:12 +08:00
parent
a9a0a324e6
commit
593fe4469e
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@ out-test
|
|||||||
.github
|
.github
|
||||||
|
|
||||||
tmp
|
tmp
|
||||||
|
.idea
|
||||||
|
|||||||
13
README.md
13
README.md
@ -88,14 +88,21 @@ All images are available at https://hub.docker.com/r/lyt1123/open_im_server
|
|||||||
```
|
```
|
||||||
git clone https://github.com/OpenIMSDK/Open-IM-Server.git --recursive
|
git clone https://github.com/OpenIMSDK/Open-IM-Server.git --recursive
|
||||||
```
|
```
|
||||||
|
4. configure your env
|
||||||
4. Start docker-compose with one click(Docker automatically pulls all images)
|
```
|
||||||
|
cp env-example .env
|
||||||
|
```
|
||||||
|
5. show your config
|
||||||
|
```
|
||||||
|
docker-compose config
|
||||||
|
```
|
||||||
|
6. Start docker-compose with one click(Docker automatically pulls all images)
|
||||||
|
|
||||||
```
|
```
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
5. Check service
|
7. Check service
|
||||||
|
|
||||||
```
|
```
|
||||||
./docker_check_service.sh
|
./docker_check_service.sh
|
||||||
|
|||||||
145
config/config.env.yaml
Normal file
145
config/config.env.yaml
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
# 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: [ etcd:2379 ]
|
||||||
|
|
||||||
|
mysql:
|
||||||
|
dbMysqlAddress: [ mysql:3306 ]
|
||||||
|
dbMysqlUserName: root
|
||||||
|
dbMysqlPassword: openIM
|
||||||
|
dbMysqlDatabaseName: openIM
|
||||||
|
dbTableName: eMsg
|
||||||
|
dbMsgTableNum: 1
|
||||||
|
dbMaxOpenConns: 20
|
||||||
|
dbMaxIdleConns: 10
|
||||||
|
dbMaxLifeTime: 120
|
||||||
|
|
||||||
|
mongo:
|
||||||
|
dbAddress: [ mongodb:27017 ]
|
||||||
|
dbDirect: false
|
||||||
|
dbTimeout: 10
|
||||||
|
dbDatabase: openIM
|
||||||
|
dbSource: admin
|
||||||
|
dbUserName:
|
||||||
|
dbPassword:
|
||||||
|
dbMaxPoolSize: 20
|
||||||
|
dbRetainChatRecords: 7
|
||||||
|
|
||||||
|
redis:
|
||||||
|
dbAddress: redis:6379
|
||||||
|
dbMaxIdle: 128
|
||||||
|
dbMaxActive: 0
|
||||||
|
dbIdleTimeout: 120
|
||||||
|
dbPassWord: openIM
|
||||||
|
|
||||||
|
kafka:
|
||||||
|
ws2mschat:
|
||||||
|
addr: [ kafka:9092 ]
|
||||||
|
topic: "ws2ms_chat"
|
||||||
|
ms2pschat:
|
||||||
|
addr: [ 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:
|
||||||
|
|
||||||
|
api:
|
||||||
|
openImApiPort: [ 10000 ]
|
||||||
|
sdk:
|
||||||
|
openImSdkWsPort: [ 30000 ]
|
||||||
|
|
||||||
|
credential:
|
||||||
|
tencent:
|
||||||
|
appID: 1302656840
|
||||||
|
region: ap-chengdu
|
||||||
|
bucket: echat-1302656840
|
||||||
|
secretID: AKIDGNYVChzIQinu7QEgtNp0hnNgqcV8vZTC
|
||||||
|
secretKey: kz15vW83qM6dBUWIq681eBZA0c0vlIbe
|
||||||
|
|
||||||
|
|
||||||
|
rpcport:
|
||||||
|
openImUserPort: [ 10100 ]
|
||||||
|
openImFriendPort: [ 10200 ]
|
||||||
|
openImOfflineMessagePort: [ 10300]
|
||||||
|
openImOnlineRelayPort: [ 10400 ]
|
||||||
|
openImGroupPort: [ 10500 ]
|
||||||
|
openImAuthPort: [ 10600 ]
|
||||||
|
openImPushPort: [ 10700 ]
|
||||||
|
|
||||||
|
|
||||||
|
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: 1600018281
|
||||||
|
secretKey: 3cd68a77a95b89e5089a1aca523f318f
|
||||||
|
android:
|
||||||
|
accessID: 111
|
||||||
|
secretKey: 111
|
||||||
|
jpns:
|
||||||
|
appKey: cf47465a368f24c659608e7e
|
||||||
|
masterSecret: 02204efe3f3832947a236ee5
|
||||||
|
pushUrl: "https://api.jpush.cn/v3/push"
|
||||||
|
manager:
|
||||||
|
appManagerUid: ["openIM123456","openIM654321"]
|
||||||
|
secrets: ["openIM1","openIM2"]
|
||||||
|
|
||||||
|
secret: tuoyun
|
||||||
|
|
||||||
|
multiloginpolicy:
|
||||||
|
onlyOneTerminalAccess: false
|
||||||
|
mobileAndPCTerminalAccessButOtherTerminalKickEachOther: true
|
||||||
|
allTerminalAccess: false
|
||||||
|
|
||||||
|
#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"
|
||||||
132
docker-compose.env.yaml
Normal file
132
docker-compose.env.yaml
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
version: "3"
|
||||||
|
#fixme Clone openIM Server project before using docker-compose,project address:https://github.com/OpenIMSDK/Open-IM-Server.git
|
||||||
|
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:${MYSQL_VERSION}
|
||||||
|
ports:
|
||||||
|
- ${MYSQL_3306_PORT}:3306
|
||||||
|
container_name: mysql
|
||||||
|
volumes:
|
||||||
|
- ./components/mysql/data:/var/lib/mysql
|
||||||
|
- /etc/localtime:/etc/localtime
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: ${MYSQL_PWD}
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
mongodb:
|
||||||
|
image: mongo:${MONGO_VERSION}
|
||||||
|
ports:
|
||||||
|
- ${MONGO_PORT}:27017
|
||||||
|
container_name: mongo
|
||||||
|
volumes:
|
||||||
|
- ./components/mongodb/data:/data/db
|
||||||
|
environment:
|
||||||
|
TZ: Asia/Shanghai
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:${REDIS_VERSION}
|
||||||
|
ports:
|
||||||
|
- ${REDIS_PORT}:6379
|
||||||
|
container_name: 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:
|
||||||
|
image: wurstmeister/zookeeper
|
||||||
|
ports:
|
||||||
|
- ${ZOOKEEPER_PORT}:2181
|
||||||
|
container_name: zookeeper
|
||||||
|
volumes:
|
||||||
|
- /etc/localtime:/etc/localtime
|
||||||
|
environment:
|
||||||
|
TZ: Asia/Shanghai
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
|
||||||
|
kafka:
|
||||||
|
image: wurstmeister/kafka
|
||||||
|
container_name: kafka
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
TZ: Asia/Shanghai
|
||||||
|
KAFKA_BROKER_ID: 0
|
||||||
|
KAFKA_ZOOKEEPER_CONNECT: ${KAFKA_ZOOKEEPER_CONNECT}
|
||||||
|
KAFKA_ADVERTISED_LISTENERS: ${KAFKA_ADVERTISED_LISTENERS}
|
||||||
|
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
|
||||||
|
depends_on:
|
||||||
|
- zookeeper
|
||||||
|
|
||||||
|
etcd:
|
||||||
|
image: quay.io/coreos/etcd
|
||||||
|
ports:
|
||||||
|
- ${ETCD_2379_PORT}:2379
|
||||||
|
- ${ETCD_2380_PORT}:2380
|
||||||
|
container_name: 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
|
||||||
|
|
||||||
|
|
||||||
|
#fixme-----build from dockerfile---------
|
||||||
|
# open-im-server:
|
||||||
|
# image: open_im_server
|
||||||
|
# container_name: open-im-server
|
||||||
|
# ports:
|
||||||
|
# - ${OPEN_IM_SDK_WS_PORT}:30000
|
||||||
|
# - ${OPEN_IM_API_PORT}:10000
|
||||||
|
# volumes:
|
||||||
|
# - ./logs:/Open-IM-Server/logs
|
||||||
|
# - ./config/config.yaml:/Open-IM-Server/config/config.yaml
|
||||||
|
# restart: always
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# dockerfile: deploy.Dockerfile
|
||||||
|
# depends_on:
|
||||||
|
# - mysql
|
||||||
|
# - mongodb
|
||||||
|
# - redis
|
||||||
|
# - kafka
|
||||||
|
# - etcd
|
||||||
|
# logging:
|
||||||
|
# driver: json-file
|
||||||
|
# options:
|
||||||
|
# max-size: "1g"
|
||||||
|
# max-file: "2"
|
||||||
|
|
||||||
|
#fixme----build from docker hub------
|
||||||
|
open-im-server:
|
||||||
|
image: lyt1123/open_im_server:${OPEN_IM_SERVER_VERSION}
|
||||||
|
container_name: open-im-server
|
||||||
|
ports:
|
||||||
|
- ${OPEN_IM_SDK_WS_PORT}:30000
|
||||||
|
- ${OPEN_IM_API_PORT}:10000
|
||||||
|
volumes:
|
||||||
|
- ./logs:/Open-IM-Server/logs
|
||||||
|
- ./config/config.yaml:/Open-IM-Server/config/config.yaml
|
||||||
|
restart: always
|
||||||
|
depends_on:
|
||||||
|
- kafka
|
||||||
|
- mysql
|
||||||
|
- mongodb
|
||||||
|
- redis
|
||||||
|
- etcd
|
||||||
|
logging:
|
||||||
|
driver: json-file
|
||||||
|
options:
|
||||||
|
max-size: "1g"
|
||||||
|
max-file: "2"
|
||||||
30
env-example
Normal file
30
env-example
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#mysql config
|
||||||
|
MYSQL_VERSION=5.7
|
||||||
|
MYSQL_PWD=openIM
|
||||||
|
MYSQL_3306_PORT=3306
|
||||||
|
|
||||||
|
#mongodb config
|
||||||
|
MONGO_VERSION=4.0
|
||||||
|
MONGO_PORT=27017
|
||||||
|
MONGO_ROOT_USERNAME=openIM
|
||||||
|
MONGO_ROOT_PWD=openIM
|
||||||
|
|
||||||
|
#redis config
|
||||||
|
REDIS_VERSION=latest
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
#zookeeper config
|
||||||
|
ZOOKEEPER_PORT=2181
|
||||||
|
|
||||||
|
#kafka config
|
||||||
|
KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
|
||||||
|
KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092
|
||||||
|
|
||||||
|
#etcd config
|
||||||
|
ETCD_2379_PORT=2379
|
||||||
|
ETCD_2380_PORT=2380
|
||||||
|
|
||||||
|
#open-im-server config
|
||||||
|
OPEN_IM_SERVER_VERSION=latest
|
||||||
|
OPEN_IM_SDK_WS_PORT=30000
|
||||||
|
OPEN_IM_API_PORT=10000
|
||||||
Loading…
x
Reference in New Issue
Block a user