502 Bad Gateway - nginx issue

(Nick Putman) #1

Discourse was running fine a new server (Digital Ocean one click install) and now it is not. I am getting the ‘502 Bad Gateway - nginx’ error message. I have not made any changes to the configurations - it just stopped working last night. This is the message I’ve had from the developer who has been helping with this:

Discourse is running on Docket along with the nginx. We configured discourse to listen to port 8080. Both discourse and nginx was working perfectly. But due to some unknown issue discourse is not working any more. In the server docket service is running but not found the discourse. Tried to relaunch the app.yml but its not found in its directory also ./launcher is not recognized by server.

Could someone help to troubleshoot this issue?

Nginx Bad Gateway - hitmanforum
(Nick Putman) #2

This is the sum total of what is in my /var/discourse folder:

Looks like I am missing nearly all files? I did not delete anything, so what could have happened and is this recoverable in any way?

(Rafael dos Santos Silva) #3

Your files are inside docker, so you wont see then there.

Did you try to SSH, and then:

cd /var/discourse
./launcher cleanup
./launcher start app

Difference between socket- and port-based connection to outer NGINX?
(Nick Putman) #4

Thanks for the info. I have tried this now but get the error: -bash: ./launcher: No such file or directory

(Rafael dos Santos Silva) #5
cd /var/discourse
ls -lah

(Nick Putman) #6

total 12K
drwxr-xr-x 3 root root 4.0K May 16 16:28 .
drwxr-xr-x 15 root root 4.0K May 16 16:28 …
drwxr-xr-x 3 root root 4.0K May 16 16:28 shared

(Felix Freiberger) #7

This is extremely strange. You’re definitely missing all of the discourse_docker repository – and if the screenshot above is complete, you’re also missing your database :open_mouth: (but you might have a backup).

I’m pretty sure this hasn’t been caused by Discourse, which is running inside the container and doesn’t even have the permission to delete anything outside these shared folders.

I’m pretty sure either someone has (accidentally) deleted most of this folder, or your system has very serious (and somewhat unlikely) issues, e.g. major file system corruption.

Either way, please download the backup folder and store it in a safe place before more harm is done.

Edit: Most likely false alarm, see explanation by @Falco below.

Fixing nginx/discourse issue on new server
(Rafael dos Santos Silva) #8

Looks like Digital Ocean doesn’t use the default path for discourse :sadpanda:.


cd /
find -name  "launcher"

(Felix Freiberger) #9

Oh, I totally missed that explanation. Good catch! :thumbsup:
Sorry for the (most likely) false alarm.

(Nick Putman) #10

Nothing is returned for this

(Rafael dos Santos Silva) #11

Hmmm, that’s the problem with unsupported installs.

I really don’t know what to do, since the files aren’t where they are supposed to be.

(Nick Putman) #12

By unsupported you mean that I didn’t pay for it to be done by one of the discourse team? If so, you’re correct - I used the Digital Ocean one click install.

It was working fine for a couple of weeks, and then last night it suddenly disappeared!

Does it look like I will have to reinstall? Is there any chance of finding a backup of the database?

(Rafael dos Santos Silva) #13

No, no!! Sorry, english isn’t my mother tongue :tongue:.

To make everyone life easier, Discourse team advises to follow this guide.

That way we know how to help you if things go south.

And it’s even cheaper than the DO 1-click, because you can use a smaller server.

Can you run:

free -g
df -h

(Nick Putman) #14
root@nickputman:~# free -g
             total       used       free     shared    buffers     cached
Mem:             3          1          2          0          0          0
-/+ buffers/cache:          1          2
Swap:            0          0          0
root@nickputman:~# df -h
Filesystem                 Size  Used Avail Use% Mounted on
udev                       2.0G  4.0K  2.0G   1% /dev
tmpfs                      396M  400K  395M   1% /run
/dev/disk/by-label/DOROOT   59G  9.8G   47G  18% /
none                       4.0K     0  4.0K   0% /sys/fs/cgroup
none                       5.0M     0  5.0M   0% /run/lock
none                       2.0G  624K  2.0G   1% /run/shm
none                       100M     0  100M   0% /run/user
none                        59G  9.8G   47G  18% /var/lib/docker/aufs/mnt/c805d87b4af305d7ce03b5980d3fcf576e271ec3780633c57d029ea9ab2d35b8
shm                         64M     0   64M   0% /var/lib/docker/containers/874ff13a4a17074c474a23f32aa49e6a80c830689370a4718eded186f102ac63/shm

(Nick Putman) #15

I don’t mind installing again, as there wasn’t much on the forum - it was a relatively new install. The main thing was that I did quite a lot of customisation of the css and custom html, etc. If there was any way of getting this back that would be some help.

(Rafael dos Santos Silva) #16

Just bought a DO 1 click install, and SSH in trough my phone, and all files are at the /var/discourse folder.

Looks like you have an older version.

(Nick Putman) #17

Thanks. I think everything was in /var/discourse/. I did the 1 click install less than 2 weeks ago. Looks like everything disappeared!

Am I right in thinking my only option is to reinstall, and if so:

  1. Do you think there’s any chance of finding a backup of the database, so I can use this?
  2. Do I need to remove anything first before reinstalling? I suppose delete the /var/discourse/ directory. Anything else?

(Rafael dos Santos Silva) #18

On your first screenshot was a backup folder, if there is something there you’re saved. Just download it, reinstall using the official guide, and restore!

(Nick Putman) #19

Yes a backup folder with nothing in it! So I have started on a fresh install and have hit a snag:

root@nickputman:/var/discourse# ./discourse-setup
Port 80 appears to already be in use.

Previously the port was set to 8080 for discourse and I already have WordPress sites running on the server. app.yml hasn’t been generated yet… so how do I get around this?

(Jeff Atwood) #20

You will need to skip the setup wizard and edit app.yml manually.