diff --git a/.gitignore b/.gitignore index f75d03c97..2849482b5 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ out-test .github tmp +.idea diff --git a/config/config.env.yaml b/config/config.env.yaml new file mode 100644 index 000000000..3d443e0f9 --- /dev/null +++ b/config/config.env.yaml @@ -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" \ No newline at end of file diff --git a/docker-compose.env.yaml b/docker-compose.env.yaml new file mode 100644 index 000000000..6709b453c --- /dev/null +++ b/docker-compose.env.yaml @@ -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" diff --git a/env-example b/env-example new file mode 100644 index 000000000..594f73c60 --- /dev/null +++ b/env-example @@ -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