After upgrading Discourse from 1.6.2 to 1.6.4, ljpp experienced a site outage (521 error) due to a broken Cloudflare template in their app.yml. The issue stemmed from Cloudflare changing the URL for their IP ranges, which caused nginx to fail parsing set_real_ip_from directives during rebuild. Falco identified the outdated cloudflare.template.yml as the culprit, and mpalmer confirmed the root cause and pushed a fix. After updating the discourse_docker repo and rebuilding, the site came back online successfully ljpp. ljpp suggested improving error handling during rebuilds to fail explicitly if Cloudflare’s IP list can’t be fetched. The issue would have occurred regardless of whether the upgrade was done via CLI rebuild or admin front-end mpalmer. Chopper noted that the Cloudflare template is still needed to avoid IP-based registration throttling, referencing a related topic on user IPs being masked as 127.0.0.1. The fix restored real IP resolution for users behind Cloudflare.
1.6.2 → 1.6.4 via git pull and ./launcher rebuild app
It went cleanly.
Installed a few updates available to Ubuntu 16.04 server
Rebooted
Now the site refuses to come back online. Now this stuff goes beyond my linux sysadmin skillz.
From what I can see, Docker is running and so does the app. I see relevant processes (ruby etc) starting, but basically idling. The site is reporting a 521 error. Tried re-rebuild a couple of times, but no luck. The installation is originally made with Discourse 1.5b in December, but switched to stable branch when it was released in April.
I would guess that http requests are not correctly routed, but I have not touched any settings or parameters of that field. This is basically a default installation. I do not have Let’s Encrypt or other certificate enabled.
Anyone seen similar recently?
Newbie friendly tips on how to start diagnosing and fixing?
There seems to be a flood of errors in nginx/error.log
2016/09/28 12:32:09 [emerg] 977#977: invalid number of arguments in "set_real_ip_from" directi$
/# nginx -t
nginx: [emerg] invalid number of arguments in "set_real_ip_from" directive in /etc/nginx/conf.d/discourse.conf:56
nginx: configuration file /etc/nginx/nginx.conf test failed
But @falco , what the heck was actually changed and why? This was a minor security update in the stable branch. CloudFlare is awesome in many ways – saves a ton of bandwidth, blocks bad bots etc.
Cloudflare changed the URL they list their IP ranges from. I’ve pushed out a fix; could you update your discourse_docker repo and try the rebuild again? If it doesn’t work, dump the full output of the rebuild command into a gist so I can take a look at what’s going wrong.
The fail was triggered by the rebuild, while the root cause is Cloudflare changing the URL we need to retrieve to get the list of IP ranges that are Cloudflare’s own, for the purposes of setting the set_real_ip_from config parameter.