REQ: Support S3 backup to a service like Backblaze

I would like support of backup to a backblaze destination.

At the moment Im not able to set a endpoint like: s3.eu-central-003.backblazeb2.com

1 Like

Just in case you haven’t seen this: Using Object Storage for Uploads (S3 & Clones)

4 Likes

Nope I had not… Now I have :slight_smile:

But then again you need a ph.d to be able to do a simple thing. For futrure release Admin Usability could be an issue.

Discourse have many advance features - but they are also too advance to use for an average user (me ::slight_smile: )

By the way - I only want the backup to be stored remote from the server.

No need for upload like images etc is stored on a CDN. My forum is not that big or have that high usage…

Its on a simple 5 dollars droplet…

Oh, that should be quite simple then. Though if it’s not too big, maybe it’s just less hassle to use AWS S3? Their pricing isn’t too bad for storage, it’s just kind of hectic for bandwidth.

I think you’d just need to put this in your app.yml with the correct info and rebuild. It’s excluding the parts that are for user uploads. You wouldn’t need to include the after_assets_precompile other part from the tutorial.

Just SSH into your server as root then run:
cd /var/discourse
nano containers/app.yml

Use the keyboard arrows to move the curser around and paste in the info below underneath the part of the file that says: #DISCOURSE_CDN_URL: https://discourse-cdn.example.com

  DISCOURSE_S3_REGION: "us-west-002"
  DISCOURSE_S3_INSTALL_CORS_RULE: false
  DISCOURSE_S3_ENDPOINT: https://s3.us-west-002.backblazeb2.com
  DISCOURSE_S3_ACCESS_KEY_ID: myaccesskey
  DISCOURSE_S3_SECRET_ACCESS_KEY: mysecretkey
  DISCOURSE_S3_BACKUP_BUCKET: falcoland-files/backup
  DISCOURSE_BACKUP_LOCATION: s3

Make sure you’ve put the correct info in for the region, endpoint, access key, secret key and backup bucket name.

Press ctrl+o and confirm to save, then press ctrl+x to exit. Then run:
./launcher rebuild app

Fairly confident it should work fine.

Seeing you are on Digital Ocean, it’d be a good idea to make a backup before you do this though. So rolling back is easy if something goes wrong.

2 Likes

Thanks for the description @markersocial

I did go to https://secure.backblaze.com/b2_buckets.htm and created a new bucket

I then went to App Keys to create a new app key for access

After the creation you temporary gets an info like below - be aware you only see this once:

Skærmbillede 2020-08-27 kl. 10.49.20

Based and that I used:

DISCOURSE_S3_REGION: “s3.eu-central-003”
DISCOURSE_S3_INSTALL_CORS_RULE: false
DISCOURSE_S3_ENDPOINT: https://s3.eu-central-003.backblazeb2.com
DISCOURSE_S3_ACCESS_KEY_ID: myaccesskey
DISCOURSE_S3_SECRET_ACCESS_KEY: mysecretkey
DISCOURSE_S3_BACKUP_BUCKET: my_buckets_Name
DISCOURSE_BACKUP_LOCATION: s3

Then I did a rebuild after I did make a snapshot of my droplet at digital ocean

./launcher rebuild app

I then went to /admin/backups and made a backup

[2020-08-27 09:25:57] Creating archive: studmed-dk-2020-08-27-092518-v20200820232017.tar.gz
[2020-08-27 09:25:57] Making sure archive does not already exist…
[2020-08-27 09:25:57] pg_dump: executing SEQUENCE SET topic_allowed_users_id_seq
[2020-08-27 09:25:57] Creating empty archive…
[2020-08-27 09:25:57] Archiving data dump…
[2020-08-27 09:25:59] Archiving uploads…
[2020-08-27 09:26:06] Removing tmp ‘/var/www/discourse/tmp/backups/default/2020-08-27-092518’ directory…
[2020-08-27 09:26:06] Gzipping archive, this may take a while…
[2020-08-27 09:26:31] Uploading archive…
[2020-08-27 09:26:41] Executing the after_create_hook for the backup…
[2020-08-27 09:26:41] Deleting old backups…
[2020-08-27 09:26:41] Cleaning stuff up…
[2020-08-27 09:26:41] Removing archive from local storage…
[2020-08-27 09:26:41] Removing ‘.tar’ leftovers…
[2020-08-27 09:26:41] Marking backup as finished…
[2020-08-27 09:26:41] Refreshing disk stats…
[2020-08-27 09:26:42] Notifying ‘frold’ of the end of the backup…
[2020-08-27 09:26:53] Finished!

Then I went to backblaze to see if anything happend there:

Skærmbillede 2020-08-27 kl. 11.28.51

I owe you a :beers:

4 Likes

Nice work! If anyone else stumbles here, I believe that if you provide a key that can create buckets, discourse will even create the bucket for you.

1 Like

Closing as this is supported out of the box by following Using Object Storage for Uploads (S3 & Clones)

3 Likes