mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Back to MongoDB 6.
Thanks to xet7 1
This commit is contained in:
parent
abddc8a864
commit
64592d734c
4 changed files with 69 additions and 67 deletions
|
@ -91,7 +91,7 @@ services:
|
||||||
wekandb:
|
wekandb:
|
||||||
#-------------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------------
|
||||||
# ==== MONGODB FROM DOCKER HUB ====
|
# ==== MONGODB FROM DOCKER HUB ====
|
||||||
image: mongo:7
|
image: mongo:6
|
||||||
#-------------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------------
|
||||||
container_name: wekan-db
|
container_name: wekan-db
|
||||||
restart: always
|
restart: always
|
||||||
|
|
|
@ -9,7 +9,8 @@ if [ -z "$LANG" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
|
export PATH=/snap/${SNAP_NAME}/current/usr/bin:/snap/${SNAP_NAME}/current/bin:$PATH
|
||||||
|
export LD_LIBRARY_PATH=/snap/${SNAP_NAME}/current/lib:/snap/${SNAP_NAME}/current/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
|
||||||
|
|
||||||
if [ -z $1 ]; then
|
if [ -z $1 ]; then
|
||||||
DATE=`/bin/date +%Y%m%dT%H%M%S`
|
DATE=`/bin/date +%Y%m%dT%H%M%S`
|
||||||
|
|
|
@ -15,54 +15,55 @@ if [ -z "$LANG" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/${SNAP_NAME}/current/lib/x86_64-linux-gnu
|
export PATH=/snap/${SNAP_NAME}/current/usr/bin:/snap/${SNAP_NAME}/current/bin:$PATH
|
||||||
|
export LD_LIBRARY_PATH=/snap/${SNAP_NAME}/current/lib:/snap/${SNAP_NAME}/current/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
|
||||||
|
|
||||||
if test -f "$SNAP_COMMON/01-migrate-mongo3-to-mongo5.txt"; then
|
#if test -f "$SNAP_COMMON/01-migrate-mongo3-to-mongo5.txt"; then
|
||||||
touch "$SNAP_COMMON/01-migrate-mongo3-to-mongo5.txt"
|
# touch "$SNAP_COMMON/01-migrate-mongo3-to-mongo5.txt"
|
||||||
# Stop MongoDB
|
# # Stop MongoDB
|
||||||
touch "$SNAP_COMMON/02-disable-mongo.txt"
|
# touch "$SNAP_COMMON/02-disable-mongo.txt"
|
||||||
snapctl stop --disable ${SNAP_NAME}.mongodb
|
# snapctl stop --disable ${SNAP_NAME}.mongodb
|
||||||
touch "$SNAP_COMMON/03-eval-stop-mongo.txt"
|
# touch "$SNAP_COMMON/03-eval-stop-mongo.txt"
|
||||||
mongo wekan --eval "db.getSiblingDB('admin').shutdownServer()" $BIND_OPTIONS
|
# mongo wekan --eval "db.getSiblingDB('admin').shutdownServer()" $BIND_OPTIONS
|
||||||
# Start MongoDB 4.4
|
# # Start MongoDB 4.4
|
||||||
touch "$SNAP_COMMON/04-start-mongo44.txt"
|
# touch "$SNAP_COMMON/04-start-mongo44.txt"
|
||||||
$SNAP/mongo44bin/mongod --dbpath $SNAP_COMMON --logpath $SNAP_COMMON/02_mongodb_log_while_migrate.txt --logappend --journal $MONGO_URL --quiet
|
# $SNAP/mongo44bin/mongod --dbpath $SNAP_COMMON --logpath $SNAP_COMMON/02_mongodb_log_while_migrate.txt --logappend --journal $MONGO_URL --quiet
|
||||||
# Wait MongoDB 4.4 to start
|
# # Wait MongoDB 4.4 to start
|
||||||
touch "$SNAP_COMMON/05-wait-2s-mongo44-start.txt"
|
# touch "$SNAP_COMMON/05-wait-2s-mongo44-start.txt"
|
||||||
sleep 2s
|
# sleep 2s
|
||||||
# Dump Old MongoDB 3.x database
|
# # Dump Old MongoDB 3.x database
|
||||||
touch "$SNAP_COMMON/06-dump-database.txt"
|
# touch "$SNAP_COMMON/06-dump-database.txt"
|
||||||
(cd $SNAP_COMMON && mongodump --port ${MONGODB_PORT})
|
# (cd $SNAP_COMMON && mongodump --port ${MONGODB_PORT})
|
||||||
# Stop MongoDB 4.4
|
# # Stop MongoDB 4.4
|
||||||
touch "$SNAP_COMMON/07-stop-mongo44.txt"
|
# touch "$SNAP_COMMON/07-stop-mongo44.txt"
|
||||||
$SNAP/mongo44bin/mongo wekan --eval "db.getSiblingDB('admin').shutdownServer()" $BIND_OPTIONS
|
# $SNAP/mongo44bin/mongo wekan --eval "db.getSiblingDB('admin').shutdownServer()" $BIND_OPTIONS
|
||||||
# Wait MongoDB 4.4 to stop
|
# # Wait MongoDB 4.4 to stop
|
||||||
touch "$SNAP_COMMON/08-wait-2s-mongo44-stop.txt"
|
# touch "$SNAP_COMMON/08-wait-2s-mongo44-stop.txt"
|
||||||
sleep 2s
|
# sleep 2s
|
||||||
# Start MongoDB 5
|
# # Start MongoDB 5
|
||||||
touch "$SNAP_COMMON/09-start-mongo5.txt"
|
# touch "$SNAP_COMMON/09-start-mongo5.txt"
|
||||||
mongod --dbpath $SNAP_COMMON --logpath $SNAP_COMMON/10_mongodb_log_while_migrate.txt --logappend --journal $MONGO_URL --quiet
|
# mongod --dbpath $SNAP_COMMON --logpath $SNAP_COMMON/10_mongodb_log_while_migrate.txt --logappend --journal $MONGO_URL --quiet
|
||||||
# Restore database
|
# # Restore database
|
||||||
touch "$SNAP_COMMON/11-mongorestore-to-mongo5.txt"
|
# touch "$SNAP_COMMON/11-mongorestore-to-mongo5.txt"
|
||||||
(cd $SNAP_COMMON && mongorestore --port ${MONGODB_PORT})
|
# (cd $SNAP_COMMON && mongorestore --port ${MONGODB_PORT})
|
||||||
# Wait 5s
|
# # Wait 5s
|
||||||
touch "$SNAP_COMMON/12-wait-5s-after-restore.txt"
|
# touch "$SNAP_COMMON/12-wait-5s-after-restore.txt"
|
||||||
sleep 5s
|
# sleep 5s
|
||||||
# Shutdown mongodb
|
# # Shutdown mongodb
|
||||||
touch "$SNAP_COMMON/13-shutdown-mongodb.txt"
|
# touch "$SNAP_COMMON/13-shutdown-mongodb.txt"
|
||||||
mongo wekan --eval "db.getSiblingDB('admin').shutdownServer()" $BIND_OPTIONS
|
# mongo wekan --eval "db.getSiblingDB('admin').shutdownServer()" $BIND_OPTIONS
|
||||||
touch "$SNAP_COMMON/14-wait-5s-after-mongo5-shutdown.txt"
|
# touch "$SNAP_COMMON/14-wait-5s-after-mongo5-shutdown.txt"
|
||||||
sleep 5s
|
# sleep 5s
|
||||||
# Enable MongoDB 5
|
# # Enable MongoDB 5
|
||||||
touch "$SNAP_COMMON/15-enable-mongo-5.txt"
|
# touch "$SNAP_COMMON/15-enable-mongo-5.txt"
|
||||||
snapctl start --enable ${SNAP_NAME}.mongodb
|
# snapctl start --enable ${SNAP_NAME}.mongodb
|
||||||
fi
|
#fi
|
||||||
# When starting MongoDB, if logfile exist, delete it, because now uses syslog instead of logfile,
|
# When starting MongoDB, if logfile exist, delete it, because now uses syslog instead of logfile,
|
||||||
# because syslog usually already has log rotation.
|
# because syslog usually already has log rotation.
|
||||||
# https://github.com/wekan/wekan-snap/issues/92
|
# https://github.com/wekan/wekan-snap/issues/92
|
||||||
if test -f "$SNAP_COMMON/mongodb.log"; then
|
#if test -f "$SNAP_COMMON/mongodb.log"; then
|
||||||
rm -f "$SNAP_COMMON/mongodb.log"
|
# rm -f "$SNAP_COMMON/mongodb.log"
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
# Alternative: When starting MongoDB, and using logfile, truncate log to last 1000 lines of text.
|
# Alternative: When starting MongoDB, and using logfile, truncate log to last 1000 lines of text.
|
||||||
# 1) If file exists:
|
# 1) If file exists:
|
||||||
|
@ -77,13 +78,6 @@ fi
|
||||||
|
|
||||||
if [ -z "$MONGO_URL" ]; then
|
if [ -z "$MONGO_URL" ]; then
|
||||||
|
|
||||||
# Disable MongoDB telemetry and free monitoring
|
|
||||||
mongo --eval "disableTelemetry()"
|
|
||||||
mongo --eval "db.disableFreeMonitoring()"
|
|
||||||
# Snap: Disable apparmor="DENIED" at syslog
|
|
||||||
# https://github.com/wekan/wekan/issues/4855
|
|
||||||
mongo wekan --eval 'db.adminCommand({ setParameter: 1, diagnosticDataCollectionEnabled: false});' $BIND_OPTIONS
|
|
||||||
|
|
||||||
# start mongo deamon
|
# start mongo deamon
|
||||||
BIND_OPTIONS=""
|
BIND_OPTIONS=""
|
||||||
if [ "nill" != "$MONGODB_BIND_UNIX_SOCKET" ] && [ "x" != "x${MONGODB_BIND_UNIX_SOCKET}" ]; then
|
if [ "nill" != "$MONGODB_BIND_UNIX_SOCKET" ] && [ "x" != "x${MONGODB_BIND_UNIX_SOCKET}" ]; then
|
||||||
|
@ -113,20 +107,20 @@ if [ -z "$MONGO_URL" ]; then
|
||||||
mongod --dbpath $SNAP_COMMON --logpath /dev/null --journal $BIND_OPTIONS --quiet
|
mongod --dbpath $SNAP_COMMON --logpath /dev/null --journal $BIND_OPTIONS --quiet
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Drop indexes on database upgrade, when starting MongoDB
|
|
||||||
#mongo wekan --eval "db.getCollectionNames().forEach(function(col_name) { var coll = db.getCollection(col_name); coll.dropIndexes(); });" $BIND_OPTIONS
|
|
||||||
mongo wekan --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "4.4" });' $BIND_OPTIONS
|
|
||||||
# Delete incomplete uploads so that they would not prevent starting WeKan
|
|
||||||
mongo wekan --eval 'db.getCollection("cfs.attachments.filerecord").find( { "uploadedAt": { "$exists": true }, "copies.attachments" : null,"failures.copies.attachments.doneTrying" : {"$ne" : true}});' $BIND_OPTIONS
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
# Disable MongoDB telemetry and free monitoring
|
# Disable MongoDB telemetry and free monitoring
|
||||||
mongo --eval "disableTelemetry()"
|
mongosh wekan --eval 'disableTelemetry();' $BIND_OPTIONS
|
||||||
mongo --eval "db.disableFreeMonitoring()"
|
mongosh wekan --eval 'db.disableFreeMonitoring();' $BIND_OPTIONS
|
||||||
# Snap: Disable apparmor="DENIED" at syslog
|
# Snap: Disable apparmor="DENIED" at syslog
|
||||||
# https://github.com/wekan/wekan/issues/4855
|
# https://github.com/wekan/wekan/issues/4855
|
||||||
mongo wekan --eval 'db.adminCommand({ setParameter: 1, diagnosticDataCollectionEnabled: false});' $BIND_OPTIONS
|
mongosh wekan --eval 'db.adminCommand({ setParameter: 1, diagnosticDataCollectionEnabled: false});' $BIND_OPTIONS
|
||||||
|
# Drop indexes on database upgrade, when starting MongoDB
|
||||||
|
#mongosh wekan --eval "db.getCollectionNames().forEach(function(col_name) { var coll = db.getCollection(col_name); coll.dropIndexes(); });" $BIND_OPTIONS
|
||||||
|
mongosh wekan --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "4.4" });' $BIND_OPTIONS
|
||||||
|
# Delete incomplete uploads so that they would not prevent starting WeKan
|
||||||
|
mongosh wekan --eval 'db.getCollection("cfs.attachments.filerecord").find( { "uploadedAt": { "$exists": true }, "copies.attachments" : null,"failures.copies.attachments.doneTrying" : {"$ne" : true}});' $BIND_OPTIONS
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
if [ "syslog" == "${MONGO_LOG_DESTINATION}" ]; then
|
if [ "syslog" == "${MONGO_LOG_DESTINATION}" ]; then
|
||||||
echo "Sending mongodb logs to syslog"
|
echo "Sending mongodb logs to syslog"
|
||||||
|
@ -143,10 +137,16 @@ else
|
||||||
mongod --dbpath $SNAP_COMMON --logpath /dev/null --journal $MONGO_URL --quiet
|
mongod --dbpath $SNAP_COMMON --logpath /dev/null --journal $MONGO_URL --quiet
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Disable MongoDB telemetry and free monitoring
|
||||||
|
mongosh wekan --eval 'disableTelemetry();' $BIND_OPTIONS
|
||||||
|
mongosh wekan --eval 'db.disableFreeMonitoring();' $BIND_OPTIONS
|
||||||
|
# Snap: Disable apparmor="DENIED" at syslog
|
||||||
|
# https://github.com/wekan/wekan/issues/4855
|
||||||
|
mongosh wekan --eval 'db.adminCommand({ setParameter: 1, diagnosticDataCollectionEnabled: false});' $BIND_OPTIONS
|
||||||
# Drop indexes on database upgrade, when starting MongoDB
|
# Drop indexes on database upgrade, when starting MongoDB
|
||||||
#mongo wekan --eval "db.getCollectionNames().forEach(function(col_name) { var coll = db.getCollection(col_name); coll.dropIndexes(); });" $BIND_OPTIONS
|
#mongosh wekan --eval "db.getCollectionNames().forEach(function(col_name) { var coll = db.getCollection(col_name); coll.dropIndexes(); });" $BIND_OPTIONS
|
||||||
mongo wekan --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "4.2" });' $BIND_OPTIONS
|
mongosh wekan --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "4.2" });' $BIND_OPTIONS
|
||||||
# Delete incomplete uploads so that they would not prevent starting WeKan
|
# Delete incomplete uploads so that they would not prevent starting WeKan
|
||||||
mongo wekan --eval 'db.getCollection("cfs.attachments.filerecord").find( { "uploadedAt": { "$exists": true }, "copies.attachments" : null,"failures.copies.attachments.doneTrying" : {"$ne" : true}});' $BIND_OPTIONS
|
mongosh wekan --eval 'db.getCollection("cfs.attachments.filerecord").find( { "uploadedAt": { "$exists": true }, "copies.attachments" : null,"failures.copies.attachments.doneTrying" : {"$ne" : true}});' $BIND_OPTIONS
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -9,7 +9,8 @@ if [ -z "$LANG" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/snap/wekan/current/lib/x86_64-linux-gnu
|
export PATH=/snap/${SNAP_NAME}/current/usr/bin:/snap/${SNAP_NAME}/current/bin:$PATH
|
||||||
|
export LD_LIBRARY_PATH=/snap/${SNAP_NAME}/current/lib:/snap/${SNAP_NAME}/current/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
|
||||||
|
|
||||||
# start mongodb backup
|
# start mongodb backup
|
||||||
[ "x" == "x${MONGODB_BIND_IP}" ] && MONGODB_BIND_IP="127.0.0.1"
|
[ "x" == "x${MONGODB_BIND_IP}" ] && MONGODB_BIND_IP="127.0.0.1"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue