使用 BunnyCDN 设置 BackBlaze S3

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 个赞

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

1 个赞

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 个赞

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 个赞

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 个赞

嘿,我只是想进来告诉你,Bunny 也与 Backblaze 达成了合作!因此,从 Backblaze 迁移到 Bunny 现在完全免费了,所以,除了更高的安全性之外,你还可以直接将数据迁移到 Bunny,而无需经过 Cloudflare!

2 个赞

这个步骤是不是有点多余?我想更好的问题可能是……如果您已经设置了 Backblaze 用于存储,并将 Bunny 用作 CDN,那么采取这一额外步骤的好处有多大?任何见解对我来说都将非常有帮助。:folded_hands:

我需要一些帮助。过去两天我一直在钻研(请原谅这个兔子双关语),试图将备份和图像上传到 Backblaze。

我使用了这个论坛帖子和其他帖子来尝试设置。现在我不断收到备份的错误消息(尽管我还没有设法让上传工作,但首先是备份)。

我已经设置了 Backblaze 中的存储桶、密钥和拉取区域。

这些是 S3 的“所有站点设置”中的设置

这些是“备份设置”中的设置

这是我的 app.yml - 第二个被注释掉的部分,我昨天在玩它,但它导致 Discourse 卡在加载屏幕上。

当我运行备份时,我得到这个屏幕,我猜是因为我没有让上传部分工作。这可能无关紧要,但我想我应该加上它。

这是备份的错误日志

这是错误日志

我还应该提到我运行了 Rake 任务

rake uploads:migrate_to_s3
rake posts:rebake

我花了两天时间试图让它工作,我的大脑都在打转。有人能帮我弄清楚我哪里出错了?我希望我已经包含了排除故障所需的一切。:tired_face:

1 个赞

如果您的 yml 文件中有这些设置,它们将不会显示在系统设置中。

我将遵循 为上传配置 S3 兼容对象存储提供商

您好,感谢您的回复。我昨天确实尝试了那个链接,但它无法工作,导致网站加载停止。

我目前能达到的最大范围是我现在的设置。不过,它似乎在抱怨区域无效,我不确定需要更改哪个设置。

那是因为你错过了顶部将资产上传到 s3 的部分

我添加了 hooks 代码,并再次使用了您提供的链接中的配置。它又卡住了。

我再次注释掉了该配置,并恢复了之前的配置。我注意到我设置的 s3 区域是完整的 URL,所以我将其更改为“us-west-002”。

现在当我运行备份时,它会失败并出现不同的错误 - EXCEPTION: Unsupported header ‘x-amz-checksum-crc32’ received for this API call。

我想我可能会放弃,每天手动下载备份。

我一直坚持尝试让它奏效,甚至冒着失去理智的风险 :wink:

所以,我通过这个解决了最后一个校验和错误 - Can't rebuild due to AWS SDK gem bump and new AWS Data Integrity Protections - #28 by PatPatterson

这是通过在 app.ymlenv 部分添加以下内容来实现的

AWS_REQUEST_CHECKSUM_CALCULATION: WHEN_REQUIRED
AWS_RESPONSE_CHECKSUM_VALIDATION: WHEN_REQUIRED

并在 app.ymlhooks 部分注释掉这个

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

其他的 env 设置如下

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

在我包含 DISCOURSE_INCLUDE_S3_UPLOADS_IN_BACKUPS: true 之前,我运行了一个备份

并且成功备份到了 Backblaze。太棒了!!!

当我将 app.yml 中的行添加到包含上传时,备份出现了一个错误,如下所示

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: No such file or directory
tar: Exiting with failure status due to previous errors

我不确定这个目录应该在哪里,或者如何修复它。是我需要在 discourse 服务器或 Backblaze 上创建的目录吗?还是我在站点设置或 app.yml 中遗漏了某个设置?

任何指导都将不胜感激。

1 个赞