`ghost run` works, `ghost start` does not

Hi, I recently had to restore my server which of course meant I have to restart ghost. This backup was only from 2 days ago so nothing was lost thankfully. However, when running ghost start I get the below output:
+ sudo systemctl is-active ghost_www-jmurray-me
:heavy_check_mark: Ensuring user is not logged in as ghost user
:heavy_check_mark: Checking if logged in user is directory owner
:heavy_check_mark: Checking current folder permissions
+ sudo systemctl is-active ghost_www-jmurray-me
:heavy_check_mark: Validating config
:heavy_check_mark: Checking folder permissions
:heavy_check_mark: Checking file permissions
:heavy_check_mark: Checking content folder ownership
:heavy_check_mark: Checking memory availability
+ sudo systemctl start ghost_www-jmurray-me
☲ Starting Ghost
and it simply hangs there for several minutes until I have to stop it. If I run ghost run I get the below output, however despite the warnings my site does actually run.

  • sudo node current/index.js
    [2019-09-05 21:55:05] INFO Ghost is running in production…
    [2019-09-05 21:55:05] INFO Your site is now available on https://www.jmurray.dev/
    [2019-09-05 21:55:05] INFO Ctrl+C to shut down
    [2019-09-05 21:55:05] WARN Can’t connect to the bootstrap socket (localhost 8000) ECONNREFUSED
    [2019-09-05 21:55:05] WARN Tries: 0
    [2019-09-05 21:55:05] WARN Retrying…
    [2019-09-05 21:55:05] WARN Can’t connect to the bootstrap socket (localhost 8000) ECONNREFUSED
    [2019-09-05 21:55:05] WARN Tries: 1
    [2019-09-05 21:55:05] WARN Retrying…
    [2019-09-05 21:55:05] WARN Can’t connect to the bootstrap socket (localhost 8000) ECONNREFUSED
    [2019-09-05 21:55:05] WARN Tries: 2
    [2019-09-05 21:55:05] WARN Retrying…
    [2019-09-05 21:55:06] WARN Can’t connect to the bootstrap socket (localhost 8000) ECONNREFUSED
    [2019-09-05 21:55:06] INFO Ghost boot 4.877s

Finally, if I run ghost doctor I get the below output.
:heavy_check_mark: Checking system Node.js version
:heavy_check_mark: Checking logged in user
:heavy_check_mark: Ensuring user is not logged in as ghost user
:heavy_check_mark: Checking if logged in user is directory owner
:heavy_check_mark: Checking current folder permissions
:heavy_check_mark: Checking operating system compatibility
:heavy_check_mark: Checking for a MySQL installation
+ sudo systemctl is-active ghost_www-jmurray-me
+ sudo systemctl reset-failed ghost_www-jmurray-me
:heavy_check_mark: Validating config
:heavy_check_mark: Checking folder permissions
:heavy_check_mark: Checking file permissions
:heavy_check_mark: Checking content folder ownership
:heavy_check_mark: Checking memory availability

There are no errors logs in /content/logs/ so I’m at a complete loss as to what the problem could be. I’m assuming that perhaps the warnings above have something to do with it? But then my site appears to work just fine so maybe not.

Any help would be appreciated!

Howdy @jbm1991!
Looks like Ghost is trying to use port 8000, do you already have something else running on that port number? :slightly_smiling_face:

Hey! I do not have anything else running on this server at all, only ghost. Presumably though if something was running on 8000 then ghost run would fail?

Not exactly…

ghost start is designed to make sure your Ghost instance starts before the command exits. It does this by launching a lightweight listener on port 8000 (or the closest open port) and waiting for the Ghost Instance to say “Hey, I’ve started” before removing the listener. ghost run is the command used by the process manager to run Ghost.

So…

ghost start opens 8000
… and then tells systemctl to start your instance
… … which runs ghost run to run Ghost
… … … which eventually starts up and tells 8000 it’s up
which triggers ghost start to close 8000 and tell you Ghost has started

By running ghost run, 8000 is never opened, so you get the warning about not being able to connect to the bootstrap socket

Hopefully this makes sense :slight_smile:

2 Likes

Can you please share the contents of your config.production.json file, and also the nginx configs found in system/files?

1 Like