It’s set in the example configuration block for Vultr in the OP. Copy and paste into your app.yml and adjust the necessary fields.
Thanks, I missed this bit:
This isn’t going smoothly for me, sorry to reply so many times.
If I do the above, should I ignore the admin panel settings for s3 and backups?
Or should admin panel settings be configured as well?
You just need to follow this guide here in the OP and you will get a functional object storage configuration.
Setting those variables makes them unavailable from the UX. You must set them as described here rather than the ux.
I think it’s (mostly?) working now, but is this content security policy script src safe?
I’m using AWS for two S3 containers (for uploads & backups), and two CloudFront CDNs (for files & assets). When I use my own CNAMEs for the CloudFront CDNs, I get a bunch of script-src network errors in my browser when loading Discourse. No more errors after adding those entires to my CSP.
Are those the urls you put in the env variables described in the OP? And are they https?
Yes, I don’t have script-src warnings when I put the two d23whatever.cloudfront.net URLs in the env variables. When I put my custom URLs, i.e. community-cdn.mydomain and files-cdn.mydomain, in the env variables, that’s the time I get these script-src warnings. And apparently the stripe js is still giving me this warning even though it’s in my content security policy script src.
我设置了 S3 上传 和对象存储,如 OP 中所述,但没有 CDN。
对于 DISCOURSE_S3_CDN_URL 变量,我有这个:
https://my-bucket-uploads.s3.dualstack.us-west-2.amazonaws.com
一切似乎都正常,包括备份,但是,在控制台中,当回复帖子时,会出现此错误:
错误中的请求 URL 实际上是两个 URL 的字符串,这似乎是原因?
https://mydiscourse.com/t/uploads-test-for-s3/79/https://my-bucket-uploads.s3.dualstack.us-west-2.amazonaws.com/assets/markdown-it-bundle-a7328b73d3e7b030770eab70f10bdb0af655b3d8fa929bc49f1ad04c4cdaa198.br.js
CDN 是其正常工作的必备条件。
我也遇到了同样的情况,配置了对象存储(minio)但没有 CDN。这是否是一个可以支持的用例?
根据我目前测试的来看,只有 markdown-it-bundle 这个 js 文件有问题,因为它指向了错误的 URL - DISCOURSE_HOSTNAME/DISCOURSE_S3_CDN_URL/assets/markdown-it-bundle-HASH.br.js
这看起来像是一个 bug,如果我设置了 DISCOURSE_CDN_URL 变量,它仍然会以 DISCOURSE_HOSTNAME/DISCOURSE_CDN_URL/assets/markdown-it-bundle-HASH.br.js 的形式指向错误的 URL。
它实际上应该指向 DISCOURSE_S3_CDN_URL/assets/markdown-it-bundle-HASH.br.js
其他的 js 资源都指向正确的 URL。
我猜从你的话来看,我还会遇到其他尚未发现的问题。也许你可以提供更多关于可能出错的信息?
如果我理解得没错,js 资源在对象存储上,样式表应该在 CDN 上。没有 CDN 的情况下,样式表是否可以像往常一样由应用程序提供?(从我看到的情况来看,确实是这样)
感谢你的帮助。
根据 OP 的说法,这不是一个支持的用例:
各位好:
我使用 Lightsail 设置了一个新的 Discourse 服务器,并参考了这篇关于 S3 上传和备份的指南:setting-up-file-and-image-uploads-to-s3
设置完成后,我在上传图片时屏幕上出现了“存储桶不允许 ACL”的错误。
这是我的 S3 策略:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:GetObjectVersionTagging",
"s3:CreateBucket",
"s3:GetObjectAcl",
"s3:GetBucketObjectLockConfiguration",
"s3:PutLifecycleConfiguration",
"s3:GetObjectVersionAcl",
"s3:PutObjectTagging",
"s3:DeleteObject",
"s3:DeleteObjectTagging",
"s3:GetBucketPolicyStatus",
"s3:GetObjectRetention",
"s3:GetBucketWebsite",
"s3:ListJobs",
"s3:DeleteObjectVersionTagging",
"s3:GetObjectLegalHold",
"s3:GetBucketNotification",
"s3:PutBucketCORS",
"s3:GetReplicationConfiguration",
"s3:ListMultipartUploadParts",
"s3:PutObject",
"s3:GetObject",
"s3:DescribeJob",
"s3:PutObjectVersionAcl",
"s3:GetAnalyticsConfiguration",
"s3:GetObjectVersionForReplication",
"s3:GetLifecycleConfiguration",
"s3:GetAccessPoint",
"s3:GetInventoryConfiguration",
"s3:GetBucketTagging",
"s3:GetBucketLogging",
"s3:ListBucketVersions",
"s3:ReplicateTags",
"s3:ListBucket",
"s3:GetAccelerateConfiguration",
"s3:GetBucketPolicy",
"s3:GetEncryptionConfiguration",
"s3:GetObjectVersionTorrent",
"s3:AbortMultipartUpload",
"s3:PutBucketTagging",
"s3:GetBucketRequestPayment",
"s3:GetAccessPointPolicyStatus",
"s3:GetObjectTagging",
"s3:GetMetricsConfiguration",
"s3:PutObjectAcl",
"s3:GetBucketPublicAccessBlock",
"s3:ListBucketMultipartUploads",
"s3:ListAccessPoints",
"s3:PutObjectVersionTagging",
"s3:GetBucketVersioning",
"s3:GetBucketAcl",
"s3:GetObjectTorrent",
"s3:GetAccountPublicAccessBlock",
"s3:ListAllMyBuckets",
"s3:GetBucketCORS",
"s3:GetBucketLocation",
"s3:GetAccessPointPolicy",
"s3:GetObjectVersion"
],
"Resource": [
"arn:aws:s3:::mybucket-upload",
"arn:aws:s3:::mybucket-upload/*",
"arn:aws:s3:::mybucket-backup",
"arn:aws:s3:::mybucket-backup/*"
]
}
]
}
这是我的 S3 存储桶公共访问设置:
有人能帮我解决这个问题吗?
非常感谢!
此致,
Quang
我的暂存网站应该使用与我的生产网站相同的 S3 存储桶吗?
不,那将非常不安全,它可能会删除在其他环境中仍应存在的文件的,并更改其他环境中的文件(这可能导致文件丢失、文件错误等)。
存储桶和凭据都应不同(并且暂存凭据不应访问生产存储桶,尤其是在写入和删除操作方面)。
也许可以使用具有不同凭据的路径来访问每个路径,但弄巧成拙的可能性很高,因此我建议使用单独的存储桶。
DISCOURSE_CDN_URL 和 DISCOURSE_S3_CDN_URL 也需要分开吗?
我猜是的,因为如果您的暂存和生产域/URL不同(它们是不同的,不是吗?),那么DISCOURSE_CDN_URL(最终指向CDN提供商,它指向您的网站域)应该与暂存和生产环境不同。同样的逻辑也适用于DISCOURSE_S3_CDN_URL(因为不同的存储桶应该有不同的URL)。
大家好,我是 S3 的新手,不太确定如何表述,但我会尽力而为。我刚开始使用 S3 进行上传和备份,并且我一直在使用 Discourse Connect 来允许登录我网站的其他部分,但现在个人资料图片无法正常显示。我认为这与 CORS 策略有关,但不确定在哪里可以配置它。我理想情况下希望将其列入白名单,用于 forum.domain.tld 和 domain.tld - 或者所有子域名的通配符也可以。这是我应该在 Discourse 中设置的吗,还是在哪里设置?我使用的是 Vultr 对象存储,如果这有区别的话。
是否可以在 files S3 存储桶上启用版本控制?AWS Backup 是备份 Discourse 的 S3 存储桶的推荐方法吗?
是的。
使用版本控制或同步到另一个区域都是很好的策略。



