From cc0658a225ef35a6153feab2ad0c0eb40ad66eeb Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Wed, 2 Mar 2022 17:32:34 +0200 Subject: [PATCH] Added Meteor-Files WRITEABLE_PATH for Sandstorm, Snap and Source. Thanks to xet7 ! Related export WRITABLE_PATH=$SNAP_COMMON/wekan-uploads/ --- sandstorm-pkgdef.capnp | 1 + server/migrations.js | 3 ++- snap-src/bin/mongodb-control | 8 +++++--- start-wekan.sh | 3 +++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/sandstorm-pkgdef.capnp b/sandstorm-pkgdef.capnp index b84b879ff..3a05aba91 100644 --- a/sandstorm-pkgdef.capnp +++ b/sandstorm-pkgdef.capnp @@ -246,6 +246,7 @@ const myCommand :Spk.Manifest.Command = ( #--------------------------------------------------------------------- (key = "NODE_OPTIONS", value = "--max_old_space_size=4096"), (key = "PATH", value = "/usr/local/bin:/usr/bin:/bin"), + (key = "WRITABLE_PATH", value = "/var/wekan-uploads"), (key = "RESULTS_PER_PAGE", value = ""), (key = "WITH_API", value = "true"), (key = "RICHER_CARD_COMMENT_EDITOR", value="false"), diff --git a/server/migrations.js b/server/migrations.js index 8507f73b8..b1c4687bf 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -1127,7 +1127,8 @@ Migrations.add('add-card-details-show-lists', () => { }); Migrations.add('migrate-attachments-collectionFS-to-ostrioFiles', () => { - const storagePath = Attachments.storagePath(); + //const storagePath = Attachments.storagePath(); + const storagePath = process.env.WRITABLE_PATH; if (!fs.existsSync(storagePath)) { console.log("create storagePath because it doesn't exist: " + storagePath); fs.mkdirSync(storagePath, { recursive: true }); diff --git a/snap-src/bin/mongodb-control b/snap-src/bin/mongodb-control index ec7202559..4d936b860 100755 --- a/snap-src/bin/mongodb-control +++ b/snap-src/bin/mongodb-control @@ -26,9 +26,11 @@ fi # Not in use. If uploads directory does not exist, create it. # Wekan will store attachments there. -#if [ ! -d "$SNAP_COMMON/uploads" ]; then -# mkdir "$SNAP_COMMON/uploads" -#fi +if [ ! -d "$SNAP_COMMON/wekan-uploads" ]; then + mkdir "$SNAP_COMMON/wekan-uploads" +fi + +export WRITABLE_PATH=$SNAP_COMMON/wekan-uploads # Alternative: When starting MongoDB, and using logfile, truncate log to last 1000 lines of text. # 1) If file exists: diff --git a/start-wekan.sh b/start-wekan.sh index b07444a62..bb442176c 100755 --- a/start-wekan.sh +++ b/start-wekan.sh @@ -9,6 +9,9 @@ #--------------------------------------------- export MONGO_URL='mongodb://127.0.0.1:27017/wekan' #--------------------------------------------- + # WRITEABLE PATH + export WRITABLE_PATH=./wekan-uploads + #--------------------------------------------- # Production: https://example.com/wekan # Local: http://localhost:2000 #export ipaddress=$(ifdata -pa eth0)