Set up BackBlaze S3 with BunnyCDN

So I checked BunnyCDN. I can verify that it did not go through the CDN for the backup. The traffic says 0 KB. The host CDN url is different from the upload one so it seems Discourse isn’t using it. However, I can verify that the backups are being uploaded to Backblaze B2 from Discourse.

1 Like

Ah, great, thank you for checking. That confirms what I suspected. Perhaps @Bill should update the OP guide?

1 Like

Sure! Not sure how to word it. Should I just put that you only need one pull zone and the CDN cannot access a private bucket?

1 Like

I would eliminate everything from ‘On your BunnyCDN dashboard, you should create a second pull zone’ up thru the paragraph ending with ‘“standard tier 10$/TB” that I used my for uploads bucket.’

Also, it seems you do need a second CDN pull zone, but it’s not for the backup. I was confused about this, and couldn’t get offsite uploads working until I correctly set up one pull zone to send uploads to BackBlaze (as you outlined) and a second pull zone to pull assets from BackBlaze. See my question about that and the response I got here for more info.

It looks like I don’t have the discourse permissions for editing the original thread anymore, it probably expired after a set time or I edited it too many times. I cant get to the edit area.

Ah, ok. I guess you would need to ask a mod. In any case, even though there was a glitch, I was grateful for your how-to!

1 Like

The first post is a wiki now (it was when I checked it, not sure if someone got to it before now) so any TL1 or higher user can edit it.

2 Likes

Hey, just want to hop in and say that Bunny has gotten a partnership with Backblaze too ! So, the transfer from Backblaze to Bunny is now completely free, so, appart for more security, you can just transfer the data to Bunny without passing through cloudflare !

2 Likes

Is this step overkill? I guess a better question might be… how significant are the benefits of taking this extra step if you already have Backblaze set up for storage and Bunny as the CDN? Any insights on this would be super helpful for me. :pray:

I need some help. I went down the rabbit hole (pardon the bunny pun) for the last two days, trying to get backups and images to go to Backblaze.

I used this forum post and others to try and set it up. Now I keep getting and error message on the backups (though still have not been able to get the uploads to work but first things first with the backups)

I have setup buckets in Backblaze, keys and the pull zones.

These are the settings in All Site Settings for S3

These are the settings in the Backup Settings

This is my app.yml - the second section that is commented out, I was playing around with yesterday but it was causing Discourse to hang at the loading screen.

When I run backups I get this screen, I guess because I have not got the uploads part working. It may be irrelevant but thought I should add it.

This is the error log on the backup

This is the error log

I should also mention I ran the Rake tasks using

rake uploads:migrate_to_s3
rake posts:rebake

My brain is doing loops after two days of trying to get it to work. Can anyone help me figure out where I am going wrong? I hope I have included everything needed to troubleshoot. :tired_face:

1 Like

If you have the settings in your yml file they won’t show up in the system settings.

I would follow Configure an S3 compatible object storage provider for uploads

Hi thanks for the reply. I did try that link yesterday and it did not work. It stopped the site loading.

The furthest I have been able to get is with the current settings I have. Though it seems to be complaining about an invalid region and I’m not sure what setting I need to change.

That’s because you missed the part at the top that uploads assets to s3

I added the hooks code and used the configuration from the link you posted again. It hangs again.

I commented that configuration out again and put the one I was using above back in. I noticed that the s3 region setting I had was the full url so I changed it to be ‘us-west-002’

Now when I run the backup, it fails and I get a different error - EXCEPTION: Unsupported header ‘x-amz-checksum-crc32’ received for this API call.

I think I might give up and just go in and manually download the backups everyday.

I have persisted trying to get this to work at the risk of losing my mind :wink:

So the last checksum error I got I resolved with the help of this - Can't rebuild due to AWS SDK gem bump and new AWS Data Integrity Protections - #28 by PatPatterson

That was done by adding the following to the env section in app.yml

AWS_REQUEST_CHECKSUM_CALCULATION: WHEN_REQUIRED
  AWS_RESPONSE_CHECKSUM_VALIDATION: WHEN_REQUIRED

And commenting out this in the hooks section of app.yml

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

the other env settings are set to this

DISCOURSE_S3_ACCESS_KEY_ID: 'key'
  DISCOURSE_S3_SECRET_ACCESS_KEY: ‘key’
  DISCOURSE_BACKUP_LOCATION: 's3'
  DISCOURSE_ENABLE_S3_UPLOADS: true
  DISCOURSE_S3_BACKUP_BUCKET: 'backupbucketonbackblaze’
  DISCOURSE_S3_REGION: 'us-west-002'
  DISCOURSE_INCLUDE_S3_UPLOADS_IN_BACKUPS: true

I ran a backup before I included the DISCOURSE_INCLUDE_S3_UPLOADS_IN_BACKUPS: true

And had a successful backup to Backblaze. YEAH!!!

When I put the line in the app.yml to include uploads the backup had an error which is as follows

EXCEPTION: tar --append --file /var/www/discourse/public/backups/default/my-server-name-2025-04-17-222758-v20250417043438.tar uploads/default
Failed to append uploads to archive.
tar: uploads/default: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors

I am not sure where is directory is supposed to be or how to fix it. Is it a directory I need to create on the discourse server or Backblaze? Or a setting I have missed in the site settings or the app.yml

Any guidance would be greatly appreciated.

1 Like