Using OVH S3 Object Storage on Discourse that using Docker in Centos 7

Using OVH S3 Object Storage on Discourse Deployed with Docker in CentOS 7

In this tutorial, we will guide you on how to effectively use OVH’s S3 Object Storage with Discourse deployed on Docker in CentOS 7. Using cloud-based storage, like OVH S3, is an effective way of managing, storing, and retrieving your Discourse data. It’s also a highly secure and scalable solution, making it suitable for applications of all sizes.

Setting Up OVH S3 Object Storage

First, you’ll need to create a container in the admin area of your OVH Public Cloud. If you haven’t already created a project, you’ll need to do that first.

  1. Navigate to the ‘Storage’ section, then click on ‘Object Storage’.
  2. Add S3 Users. You’ll need to keep a note of the ‘Access_key’ and ‘Secret_key’ that are generated – you’ll use them later.

Now, create an object container. For this tutorial, we’ll create two:

  • ‘mysite-uploads’
  • ‘mysite-backups’

During the creation process, set the region. In this tutorial, we’re using the ‘BHS’ region.

Configuring Discourse to Use OVH S3 for Uploads

With OVH S3 setup, you can now configure Discourse to use it for file uploads.

  1. Log in to Discourse as an admin and navigate to ‘Settings’, then ‘Files’.
  2. Enable ‘s3 uploads’ and add your ‘s3 access key id’ and ‘s3 secret access key’.
  3. Set the region (temporarily, as you’ll update it later using Docker CLI postgres).
  4. Set ‘s3 upload bucket’ to ‘mysite-uploads’.
  5. Set ‘s3 endpoint’ to ‘https://s3.{region}’. If your region is ‘BHS’, then use ‘’.
  6. For ‘s3 cdn url’, use the public URL provided by OVH.

Configuring Discourse to Use OVH S3 for Backups

Similarly, you can also use OVH S3 for Discourse backups.

  1. Still in the admin interface, navigate to ‘Settings’, then ‘Backups’.
  2. Enable ‘backups’.
  3. Change the ‘backup location’ to ‘s3’.
  4. Set the ‘s3 backup bucket’ to ‘mysite-backups’.

Updating Discourse’s S3 Region Setting

Lastly, you’ll need to update the S3 region setting in Discourse to match the one you’ve set in OVH.

  1. Run docker ps in your command line to get your Docker ID.
  2. Next, run docker exec -it {docker-id} su -c 'psql discourse' postgres to access the PostgreSQL shell.
  3. Inside the PostgreSQL shell, run UPDATE site_settings SET value = 'bhs' WHERE name = 's3_region'; to update the S3 region value to ‘bhs’ (or whatever your OVH S3 region is).
  4. Exit the shell by typing \q.

Congratulations, you’ve now successfully configured Discourse to use OVH S3 Object Storage for uploads and backups.


Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.