YJK

独立世界

Independent World
twitter
telegram

Mastodon uses Cloudflare R2 object storage.

Reminder to everyone to carefully consider when choosing an object storage service provider, and not to relax the requirements for resource security and reliability just for the sake of pursuing free services.

In order to pursue free services, my Mastodon instance has been using Scaleway S3 as a static resource repository. However, we previously encountered a serious availability issue that resulted in the inability to access the uploaded images. To prevent similar situations from happening again, I had to migrate the resources from Scaleway S3 to Cloudflare R2 overnight.

R2 has relatively low prices and no fixed monthly fees:

ServiceFree AllowanceCost
Storage10 GB/month$0.015/GB
Class A operations: State changes1 million/month$4.50/million operations
Class B operations: Read existing state10 million/month$0.36/million operations

Configuring Mastodon with Cloudflare R2 has a small caveat - permissions must be set in order to successfully upload. This needs to be set in .env.production:

S3_PERMISSION=private

The complete configuration is as follows:

S3_ENABLED=true
S3_PROTOCOL=https
S3_REGION=auto
S3_ENDPOINT=https://[HIDDEN].r2.cloudflarestorage.com
S3_HOSTNAME=pub-[HIDDEN].r2.dev
S3_BUCKET=[HIDDEN]
S3_PERMISSION=private
AWS_ACCESS_KEY_ID=[HIDDEN]
AWS_SECRET_ACCESS_KEY=[HIDDEN]
S3_ALIAS_HOST=s3assets.mastodon.instance
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.