Ghost-CLI: Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED

Hi ghost team,

I have tried to debug this issue since September 26, 2019. Sadly I haven’t had much progress. This my own Digital Ocean Server, with Ubuntu and Ghost which has worked without problems since approximately 6months ago (July 2019), until very recently, One day I just logged in and ran ghost stop and then ghost start and after that it hasn’t worked again.

Steps to reproduce

  1. ssh root@mywebsite.com
  2. sudo -i -u ghost-mgr
  3. cd /var/www/ghost
  4. ghost runoutput:
[2019-10-07 16:30:07] INFO Ghost is running in production...
[2019-10-07 16:30:07] INFO Your site is now available on https://www.mywebsite.com/
[2019-10-07 16:30:07] INFO Ctrl+C to shut down
[2019-10-07 16:30:07] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-10-07 16:30:07] WARN Tries: 0
[2019-10-07 16:30:07] WARN Retrying...
[2019-10-07 16:30:08] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-10-07 16:30:08] WARN Tries: 1
[2019-10-07 16:30:08] WARN Retrying...
[2019-10-07 16:30:08] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-10-07 16:30:08] WARN Tries: 2
[2019-10-07 16:30:08] WARN Retrying...
[2019-10-07 16:30:08] WARN Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED
[2019-10-07 16:30:08] INFO Ghost boot 3.267s

Permissions of /var/www/ghost/ dir after running ls -la`:

total 48
drwxrwxr-x 8 ghost-mgr ghost     4096 Oct  6 07:34 .
drwxrwxr-x 4 root      root      4096 May 14 20:15 ..
-rw-rw-r-- 1 ghost-mgr ghost      124 Oct  6 07:34 .ghost-cli
drwxrwxr-x 8 ghost-mgr ghost     4096 Jul  7 09:34 .git
-rw-rw-r-- 1 ghost-mgr ghost       83 Jun  9 10:57 .gitignore
-rw-rw-r-- 1 ghost-mgr ghost      562 Oct  3 14:10 config.production.json
drwxrwxr-x 8 ghost     ghost     4096 Jun  2 14:39 content
lrwxrwxrwx 1 ghost-mgr ghost-mgr   30 Oct  6 07:34 current -> /var/www/ghost/versions/2.31.1
drwxr-xr-x 2 ghost-mgr ghost-mgr 4096 Sep 27 10:08 locales
drwxrwxr-x 2 ghost-mgr ghost     4096 Jun  9 10:57 node_modules
-rw-rw-r-- 1 ghost-mgr ghost       27 Jun  9 10:57 package-lock.json
drwxrwxr-x 4 ghost-mgr ghost     4096 Jun 20 10:21 system
drwxrwxr-x 4 ghost-mgr ghost     4096 Oct  6 07:34 versions

Are the permissions okay?

Contents of my config.production.json:

{
  "url": "https://www.mifitnessfacil.com",
  "server": {
    "port": 2369,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "root",
      "password": "foobar",
      "database": "foobar"
    }
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/www/ghost/content"
  },
  "bootstrap-socket": {
    "port": 8000,
    "host": "localhost"
  }
}

Is the config file okay?

Log file

cat ~/var/www/ghost/content/logs/https___www_mywebsite_com_production.log] contents:

{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":30,"msg":"Ghost is running in production...","time":"2019-10-07T16:26:24.644Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":30,"msg":"Your site is now available on https://www.mifitnessfacil.com/","time":"2019-10-07T16:26:24.646Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":30,"msg":"Ctrl+C to shut down","time":"2019-10-07T16:26:24.647Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":40,"msg":"Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED","time":"2019-10-07T16:26:24.651Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":40,"msg":"Tries: 0","time":"2019-10-07T16:26:24.652Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":40,"msg":"Retrying...","time":"2019-10-07T16:26:24.653Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":40,"msg":"Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED","time":"2019-10-07T16:26:24.804Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":40,"msg":"Tries: 1","time":"2019-10-07T16:26:24.805Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":40,"msg":"Retrying...","time":"2019-10-07T16:26:24.805Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":40,"msg":"Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED","time":"2019-10-07T16:26:24.957Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":40,"msg":"Tries: 2","time":"2019-10-07T16:26:24.958Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":40,"msg":"Retrying...","time":"2019-10-07T16:26:24.958Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":40,"msg":"Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED","time":"2019-10-07T16:26:25.109Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":30,"msg":"Ghost boot 4.248s","time":"2019-10-07T16:26:25.110Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":6851,"level":40,"msg":"Ghost has shut down","time":"2019-10-07T16:28:49.490Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":30,"msg":"Ghost is running in production...","time":"2019-10-07T16:30:07.975Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":30,"msg":"Your site is now available on https://www.mifitnessfacil.com/","time":"2019-10-07T16:30:07.978Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":30,"msg":"Ctrl+C to shut down","time":"2019-10-07T16:30:07.979Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":40,"msg":"Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED","time":"2019-10-07T16:30:07.984Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":40,"msg":"Tries: 0","time":"2019-10-07T16:30:07.984Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":40,"msg":"Retrying...","time":"2019-10-07T16:30:07.985Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":40,"msg":"Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED","time":"2019-10-07T16:30:08.136Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":40,"msg":"Tries: 1","time":"2019-10-07T16:30:08.137Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":40,"msg":"Retrying...","time":"2019-10-07T16:30:08.137Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":40,"msg":"Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED","time":"2019-10-07T16:30:08.288Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":40,"msg":"Tries: 2","time":"2019-10-07T16:30:08.288Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":40,"msg":"Retrying...","time":"2019-10-07T16:30:08.288Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":40,"msg":"Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED","time":"2019-10-07T16:30:08.440Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":30,"msg":"Ghost boot 3.267s","time":"2019-10-07T16:30:08.441Z","v":0}
{"name":"Log","hostname":"fitness-ghost-droplet","pid":7024,"level":40,"msg":"Ghost has shut down","time":"2019-10-07T16:33:13.435Z","v":0}

Technical details

  • OS: Ubuntu 18.04.3 LTS (bionic)
  • Node Version: 10.16.3
  • Ghost-CLI version: 1.11.0
  • Ghost version: 2.31.1
  • Environment: Production

Bug submission checklist

Please fill out this checklist to acknowledge that you followed the requirements to submit a bug report.

  • [ x ] Tried to find help in the forum & docs
  • [ x ] Checked for existing issues
  • [ x ] Attached log file
  • [ x ] Provided technical details incl. operating system

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

ok, I see what the problem is 😄 not sure why it happened, but it does appear that the port configuration in your production configuration and the one in the nginx configuration got out of sync.

What you’ll need to do is update config.production.json -> set the server.port value to 2368 instead of 2369, then restart Ghost. That should hopefully fix the problem.

ok, I see what the problem is 😄 not sure why it happened, but it does appear that the port configuration in your production configuration and the one in the nginx configuration got out of sync.

What you’ll need to do is update config.production.json -> set the server.port value to 2368 instead of 2369, then restart Ghost. That should hopefully fix the problem.

I have the same issue of bootstrap sockets while doing ghost run and intentionally running my website on 2369 because I ham hosting two different websites on the same server. The nginx (both HTTP and SSL) and ghosts configs are both pointing to the correct port. Removing bootstrap-sockets object didn’t help either.

@cooervo this might be related to #805, but would you be able to try removing the bootstrap-socket section from your config.production.json and re-starting?

The error that’s occurring is that either Ghost, or the CLI can’t connect to the bootstrap socket on port 8000, so either the config.production.json is messing with things or there’s a permissions issue preventing Ghost/Ghost-CLI from connecting to port 8000.

This was the fix for me. I had to remove the following section from the prod config.

  "bootstrap-socket": {
    "port": 8000,
    "host": "localhost"
  },

Once removed it all started working again.

@cooervo this might be related to #805, but would you be able to try removing the bootstrap-socket section from your config.production.json and re-starting?

The error that’s occurring is that either Ghost, or the CLI can’t connect to the bootstrap socket on port 8000, so either the config.production.json is messing with things or there’s a permissions issue preventing Ghost/Ghost-CLI from connecting to port 8000.