question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't connect to the bootstrap socket (localhost 8000) ECONNREFUSED

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
acburdinecommented, Oct 7, 2019

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.

5reactions
HamedMPcommented, Jan 14, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ghost - Can't connect to the bootstrap socket (localhost 8000 ...
I have made some progress the problem seems to be related to an error on the bootstrap socket of ghost. My config.production.json in...
Read more >
Upgrading to 2.0 Error - Can't connect to the bootstrap socket ...
I am having similar issues. When I run watch --interval 0.5 netstat -tulnp the only port that shows is 8000.
Read more >
How to Fix java.net.ConnectException: Connection refused
If the server is not running. Usually ports like 8080, (for tomcat), 3000 or 4200 (for react/angular), 3306(MySQL), 27017(MongoDB) or occupied ...
Read more >
Node.js Error: connect ECONNREFUSED - DEV Community ‍ ‍
The solution: · 1. Create an user with password, and grant all provileges. CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; GRANT ALL ...
Read more >
RSA NetWitness 11.x Admin Server does not discover new hosts
HttpHostConnectException: Connect to localhost:8000 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused (Connection ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found