# איך להגדיר את Cloudflare R2 לקהילת Discourse שלך

**URL:** https://meta.discourse.org/t/how-to-configure-cloudflare-r2-for-your-discourse-community/349512
**Category:** Self-hosting
**Tags:** cloudflare, hosting
**Created:** [29 בינואר,‏ 2025,‏ 6:59am UTC](https://meta.discourse.org/t/how-to-configure-cloudflare-r2-for-your-discourse-community/349512 "2025-01-29T06:59:26Z")
**Posts on this page:** 1
**Showing post:** 32

<div class="post-metadata">

### Author: ![kcahtoor](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@kcahtoor](https://meta.discourse.org/u/kcahtoor)
#### Post date: [15 בספטמבר,‏ 2026,‏ 1:50am UTC](https://meta.discourse.org/t/how-to-configure-cloudflare-r2-for-your-discourse-community/349512/32 "2026-09-15T01:50:17Z")

</div>

For multisite, for my understandingwhat you are are already doing, you want only one instance using R2. If your settings are in admin settings. You need to use `USE_DB_S3_CONFIG=true` with `RAILS_DB=default` for it and will work like a charm

```plaintext
hooks:
  after_assets_precompile:
    - exec:
        cd: $home
        cmd:
          - sudo -E -u discourse RAILS_DB=default USE_DB_S3_CONFIG=true bundle exec rake s3:upload_assets
          - sudo -E -u discourse RAILS_DB=default USE_DB_S3_CONFIG=true bundle exec rake s3:expire_missing_assets

```

For migration of uploads you need to export these variables like below or one by one.

```plaintext
RAILS_DB=default \
DISCOURSE_S3_REGION=auto \
DISCOURSE_S3_ENDPOINT=https://<account-id>.r2.cloudflarestorage.com \
DISCOURSE_S3_BUCKET=discourse-files \
DISCOURSE_S3_ACCESS_KEY_ID=<your-access-key> \
DISCOURSE_S3_SECRET_ACCESS_KEY=<your-secret-key> \
rake uploads:migrate_to_s3

```

If you are planning on putting it in app.yml make sure to use `DISCOURSE_S3_BUCKET` because there is typos in R2 section of [Configure an S3 compatible object storage provider for uploads](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916?tl=en)

---

_[View the full topic](https://meta.discourse.org/t/how-to-configure-cloudflare-r2-for-your-discourse-community/349512)._
