forked from extern/docker
enable mongodb oplog
necessary for query.observerChanges to work probably with changes to mongodb via a different client. Otherwise some events are missing due to a fallback via polling, which leads to lost state updates in the meantime. took me now 3 days to debug.... :'D
This commit is contained in:
parent
6905723d45
commit
61676a042d
@ -103,6 +103,13 @@ services:
|
||||
mongodb:
|
||||
image: mongo:4.4
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./mod/mongo/mongod.conf:/etc/mongod.conf
|
||||
- ./mod/mongo/init-replica.sh:/docker-entrypoint-initdb.d/init-replica.sh
|
||||
tmpfs:
|
||||
- /data/configdb
|
||||
- /data/db
|
||||
command: mongod --config /etc/mongod.conf --oplogSize 8 --replSet rs0 --noauth
|
||||
healthcheck:
|
||||
test: bash -c "if mongo --eval 'quit(db.runCommand({ ping':' 1 }).ok ? 0 ':' 2)'; then exit 0; fi; exit 1;"
|
||||
networks:
|
||||
|
@ -2,7 +2,7 @@
|
||||
set -e
|
||||
|
||||
cd /app
|
||||
# export MONGO_OPLOG_URL=mongodb://10.7.7.6/local
|
||||
export MONGO_OPLOG_URL=mongodb://10.7.7.6/local
|
||||
export MONGO_URL=mongodb://10.7.7.6/meteor
|
||||
export NODE_ENV=production
|
||||
export SERVER_WEBSOCKET_COMPRESSION=0
|
||||
|
16
mod/mongo/init-replica.sh
Executable file
16
mod/mongo/init-replica.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
|
||||
host=${HOSTNAME:-$(hostname -f)}
|
||||
|
||||
# init replset with defaults
|
||||
mongo local --eval "rs.initiate({
|
||||
_id: 'rs0',
|
||||
members: [ { _id: 0, host: '127.0.0.1:27017' } ]
|
||||
})"
|
||||
|
||||
echo "Waiting to become a master"
|
||||
echo 'while (!db.isMaster().ismaster) { sleep(100); }' | mongo
|
||||
|
||||
echo "I'm the master!"
|
28
mod/mongo/mongod.conf
Normal file
28
mod/mongo/mongod.conf
Normal file
@ -0,0 +1,28 @@
|
||||
# mongod.conf
|
||||
|
||||
# for documentation of all options, see:
|
||||
# http://docs.mongodb.org/manual/reference/configuration-options/
|
||||
|
||||
storage:
|
||||
dbPath: /data/db
|
||||
journal:
|
||||
enabled: true
|
||||
wiredTiger:
|
||||
engineConfig:
|
||||
cacheSizeGB: 0
|
||||
journalCompressor: none
|
||||
directoryForIndexes: true
|
||||
collectionConfig:
|
||||
blockCompressor: none
|
||||
indexConfig:
|
||||
prefixCompression: false
|
||||
|
||||
|
||||
net:
|
||||
port: 27017
|
||||
bindIp: 0.0.0.0
|
||||
|
||||
|
||||
replication:
|
||||
replSetName: rs0
|
||||
|
Loading…
Reference in New Issue
Block a user