Problem using Exoscale as an external host for media storage

Hi all, i think i’m going nuts. :face_with_head_bandage:

I’m trying to use Exoscale for my Mastodon instance’s media storage. I signed up, created bucket, transferred all media files to that bucket, and enabled S3 in .env.production:

S3_ENABLED=true
S3_BUCKET=my-bucket-name
AWS_ACCESS_KEY_ID=$EXOKEYHERE
AWS_SECRET_ACCESS_KEY=$EXOSECRETHERE
S3_REGION=ch-dk-2
S3_HOSTNAME=sos-ch-dk-2.exo.io
S3_PROTOCOL=https

Oh yeah i followed this guide

Everything works fine, the site pulls all media files from that bucket.
BUT. It fails uploading new media files to that bucket.
For example when i try and just create a new toot and upload an image, i get this in the logs:

method=POST path=/api/v1/media format=html controller=Api::V1::MediaController action=create status=500 error='Seahorse::Client::NetworkingError: Failed to open TCP connection to my-bucket-name.s3.ch-dk-2.amazonaws.com:443 (getaddrinfo: Name or service not known)' duration=722.12 view=0.00 db=23.13

Why does it use s3.ch-dk-2.amazonaws.com and not the host i provided in S3_HOSTNAME?

I tried commenting out S3_REGION, and then got:

method=POST path=/api/v1/media format=html controller=Api::V1::MediaController action=create status=500 error='Aws::S3::Errors::InvalidAccessKeyId: The AWS Access Key Id you provided does not exist in our records.' duration=1410.25 view=0.00 db=50.97

That key definitely exists.

Maybe any of you have an idea what is going wrong here?
Thanks so much in advance!

Cheers,
Claus.

Mastodon is using a library called “paperclip” to talk to the S3 storage.

I don’t know how Exoscale is supposed to work, but here is an explanation about how the URLs for the storage calls are being constructed:

If S3_ENDPOINT is given there is an additional logic using S3_OVERRIDE_PATH_STYLE variable:

Maybe this is something you can start with

Thanks for the hint! I’m still unsure what i did wrong (if anything) though.

In the meantime i just created a good ole S3 bucket on AWS and things worked on first try. I’ll just go with that for the time being.

AWS is widely used. I think there are some configuration tweaks that may be needed to get it work, maybe there are other that did configure this successfully?

Apparently in addition to S3_HOSTNAME, S3_ENDPOINT must also be set (i did not do that)

S3_ENDPOINT is what Mastodon will use to upload files. S3_HOSTNAME is what will be used in the user’s browser. Both are required.

This is a quote from here: https://angristan.xyz/2018/05/moving-mastodon-media-files-to-wasabi-object-storage/#isso-400 (it’s Wasabi specific, but should apply to Exoscale too).

I’m gonna test if that solves it later tonight.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.