# Urgent: Site down after upgrade to 1.6.4 due to Cloudflare template

**URL:** https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789
**Category:** Support
**Created:** [2016 年 9 月 28 日午後 12:30 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789 "2016-09-28T12:30:16Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![ljpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ljpp/32/96506_2.png) [@ljpp](https://meta.discourse.org/u/ljpp)
#### Post date: [2016 年 9 月 28 日午後 12:30 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/1 "2016-09-28T12:30:16Z")

</div>

Just ran into a bit of a problem.

I did routine updates to my site [Tappara.co](http://tappara.co):

- 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$

```

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2016 年 9 月 28 日午後 12:36 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/2 "2016-09-28T12:36:24Z")

</div>

That’s odd. You might try rebuilding again.

---

<div class="post-metadata">

### Author: ![ljpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ljpp/32/96506_2.png) [@ljpp](https://meta.discourse.org/u/ljpp)
#### Post date: [2016 年 9 月 28 日午後 12:37 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/3 "2016-09-28T12:37:24Z")

</div>

Did that a number of times already.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2016 年 9 月 28 日午後 12:56 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/4 "2016-09-28T12:56:32Z")

</div>

> [@ljpp](#):
>
> set\_real\_ip\_from

what is your container config?

---

<div class="post-metadata">

### Author: ![ljpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ljpp/32/96506_2.png) [@ljpp](https://meta.discourse.org/u/ljpp)
#### Post date: [2016 年 9 月 28 日午後 2:10 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/5 "2016-09-28T14:10:18Z")

</div>

What do you mean? It’s a standard Discourse setup, according to your install guide. To the letter.

@sam

```plaintext
/# 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
```

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2016 年 9 月 28 日午後 2:34 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/6 "2016-09-28T14:34:18Z")

</div>

Do you have a nginx running outside the container?

---

<div class="post-metadata">

### Author: ![ljpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ljpp/32/96506_2.png) [@ljpp](https://meta.discourse.org/u/ljpp)
#### Post date: [2016 年 9 月 28 日午後 2:46 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/7 "2016-09-28T14:46:25Z")

</div>

No apparently not. (And some filler here, thanks to minimum post length)

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2016 年 9 月 28 日午後 2:49 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/8 "2016-09-28T14:49:19Z")

</div>

Since our nginx version is HARD pinned, I don’t know how would you get a broken version 🤔

On your app.yml you are listening which posts?

---

<div class="post-metadata">

### Author: ![ljpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ljpp/32/96506_2.png) [@ljpp](https://meta.discourse.org/u/ljpp)
#### Post date: [2016 年 9 月 28 日午後 2:51 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/9 "2016-09-28T14:51:17Z")

</div>

```plaintext
## which TCP/IP ports should this container expose?
expose:
  - "80:80" # fwd host port 80 to container port 80 (http)
```

.yml has not been modified in ages.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2016 年 9 月 28 日午後 2:52 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/10 "2016-09-28T14:52:14Z")

</div>

> [@ljpp](#):
>
> What do you mean?

you have an `app.yml` file … what is the text in it 🙂

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2016 年 9 月 28 日午後 2:57 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/11 "2016-09-28T14:57:02Z")

</div>

My discourse.conf from a default as possible install doesn’t even have a `set_real_ip` on it 🤔.

Your templates on app.yml start are those?

```plaintext
templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
  - "templates/web.ssl.template.yml"
  - "templates/web.letsencrypt.ssl.template.yml"

```

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2016 年 9 月 28 日午後 2:59 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/12 "2016-09-28T14:59:19Z")

</div>

Aha, so you are probably using this: [discourse\_docker/templates/cloudflare.template.yml at master · discourse/discourse\_docker · GitHub](https://github.com/discourse/discourse_docker/blob/master/templates/cloudflare.template.yml)

And it’s probably broken, since it’s 1 year old, and we updated nginx in the mean time, and don’t really use cloudfare.

* * *

I would disable this cloudfare thing, get everything backup, and then try again with time.

You will need to disable cloudfare magic in their console too.

---

<div class="post-metadata">

### Author: ![ljpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ljpp/32/96506_2.png) [@ljpp](https://meta.discourse.org/u/ljpp)
#### Post date: [2016 年 9 月 28 日午後 3:00 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/13 "2016-09-28T15:00:42Z")

</div>

```plaintext
templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/sshd.template.yml"
  - "templates/web.ratelimited.template.yml"
  - "templates/cloudflare.template.yml"
```

Okay, so now we are talking. Yes indeed I use CloudFlare DNS. The .yml is from 1.5b.

---

<div class="post-metadata">

### Author: ![ljpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ljpp/32/96506_2.png) [@ljpp](https://meta.discourse.org/u/ljpp)
#### Post date: [2016 年 9 月 28 日午後 3:02 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/14 "2016-09-28T15:02:45Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [2016 年 9 月 28 日午後 3:03 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/15 "2016-09-28T15:03:07Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Chopper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chopper/32/57073_2.png) [@Chopper](https://meta.discourse.org/u/Chopper)
#### Post date: [2016 年 9 月 28 日午後 3:07 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/16 "2016-09-28T15:07:23Z")

</div>

I use Cloudflare and the default template for my forum, it work pretty well, ~~you don’t need the cloudlare template for the newer version 🙂~~

EDIT : you need the template to avoid limitation registration on IP

---

<div class="post-metadata">

### Author: ![ljpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ljpp/32/96506_2.png) [@ljpp](https://meta.discourse.org/u/ljpp)
#### Post date: [2016 年 9 月 28 日午後 3:08 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/17 "2016-09-28T15:08:23Z")

</div>

> [@mpalmer](#):
>
> Cloudflare changed the URL they list their IP ranges from

Git pulled and rebuilding.

So the fail was then actually triggered by the rebuild, as the URL was changed (and not the actual 1.6.4 update)?

---

<div class="post-metadata">

### Author: ![ljpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ljpp/32/96506_2.png) [@ljpp](https://meta.discourse.org/u/ljpp)
#### Post date: [2016 年 9 月 28 日午後 3:09 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/18 "2016-09-28T15:09:32Z")

</div>

Are your user’s true IPs resolved, or do you just see CloudFlare’s IPs?

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [2016 年 9 月 28 日午後 3:12 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/19 "2016-09-28T15:12:08Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ljpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ljpp/32/96506_2.png) [@ljpp](https://meta.discourse.org/u/ljpp)
#### Post date: [2016 年 9 月 28 日午後 3:15 UTC](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789/20 "2016-09-28T15:15:04Z")

</div>

And we are back online - fix verified. Good job! ❤

Improvement suggestion: Perhaps the rebuild should hard fail with a (human readable) error, if it is unable to fetch CloudFlares IP list?

[次のページ](https://meta.discourse.org/t/urgent-site-down-after-upgrade-to-1-6-4-due-to-cloudflare-template/50789.md?page=2)
