Migrate old uploads to minio

AI-generated summary

In a discussion about migrating Discourse uploads to MinIO, hosna attempts to run the migration command with MinIO-specific S3 environment variables but repeatedly encounters an error requesting the DISCOURSE_S3_CDN_URL variable. pfaffman notes that MinIO is not officially supported and suggests using the bucket name as a fallback for the CDN URL, though this doesn’t resolve the issue for hosna. hosna references past success with DigitalOcean Spaces and offers to sponsor development to add MinIO support if others are interested. Bathinda advises using a full S3-compatible CDN URL format (e.g., https://bucket_name.s3.region.amazonaws.com/...) but clarifies this guidance applies only to Amazon S3 users, not MinIO. The thread highlights configuration challenges and lack of native MinIO support in Discourse’s S3 migration tooling.

I’m doing somthing like this:

DISCOURSE_S3_BUCKET="abc" DISCOURSE_S3_REGION="minio" DISCOURSE_S3_ACCESS_KEY_ID="abc" DISCOURSE_S3_SECRET_ACCESS_KEY="abc" DISCOURSE_S3_ENDPOINT="my minio endpoint" rake uploads:migrate_to_s3

However I get the following error:

Please provide the ‘DISCOURSE_S3_CDN_URL’ environment variable

If you don’t want to configure a CDN then you can just put the prefix for the bucket name, I think.

Minio isn’t supported and might not work.

still I get that message

DISCOURSE_S3_BUCKET="test" DISCOURSE_S3_REGION="minio" DISCOURSE_S3_ACCESS_KEY_ID="xxx" DISCOURSE_S3_SECRET_ACCESS_KEY="xxx" DISCOURSE_S3_ENDPOINT="https://myendpoint.com" DISCOURSE_S3_CDN_URL="test"  rake uploads:migrate_to_s3
Checking if default already migrated...
10 of 25 uploads are not migrated to S3. S3 migration failed for db 'default'.
2 posts are not remapped to new S3 upload URL. S3 migration failed for db 'default'.
Looking for missing uploads on: default

0 post uploads are missing.

No posts require rebaking
Migrating uploads to S3 for 'default'...
Please provide the 'DISCOURSE_S3_CDN_URL' environment variable

I think previously you were able to migrate to digital ocean spaces. I dont know If minio and spaces are the same, but if you are interested and give it a try and support minio on discourse, I can sponsor the job.

In place of the quoted words here above, try using your full CDN url, something like this: "DISCOURSE_S3_CDN_URL=“https://bucket_name.s3.ap-south-1.amazonaws.com/folder_name_if_any”. Also you should replace the word ‘ap-south-1’ with your actual amazon region name.

Disclaimer: My suggestion is only for Amazon S3 users.