qfieldcloud icon indicating copy to clipboard operation
qfieldcloud copied to clipboard

After update to 25.X - no connection to S3 Bucket

Open meyerlor opened this issue 9 months ago • 3 comments

Hello,

i'm back from the FOSSGIS and wanted to finally try and upgrade my QFieldCloud instance from 32.5 to the newest 25.5 (offtopic, but what made you go from 32.x to 25.x as next major realease number? :D). I'm struggeling a bit - i followed the steps very careful. Basically, from how i understand it, i need to remove/comment out this block in the .env file


STORAGE_ACCESS_KEY_ID=ThisIsMyWorkingKEyInVersion32.5
STORAGE_SECRET_ACCESS_KEY=ThisIsMyWorkingSecretAccessKeyInVersion32.5
STORAGE_BUCKET_NAME=MyBucketName
STORAGE_REGION_NAME=WorkingRegionName
STORAGE_ENDPOINT_URL= https://workingurl.com

And add this block:

STORAGES='{ "default": { "BACKEND": "qfieldcloud.filestorage.backend.QfcS3Boto3Storage", "OPTIONS": { "access_key": "ThisIsMyWorkingKEyInVersion32.5", "secret_key": "ThisIsMyWorkingSecretAccessKeyInVersion32.5", "bucket_name": "MyBucketName", "region_name": "WorkingRegionName", "endpoint_url": "https://workingurl.com" }, "QFC_IS_LEGACY": false } }'

And then run

docker compose up -d --build
docker compose exec app python manage.py migrate
docker compose run app python manage.py collectstatic --noinput

Since i want to stick with S3, from how i understand it i do not need to run the "migratefilestorage.py" and "migrateavatars.py" scripts, right? And the variable "QFC_ISLEGACY" is rightly set to false as well ?

Doing this as described, after the upgrade i get an status error for the storage - and i can not download any project (or see the file-list of a projecet in the Django interface. What am i doing wrong?

Thanks for the great work & the nice talks you held and the wunderful chat with Schmucki at your booth!

meyerlor avatar Mar 31 '25 06:03 meyerlor

I assume you have to create a MINIO_ROOT_USER and password with mc. Otherwise the default key&secret is always minioadmin.

https://min.io/docs/minio/linux/reference/minio-server/settings/root-credentials.html

afeit avatar Apr 06 '25 06:04 afeit

But i'm using a S3 bucket from Hetzner and not minio, so that should be no issue?

meyerlor avatar Apr 06 '25 08:04 meyerlor

@meyerlor if you want to access the files from your already existing bucket, you should configure your storage with the flag QFC_IS_LEGACY set to true. The flag indicates to QFieldCloud how the files are stored and shall be consumed.

I would recommend you already prepare a new (empty) bucket, which you should name as default and plan a migration from your old bucket to the new bucket in the next months.

The plan is that the legacy buckets will not be supported in q3.

suricactus avatar Apr 07 '25 23:04 suricactus

Ah, great - finally had the time to test this and now it is working.

docker compose exec app python manage.py migratefilestorage --all

ended with an error (no more files to migrate) but i think that is the desired behaviour? I think all projects are migrated.

Thanks for your help!

meyerlor avatar Apr 18 '25 17:04 meyerlor