Discourse Install 502 Bad Gateway

Hi all,

I had Discourse running fine until the other day. After updating I’m getting the current issue: 502 Bad Gateway.

I’m using NGINX and I didn’t change anything with Discourse itself or the main NGINX server proxy for the service.

I am also using Cloudflare DNS etc.

Here’s what I did:

  1. Updated Discourse via the website admin panel the one for the commits.
  2. Installed certbot on the server before realising it was already on the server.
  3. Ran “sudo snap install core; sudo snap refresh core”.
  4. Updated npm and nodejs to the latest versions.
  5. Rebuilt the Discourse app after realising it was down after steps 1 to 4.

Triple checked my nginx reverse proxy to make sure I didn’t touch anything, which I didn’t.

Just a little confused as what I may have messed up here.

Thanks in advance,
~Blood

1 Like

You get a 502 error for a minute or two after an upgrade/reboot.

npm and nodejs on the server don’t make any difference to Discourse, as it gets all of that in the container.

If it’s still not back up then I’d do a command line upgrade

cd /var/discourse
./launcher rebuild app

Oh.

You can look at

docker logs -f app

and

/var/discourse/shared/logs/.....
1 Like

I checked the logs via the first command via: docker logs -f app.
There wasn’t anything within this that was sticking out to me.

Also apparently I don’t have /var/discourse/shared/logs/ I have:

/var/discourse/shared/standalone/log

Though if the logs are within that directory, I’m not entirely sure which one I should be reading.

Oh. Yeah. Sorry. There are rails logs and there are nginx logs if you wade down from the correct path that you provided. You can check the rails logs to see if stuff is getting from your reverse proxy to the container and can also check the rails logs to see if there’s an error in rails.

From what I am reading in the logs, it seems redis doesn’t connect initially but fixes itself, though I’m not sure if that was there before so I honestly don’t think it’s the redis causing the issue I’m having.

I thought it might be the SSL handshake but I can’t see anything from the NGINX error.log mentioning anything recently.

If you’ve got an external reverse proxy, then it should be doing the ssl stuff and not Discourse. If you’ve got the ssl and letsencrypt templates in your yml file then that could be the issue, except you said it was working before.

Yeah I just doubled checked to make sure they were commented out and they are, so I’m completely confused as to why this happened after the update etc.

And it was working before, probably a few days ago before messing around a little with the updates etc. Though from what I can tell is that this isn’t the only service I’m having an issue with which makes me believe it is the NGINX side of things.

1 Like