After installing Discourse (2.7.0.beta1
) and importing old Google Groups posts, I added S3 bucket/key configuration (but no CDN URL) and ran
rake uploads:migrate_to_s3
which seemed to be working great. All the images were uploaded to S3 and Discourse was trying to access them via an automatically generated S3 URL-- something like
https://ortus-discourse.s3.dualstack.us-west-2.amazonaws.com/original/1X/75747ca17a3ca01f298f836691e1990916bafccb.png
Then I renamed the bucket (to ortus-discourse-uploads
) and setup a Cloudfront distribution in front of it with a Cloudflare-configured CNAME called
https://communitycdn.ortussolutions.com/
The cname, cloudfront, and S3 are all working great. URLs like this correctly serve up one of the images in the bucket:
https://communitycdn.ortussolutions.com/original/1X/75747ca17a3ca01f298f836691e1990916bafccb.png
However, the issue is that Discourse is completely stuck on the old ortus-discourse.s3.dualstack.us-west-2.amazonaws.com
domain (which doesn’t work due to the bucket being renamed) and no matter how many times I’ve rebuilt the container or rebaked the old posts, I cannot for the life of me get Discourse to use the new CDN URL. I’ve Googled for a day on this and rebaked probably a dozen times (inside the app
container) with various settings. Every forum thread just gives the same advice-- rebuild and rebake, but it isn’t working.
It’s not just the images in posts that are broken, even the <link rel="icon" type="image/png" href="">
and the site logo are stuck on the old domain and won’t use the S3 CDN URL.
Here are my current S3 settings.
DISCOURSE_S3_ACCESS_KEY_ID: '********'
DISCOURSE_S3_SECRET_ACCESS_KEY: '******'
DISCOURSE_BACKUP_LOCATION: 's3'
DISCOURSE_ENABLE_S3_UPLOADS: true
DISCOURSE_S3_BUCKET: 'ortus-discourse-uploads'
DISCOURSE_S3_UPLOAD_BUCKET: 'ortus-discourse-uploads'
DISCOURSE_S3_BACKUP_BUCKET: 'ortus-discourse-backups'
DISCOURSE_S3_REGION: 'us-west-2'
DISCOURSE_S3_CDN_URL: https://communitycdn.ortussolutions.com
DISCOURSE_CDN_URL: https://community.ortussolutions.com
I’ve even tried remapping the old URL to the new URL in posts like so
rake posts:remap["ortus-discourse.s3.dualstack.us-west-2.amazonaws.com","communitycdn.ortussolutions.com"]
but the command said 0 posts affected.
Nowhere in any of my env vars or DB settings do I have anything referencing the old bucket name of ortus-discourse
so I can’t figure out where Discourse keeps getting that from. I’m new to Discourse and not a Ruby dev so I haven’t looked any deeper than what I can see in my app.yml, the admin UI, and the output of the rake commands I’ve found on the forums.