The discourse does not restart. What could be the problem?


(Алексей Копаев) #1

The discourse does not restart. What could be the problem?
More precisely restart hangs on these lines

I, [2017-04-15T10: 40: 44.939366 # 13] INFO -:> cd / var / www / discourse && chown -R discourse / var / www / discourse
I, [2017-04-15T10: 40: 58.954198 # 13] INFO -:
I, [2017-04-15T10: 40: 58.955745 # 13] INFO -:> cd / var / www / discourse && su discourse -c 'bundle install -deployment -verbose -without test -without development'

By reference the entire restart log https://pastebin.com/W3Ksi156

When restarting, I see such an error, with what it can be connected? And how to fix it?

2017-04-15 10:39:33 UTC [54-1] postgres@postgres ERROR:  database "discourse" already exists
2017-04-15 10:39:33 UTC [54-2] postgres@postgres STATEMENT:  CREATE DATABASE discourse;
createdb: database creation failed: ERROR:  database "discourse" already exists
I, [2017-04-15T10:39:33.249138 #13]  INFO -- :
I, [2017-04-15T10:39:33.249850 #13]  INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2017-04-15 10:39:33 UTC [65-1] postgres@discourse ERROR:  role "discourse" already exists
2017-04-15 10:39:33 UTC [65-2] postgres@discourse STATEMENT:  create user discourse;
ERROR:  role "discourse" already exists

(Régis Hanol) #2

How long have you waited? Because that step usually is the slowest. Depending on your VPS perf, it might take 10s of minutes!


(Cee Kay) #3

I takes almost more than 10 minutes.


(Алексей Копаев) #4

Very long waited, more than an hour, restart hangs at this point. And all worked in the morning. And then all of a sudden everything broke down


(Rafael dos Santos Silva) #5

Does your server have enough memory? Commands free -m and df -h can help.


(Алексей Копаев) #6

Free place is

Filesystem      Size  Used Avail Use% Mounted on
udev            487M  4.0K  487M   1% /dev
tmpfs           100M  364K  100M   1% /run
/dev/vda3        20G   14G  4.5G  76% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            497M     0  497M   0% /run/shm
none            100M     0  100M   0% /run/user
/dev/vda2        92M   64M   25M  73% /boot

(Jay Pfaffman) #7

How about memory (ram)? What does the free command recommended above tell you?

Oh. Or maybe you need to rebuild.

./launcher rebuild app

(Cee Kay) #8

He got this error while he tried to rebuild the app. Please open his pastebin link to see that


(Kai Liu) #9

I suggest you put output of below commands here, all of them.

free -h
cat /etc/os-release
uname -a
docker info
docker ps -a

And use the top command to see whether the CPU is busy doing something.


(Алексей Копаев) #10

Performs your commands

root@valekseivvolgay7:~# free -h
             total       used       free     shared    buffers     cached
Mem:          993M       407M       586M        60K        71M       181M
-/+ buffers/cache:       154M       839M
Swap:         4.0G       6.3M       4.0G
root@valekseivvolgay7:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="14.04.5 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.5 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
root@valekseivvolgay7:~# uname -a
Linux valekseivvolgay7 3.13.0-95-generic #142-Ubuntu SMP Fri Aug 12 17:00:09 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
root@valekseivvolgay7:~# docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 2
Server Version: 1.12.3
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 8
 Dirperm1 Supported: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: host bridge null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: apparmor
Kernel Version: 3.13.0-95-generic
Operating System: Ubuntu 14.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 994 MiB
Name: valekseivvolgay7
ID: KMXB:GC7Q:KA7K:BUCX:ALPF:D5UQ:DJPJ:VRSN:AKIO:FQE4:OEGZ:VW3M
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Insecure Registries:
 127.0.0.0/8
root@valekseivvolgay7:~# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
root@valekseivvolgay7:~#

(Kai Liu) #11

Is your Discourse running or in the process of restarting when you run these commands?

You Discourse container is not running, it actually does not exists at all. Is it your first time trying to install Discourse or it has been running for a while normally until now you have the problem? You title implies the latter but it’s strange that you don’t even have the Discourse container exist.


(Алексей Копаев) #12

Until yesterday morning my Discourse worked. But after the command ./launcher rebuild app it stopped working (and what do I also don `t know.


(Kai Liu) #13

What rebuild command does is destroy old, bootstrap, start a new container. So it seems your old container was destroyed successfully but the new one never get created.

But I noticed one thing unusual in your logs on pastbin:

root@valekseivvolgay7:/var/discourse# ./launcher rebuild app
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
cd /pups && git pull && /pups/bin/pups --stdin
Already up-to-date.

And here is mine from rebuild.

Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
Stopping old container
+ /usr/bin/docker stop -t 10 app
app
cd /pups && git pull && /pups/bin/pups --stdin
Already up-to-date.

Notice line 4&5. I got a message about stop old container, which makes sense as the rebuild process first try to destroy the old container. But your log don’t have these lines so feels like your container is not there even before your run rebuild.

Can you check you app.yml file under /var/discourse/containers and make sure you actually have a good Discourse container defined?

Edit: Is the log on pastebin from the first time your try to rebuild or from the second or even more retries?


(Алексей Копаев) #14

The logs you see on the Pastebin link, I copied the subsequent attempts to restore the discourse.
App.yml is in place, before and after discourse is broken, the file hasn’t been changed.


(Kai Liu) #15

That makes sense as the container is already destroyed the first time you rebuild.

I checked my logs, after what you have on pastebin, the next step is fetching gems from rubegems.org. You can see that from my logs below.

I, [2017-04-17T03:31:30.930951 #14]  INFO -- : Running `bundle install --deployment --verbose --without "development"` with bundler 1.14.6
Found no changes, using resolution from the lockfile
HTTP GET https://index.rubygems.org/versions
HTTP 200 OK https://index.rubygems.org/versions
Fetching gem metadata from https://rubygems.org/

Your logs just ended here at the bundle install line. Maybe your server is not able to access rubygems.org? Can you try curl https://index.rubygems.org/versions and see if the connection is OK?