Merge remote-tracking branch 'origin/superGroup' into superGroup

pull/241/head
Gordon 2 years ago
commit 3dd9d51ca5

@ -28,8 +28,8 @@ mongo:
dbTimeout: 60
dbDatabase: openIM #mongo db 默认即可
dbSource: admin
dbUserName: #mongo用户名建议先不设置
dbPassword: #mongo密码建议先不设置
dbUserName: openIM #mongo用户名建议先不设置
dbPassword: openIM #mongo密码建议先不设置
dbMaxPoolSize: 100
dbRetainChatRecords: 3650 #mongo保存离线消息时间根据需求修改

@ -20,17 +20,21 @@ services:
ports:
- 37017:27017
container_name: mongo
command: --wiredTigerCacheSizeGB 1
command: --wiredTigerCacheSizeGB 1 --auth
volumes:
- ./components/mongodb/data/db:/data/db
- ./components/mongodb/data/logs:/data/logs
- ./components/mongodb/data/conf:/etc/mongo
- ./script/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh
environment:
- TZ=Asia/Shanghai
# cache
- wiredTigerCacheSizeGB=1
#- MONGO_INITDB_ROOT_USERNAME=openIM
#- MONGO_INITDB_ROOT_PASSWORD=openIM
- MONGO_USERNAME=openIM
- MONGO_PASSWORD=openIM
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=root
- MONGO_INITDB_DATABASE=openIM
#TZ: Asia/Shanghai
restart: always

@ -0,0 +1,12 @@
mongo -- "$MONGO_INITDB_DATABASE" <<EOF
db = db.getSiblingDB('admin')
db.auth('$MONGO_INITDB_ROOT_USERNAME', '$MONGO_INITDB_ROOT_PASSWORD')
db = db.getSiblingDB('$MONGO_INITDB_DATABASE')
db.createUser({
user: "$MONGO_USERNAME",
pwd: "$MONGO_PASSWORD",
roles: [
{ role: 'readWrite', db: '$MONGO_INITDB_DATABASE' }
]
})
EOF
Loading…
Cancel
Save