What happends if you comment out DISCOURSE_CDN_URL
?
I havenāt done that. But I have been troubleshooting and I strongly believe that I did not set up the S3 CDN correctly. I am using StackPath and I am not sure what to use in the Origin address and the Host header
Another thing I am not sure of is how to set up the file listing feature of my DigitalOceanās Space bucket. Now, I am using Restrict Listing. Does this affect anything?
I commented out DISCOURSE_S3_CDN_URL and the site loads. This confirms that my setup of the S3 CDN is the problem but I still donāt know how to set it up correctly.
I will really appreciate any help.
Did you complete all tasks in the Configuration section?
If I remember correctly, setting DISCOURSE_S3_CDN_URL in app.yml requires that assets are stored on S3.
I donāt know much how Discourse works. Iām just another copy&pasting webmaster from PHP-world, but Iām still wondering why there would be need to declare same CDN twice.
I donāt use DISCOURSE_CDN_URL because I have DISCOURSE_S3_CDN_URL (and propably any doc I red didnāt guide to use it). So I tried.
I added DISCOURSE_CDN_URL: <cdn-url>
. Rebuilding gave no errors, but I got error 502. When I removed it my forum worked again.
Still your issues can happend because of some misconfiguration somewhere else. But I like easy solutions, even when Iām wrong, and Iām blaiming situation when you are telling twice CDN for different needs. Or something.
DISCOURSE_CDN_URL and DISCOURSE_S3_CDN_URL are different. While DISCOURSE_CDN_URL points to your forum, DISCOURSE_S3_CDN_URL points to your S3 storage URL.
The idea is for DISCOURSE_CDN_URL to serve pullable assets like CSS while DISCOURSE_S3_CDN_URL serves pushable assets like JS, images and user uploads.
I have been able to get everything working but my S3 storage CDN. Whenever I enable that bit in the app.yml file, my forum displays blank.
A look at the browser inspect element network shows that assets delivered by DISCOURSE_S3_CDN_URL are showing error 404.
This is where I am stock! I am not sure why the S3 CDN cannot deliver the assets.
Thanks for patient explanation!
That is quite⦠unfamiliar for me. But as I said, I have very limited experiense. Iām using AWS as CDN thru S3/CloudFlare in WordPress but only for static files ā scripts would need another setup. I reckon there is no point to compare WP and Discourse because those are fundamentally so different platforms. But Iām trying to understand principles of he concept here.
Well, I got much more now than you
EDIT: Aaaand I was totally wrong at my setup too All JS, images, etc are served thru CDN. But I couldnāt find CSSā there.
Yes, they are. But thanks for the update.
Hi @Jagster I really will appreciate your help.
The problem I am having now is that my site is trying to load .gz.js assets from the Object Storage CDN but the files are not there. How do I force Discours to upload those .gz.js assets to the Object Storage?
Thatās what this bit in the guide does:
I already have that line in my app.yml. I put the above code after defining the plugins. Or do I move them above the plugin lists?
Thatās wrong. The after_assets_precompile
YAML key must be under the hooks
key.
By default we ship as:
## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- git clone https://github.com/discourse/docker_manager.git
and you want
## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- git clone https://github.com/discourse/docker_manager.git
after_assets_precompile:
- exec:
cd: $home
cmd:
- sudo -E -u discourse bundle exec rake s3:upload_assets
But what about the other plugins? Is it okay to list them below
- sudo -E -u discourse bundle exec rake s3:upload_assets ?
No.
It will become:
## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- git clone https://github.com/discourse/docker_manager.git
- git clone https://github.com/discourse/docker_manager.git
- git clone https://github.com/discourse/docker_manager.git
- git clone https://github.com/discourse/docker_manager.git
- git clone https://github.com/discourse/docker_manager.git
after_assets_precompile:
- exec:
cd: $home
cmd:
- sudo -E -u discourse bundle exec rake s3:upload_assets
YAML is tree-like data structure and white space indentation defines the structure.
With the guidance you (@Falco) and @pfaffman provided, I have just successfully completed this configuration.
For other community members that wish to see my configurations. Here are the screenshots. I also wrote a comprehensive guide while I was configuring all these.
I used StackPath and DigitalOcean Spaces. My guide includes a step by step of the whole configuration. If anybody needs this guide, I will be happy to post the URL when requested.
@Falco and @pfaffman thank you both so much for your help. This is my first time configuring Discourse but I have just completed the most difficult bits (I think!). I am very grateful!.
So itās working now?
Perfectly. It took me so long but apart from the fact that it is working, I have also learned so much about Discourse configuration!
Thank you!