Discourse 404 page after server restarted


(Tom Hsiung) #1

Hello,

I am new to Discourse. I installed Discourse with Docker on my sparse PC home. The PC runs Ubuntu. I found the Discourse site failed after I restarted my server. It seems that the launcher COMMAND app commands were not useful. Could someone write a short guide for how to restart Discourse after server rebooting? Thanks

Tom


(RĂ©gis Hanol) #2

What happens when you do ./launcher start app?


(Tom Hsiung) #3
tomhsiung@toms-server:/var/discourse$ sudo ./launcher start app

starting up existing container
+ /usr/bin/docker start app
Error response from daemon: container "c80ef0c10d6e2a50fbf2030254e935de562f596126676e81f53fcfd6fcc52417": already exists
Error: failed to start containers: app

(RĂ©gis Hanol) #4

Seems like the container is already started. Have you tried ./launcher restart app?


(Tom Hsiung) #5

To restart the app also encountered error.

tomhsiung@toms-server:/var/discourse$ sudo ./launcher restart app
+ /usr/bin/docker stop -t 10 app
app

starting up existing container
+ /usr/bin/docker start app
Error response from daemon: container "c80ef0c10d6e2a50fbf2030254e935de562f596126676e81f53fcfd6fcc52417": already exists
Error: failed to start containers: app

(Tom Hsiung) #6

It seems that something is wrong. After rebooting the server, Discourse site had gone. I ran below commands. Any suggestion?

tomhsiung@toms-server:~$ sudo docker images --all
[sudo] password for tomhsiung: 
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
local_discourse/app   latest              31481416b73e        About an hour ago   2.86GB
discourse/base        2.0.20171231        3925ef3919cc        6 weeks ago         1.73GB
tomhsiung@toms-server:~$ sudo docker ps -a
CONTAINER ID        IMAGE                 COMMAND             CREATED             STATUS                            PORTS                                      NAMES
b48ea80eeefe        local_discourse/app   "/sbin/boot"        About an hour ago   Exited (255) About a minute ago   0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   app
tomhsiung@toms-server:~$ sudo docker info
Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 2
Server Version: 18.02.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9b55aab90508bd389d7654c4baf173a981477d55
runc version: 9f9c96235cc97674e935002fc3d78361b696a69e
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-112-generic
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.859GiB
Name: toms-server
ID: TJ76:J47D:JQ4Z:2CJ6:AX6H:DDHI:ZBCB:CLP3:PI7J:SVJ4:L6E7:EHG3
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support
tomhsiung@toms-server:~$

(Matt Palmer) #7

The output of docker logs app might have something useful, but to get you going again, a ./launcher rebuild app should do the trick.


(Tom Hsiung) #8

The local_discourse/app’s status is Exited (255), after restarting the server. How to make it up?

Tom


(Tom Hsiung) #9

Every time I restarted the server, I have to run ./launcher rebuild app?

Tom


(Matt Palmer) #10

Maybe, maybe not. Docker is not exactly the most predictable piece of software in existence. It may never do this particular thing to you ever again.


(Tom Hsiung) #11

What should I do now? If I ran the ./launcher rebuild app again, there would be another container.


(Jeff Atwood) #12

That command is 100% safe, we run it all the time. There is no need for concern.


(Matt Palmer) #13

I doubt it. If that happens, you’ve stumbled on a much bigger bug.


(Tom Hsiung) #14

It seemed that the container had been stoped, but the sudo docker info command still shew that the container was running.

tomhsiung@toms-server:/var/discourse$ sudo ./launcher stop app
+ /usr/bin/docker stop -t 10 app
app
tomhsiung@toms-server:/var/discourse$ sudo docker info
Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 2
Server Version: 18.02.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9b55aab90508bd389d7654c4baf173a981477d55
runc version: 9f9c96235cc97674e935002fc3d78361b696a69e
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-112-generic
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.859GiB
Name: toms-server
ID: TJ76:J47D:JQ4Z:2CJ6:AX6H:DDHI:ZBCB:CLP3:PI7J:SVJ4:L6E7:EHG3
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

(Tom Hsiung) #15

I think it was a bug. Because the sudo docker killl app command resulted a error showing the contained had stopped, and the sudo docker ps -a shew that the container’s status was Exited

but on the other hand the sudo docker info command shew the container was running. Strange bug.

tomhsiung@toms-server:/var/discourse$ sudo docker kill app
Error response from daemon: Cannot kill container: app: Container b48ea80eeefe748d240ac9c6985935caecb605aec0fd7098acfbe294375dd65b is not running
tomhsiung@toms-server:/var/discourse$ sudo docker ps -a
CONTAINER ID        IMAGE                 COMMAND             CREATED             STATUS                        PORTS                                      NAMES
b48ea80eeefe        local_discourse/app   "/sbin/boot"        2 hours ago         Exited (255) 20 minutes ago   0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   app
tomhsiung@toms-server:/var/discourse$ sudo docker info
Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 2
Server Version: 18.02.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9b55aab90508bd389d7654c4baf173a981477d55
runc version: 9f9c96235cc97674e935002fc3d78361b696a69e
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.4.0-112-generic
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.859GiB
Name: toms-server
ID: TJ76:J47D:JQ4Z:2CJ6:AX6H:DDHI:ZBCB:CLP3:PI7J:SVJ4:L6E7:EHG3
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

(Tom Hsiung) #16

After running ./launcher rebuild app, site still down and app status is still exited.


(Matt Palmer) #17

Same container ID? What do the docker logs say?


(Tom Hsiung) #18

Still the same error after rebuilding. Where is the log file?

tomhsiung@toms-server:/var/discourse$ sudo ./launcher start app

starting up existing container
+ /usr/bin/docker start app
Error response from daemon: container "b48ea80eeefe748d240ac9c6985935caecb605aec0fd7098acfbe294375dd65b": already exists
Error: failed to start containers: app

(Tom Hsiung) #19

It seems that something is wrong, after stopping the app by ./launcher stop app, docker info still shew the app was running, which caused the already existing container error.

After running docker system prune --all, all images and containers were removed. So it’s wrong, the docker info shew the app container was running but the app was removed by prune command. Strange.

Tom


(Tom Hsiung) #20

The issue was caused by the abnormal running status of the container “app”. The app container was marked as running status, so if I tried to start it I would encounter a “already exist” error. But actually, the app contain was stopped, because docker ps command shew nothing was running.

Tom