I may need to split this into three separate posts, but they are related, so I’ll start with one.
A few days ago, I used this tutorial (How to Scale a Discourse Deployment with a Load Balancer and Managed Database Cluster | DigitalOcean) pretty much to the word and migrated my standalone Discourse Droplet on Digital Ocean to two Droplets inside a Load-Balancer, so far so good.
I then went through this tutorial (Configure an S3 compatible object storage provider for uploads) but after rebuilding discourse from the command line my Discourse site was only displaying a blank screen. I looked in Inspector in the browser to find that the browser was blocking all of my content because it was being served from HTTP and not HTTPS. This is probably because the load balancer is SSL Terminated, so everything external is HTTPS, but the servers themselves are running on HTTP.
At this point, I completely broke my servers again, trying to make them work with HTTPS inside the Load-Balancer, but it was simply not possible. I could not get the Digital Ocean Space/CDN to work with S3/CDN according to this tutorial (Configure an S3 compatible object storage provider for uploads). I went through it with a fine-toothed comb and inspected every aspect multiple times, but it would not work. The only way I could get Discourse to rebuild was to remove the
DISCOURSE_S3_ENDPOINT: https://sfo3.digitaloceanspaces.com parameter from app.yml, but then even though it had built, I couldn’t get the server to respond. I got either a 503 server not responding error or a regular browser server not responding or server disconnected error. It differed based on the Load-Balancer and DO Space/CDN settings I was trying. I tried every possible combination of settings and nothing would enable me to serve a page.
When I left the DISCOURSE_S3_ENDPOINT parameter in place I got the following error during the Discourse rebuild, but this disappeared when I comment out the S3_ENDPOINT parameter.
All of my files were synced to S3, so I think it’s safe to assume the Access Key was fine, and the problem was caused by the S3_ENDPOINT parameter somehow.
Today, I gave up trying to get the previous attempt working, and restored a backup of my Droplets that were just Load-Balancing with just HTTP and finally did get it working again by doing this tutorial (Set up file and image uploads to S3) but this time I edited the S3 settings via the Discourse Admin panel rather than editing the app.yml with the settings in the recommended tutorial. It finally worked, but the important difference is that I deliberately left out the S3 CDN settings. I have confirmed that images uploaded to posts are being stored on S3 and I can backup Discourse directly to S3, and this is really all I want, but, I now have three issues that are hounding me, one is critical, and two are ignorable, although I’d like to confirm that here if possible.
So, the critical issue is that users can no longer login using the Patreon login button on the Discourse login page. This message is displayed:
Sorry, there was an error authorizing your account. Please try again.
I would really appreciate some advice on what I could possibly try to get this working, but again, I’m wondering if this is because internally the servers are not running HTTPS. As you can see from the URL, externally they are on HTTPS, so it’s hard to know for sure. I guess I’m hoping someone here has some experience with the Digital Ocean Load-Balancing etc. with Discourse.
The other two issues are being called out now in the Admin Console as below:
- Your website is using SSL. But
[force_https](https://mbp.community/admin/site_settings/category/all_results?filter=force_https)is not yet enabled in your site settings.
- The server is configured to upload files to S3, but there is no S3 CDN configured. This can lead to expensive S3 costs and slower site performance. See “Using Object Storage for Uploads” to learn more.
So, I don’t mind trying to turn on force_https, but I’m worried that it will lock me out of my server because internally the load-balanced servers are not running on HTTPS and due to the problems I had yesterday, I am reluctant to spend another twelve hours banging my head against a brick wall watching countless 15-minute rebuilds of Discourse only to get nowhere. Again, if anyone knows that it’s safe to turn on force_https with my configurations, please let me know.
And the second issue, again, did not go well via the parameters added to the app.yml file, so I’m reluctant to try this again as well. Can you confirm that this would essentially do the same as parameters added to the app.yml file? If so, I’ll just ignore this second message. Conversely, if it is for some reason safe to try, let me know and I’ll make a backup and give it a pop.
Sorry for the long post. I hope you can figure out what I’m trying to get advice on.