summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsnap-src/bin/mongodb-control3
-rwxr-xr-xsnap-src/bin/mongodb-restore2
-rw-r--r--snapcraft.yaml3
3 files changed, 6 insertions, 2 deletions
diff --git a/snap-src/bin/mongodb-control b/snap-src/bin/mongodb-control
index d6d795bc..60d59657 100755
--- a/snap-src/bin/mongodb-control
+++ b/snap-src/bin/mongodb-control
@@ -30,3 +30,6 @@ fi
echo "mongodb bind options: $BIND_OPTIONS"
mongod --dbpath $SNAP_COMMON --logpath $SNAP_COMMON/mongodb.log --logappend --journal $BIND_OPTIONS --smallfiles
+
+# 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
diff --git a/snap-src/bin/mongodb-restore b/snap-src/bin/mongodb-restore
index c1c82775..dddcea20 100755
--- a/snap-src/bin/mongodb-restore
+++ b/snap-src/bin/mongodb-restore
@@ -13,4 +13,4 @@ export LC_ALL=C
# start mongodb backup
[ "x" == "x${MONGODB_BIND_IP}" ] && MONGODB_BIND_IP="127.0.0.1"
echo "using bind ip"
-mongorestore --host $MONGODB_BIND_IP --port $MONGODB_PORT -d wekan --gzip --archive=$1
+mongorestore --host $MONGODB_BIND_IP --port $MONGODB_PORT -d wekan --noIndexRestore --gzip --archive=$1
diff --git a/snapcraft.yaml b/snapcraft.yaml
index a92991ad..2ee9462b 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -203,9 +203,10 @@ parts:
cp -f fix-download-unicode/cfs_access-point.txt .build/bundle/programs/server/packages/cfs_access-point.js
# Disable code coverage on Snap, because it crashes Wekan starting.
# https://github.com/wekan/wekan/issues/2533#issuecomment-513506939
+ #sed -i 's|Profile(fileInfo.path, func).apply(global, args);|//Profile(fileInfo.path, func).apply(global, args);|g' .build/bundle/programs/server/boot.js
+ # although it did not help, it said unable to find main function.
# Other option to fix would be to drop indexes at start of snap:
# https://stackoverflow.com/questions/24241742/drop-all-indexes-from-all-collections-in-a-mongodb-database-using-the-command-li
- sed -i 's|Profile(fileInfo.path, func).apply(global, args);|//Profile(fileInfo.path, func).apply(global, args);|g' .build/bundle/programs/server/boot.js
#Removed binary version of bcrypt because of security vulnerability that is not fixed yet.
#https://github.com/wekan/wekan/commit/4b2010213907c61b0e0482ab55abb06f6a668eac
#https://github.com/wekan/wekan/commit/7eeabf14be3c63fae2226e561ef8a0c1390c8d3c