Cloudflare R2 buckets can be used to store static assets like images and GIFs for the Discourse community, but they cannot be used to store community backups!
Introduction:
Cloudflare R2 object storage can be used as an alternative to Amazon S3 for storing uploads for your Discourse forum. The following steps outline how to configure this.
Configuration Steps:
Enable S3 uploads: Check the box to enable S3 uploads in your Discourse settings.
S3 access key ID: Enter the API key ID for your R2 storage bucket. This is the ID provided when you created an API token for your bucket.
Secret access key: Enter the secret key that was provided when you created the API token granting access to your storage bucket. Important: This secret key is only displayed once, so make sure to back it up securely.
S3 region: You can enter any region, it doesn’t matter for R2.
S3 upload bucket: Enter the name of your R2 storage bucket.
S3 endpoint: Enter the S3 API link for your R2 bucket, which is in the format of https://xxxxxx.com. Refer to the Cloudflare R2 dashboard to find this link.
S3 CDN URL: Enter the public R2.dev storage bucket URL for your bucket. This will also be found in your Cloudflare R2 dashboard.
Completion:
Once these settings are configured, your Discourse forum will be set up to use Cloudflare R2 for storage.
Free Tier Information:
Cloudflare’s R2 service provides a free tier that includes 10 GB of storage, 1 million uploads, and 1 million read operations per month.
Thank you for your feedback. I have carefully read the guide previously, and I believe the advice regarding Cloudflare R2 is incorrect. The article suggests that the Discourse community does not support Cloudflare R2 buckets. However, in reality, Cloudflare R2 is highly compatible with S3 and can perfectly handle image and file uploads and downloads for the Discourse community. This has been verified through practical application on my community (starorigin.net).
It’s much better to put the S3 settings in the yml file than configure them via the UX and store them in the database. Have you tried restoring your database to a new server?
Once you’ve set things up the recommended way, you can edit that topic or make a comment and ask someone else to.
You’re right, I use a Cloudflare R2 storage bucket to store my community’s images, GIFs, and other resources. This greatly reduces the load on the community server and speeds up page loading.
I haven’t set up automatic backups for my community to be stored in the Cloudflare R2 storage bucket because Cloudflare R2 buckets do not support storing compressed files. However, Cloudflare R2 storage can store the community’s PDFs, images, GIFs, and other static resources, which is also very good.
Thank you for the reminder, I will highlight this part.
Cloudflare R2 buckets can be used to store static assets like images and GIFs for the Discourse community, but they cannot be used to store community backups!