# Configure an S3 compatible object storage provider for uploads

**URL:** https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916
**Category:** Self-Hosting
**Tags:** cdn, configuring, how-to, reference
**Created:** [April 22, 2020, 10:37pm UTC](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916 "2020-04-22T22:37:37Z")
**Posts on this page:** 1
**Showing post:** 474

<div class="post-metadata">

### Author: ![tumbano](https://avatars.discourse-cdn.com/v4/letter/t/7ea924/32.png) [@tumbano](https://meta.discourse.org/u/tumbano)
#### Post date: [March 14, 2025, 2:57pm UTC](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916/474 "2025-03-14T14:57:27Z")

</div>

And it worked 🥳  
Step by step of what I did hoping to help others:

edited app.yml and added

```plaintext
  after_assets_precompile:
    - exec: cd: $home
        cmd: - sudo -E -u discourse bundle exec rake s3:upload_assets
          - sudo -E -u discourse bundle exec rake s3:expire_missing_assets

```

after hooks: (just after git clone plugins…)  
and

```plaintext
  DISCOURSE_USE_S3: true
  DISCOURSE_S3_REGION: EU
  DISCOURSE_S3_ENDPOINT: https://contabostorage.com/bucketname
  DISCOURSE_S3_ACCESS_KEY_ID: accesskey
  DISCOURSE_S3_SECRET_ACCESS_KEY: secretaccesskey
  DISCOURSE_S3_CDN_URL: https://eu2.contabostorage.com/randomlettersthatcontaboaddstothelinks:bucketname
  DISCOURSE_S3_BUCKET: eu2
  DISCOURSE_BACKUP_LOCATION: s3
  DISCOURSE_S3_INSTALL_CORS_RULE: false

```

after the email settings  
then I’ve set the same values in discourse menu and enabled S3 uploads.  
Rebuilt the app with

```plaintext
cd /var/discourse
sudo ./launcher rebuild app

```

then

```plaintext
./launcher enter app
rake uploads:migrate_to_s3

```

This takes a bit, in my case a few hours (80k files, 100GB)

When finished

```plaintext
rake posts:rebake_uncooked_posts

```

---

_[View the full topic](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916)._
