Ghost Blog Randomly Crashing

My site has been crashing in an apparently random manner. It can work for many hours and then I’ll start getting a 502 and need to login and run ghost

  • What’s your URL? https://blog.justinmallone.com/

  • What version of Ghost are you using? Latest.

  • How was Ghost installed and configured? I installed it myself on a Linode running Debian.

  • What Node version, database, OS & browser are you using? Node 16.13.0. MySQL. Nginx. MacOS. Chrome & Safari.

  • What errors or information do you see in the console?

If I run ghost doctor I see the following:

One or more errors occurred.

1) Validating config

Error detected in the production configuration.

Message: Invalid database type. Supported types are mysql and sqlite3
Configuration Key(s): database.client
Current Value(s): mysql2

Help: Run `ghost config <key> <new value>` for each key to fix the issue.



2) SystemError

Message: Unable to determine node version in use by systemd
Help: Ensure 'ExecStart' exists in /lib/systemd/system/ghost_blog-justinmallone-com.service and uses a valid Node version

Debug Information:
    OS: Debian GNU/Linux, v10
    Node Version: v16.13.0
    Ghost Version: 5.43.0
    Ghost-CLI Version: 1.23.1
    Environment: production
    Command: 'ghost doctor'

The site will start up if I run ghost run though, but it will then crash unpredictably later. This is new behavior that only started after recently upgrading to Ghost 5.

Note that I was recently having the error described here and removed the bootstrap socket section from my config.production.json file as discussed in that thread and that allowed me to get my site working.

  • What steps could someone else take to reproduce the issue you’re having? Unknown, site just seems to crash randomly after a while.

What database version are you running?

mysql Ver 8.0.32 for Linux on x86_64 (MySQL Community Server - GPL)

apparently crashed again overnight

another detail: if i try ghost restart, it stalls indefinitely after the message sudo systemctl start ghost_blog-justinmallone-com. If I try ghost start, i get similar output as to ghost doctor above. if i try ghost run, then ghost runs for a while before crashing randomly.

another detail: i ran sudo systemctl status nginx and got the following output (seems okay to me?)

nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2023-04-14 23:25:22 EDT; 19h ago
     Docs: man:nginx(8)
  Process: 417 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SU
  Process: 467 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 486 (nginx)
    Tasks: 2 (limit: 1148)
   Memory: 23.3M
   CGroup: /system.slice/nginx.service
           ├─486 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           └─491 nginx: worker process

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

I updated my ExecStart parameter in /lib/systemd/system/ghost_blog-justinmallone-com.service to the current version of node installed, which is a supported version (16.13.0).

I also changed the client field in config.production.json to mysql (from mysql2). Found some discussion of that issue here and here.

ghost doctor now passes its checks without any errors. however, ghost start stalls. I ran ghost start -V and got the following output

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.
https://careers.ghost.org

MySQL: running query > SELECT @@version AS version

+ sudo systemctl is-active ghost_blog-justinmallone-com
? Sudo Password [hidden]
? Sudo Password [hidden]
+ sudo systemctl reset-failed ghost_blog-justinmallone-com
[19:43:20] Checking system Node.js version [started]
[19:43:20] Checking system Node.js version - found v16.13.0 [title changed]
[19:43:20] Checking system Node.js version - found v16.13.0 [completed]
[19:43:20] Ensuring user is not logged in as ghost user [started]
[19:43:20] Ensuring user is not logged in as ghost user [completed]
[19:43:20] Checking if logged in user is directory owner [started]
[19:43:20] Checking if logged in user is directory owner [completed]
[19:43:20] Checking current folder permissions [started]
[19:43:20] Checking current folder permissions [completed]
[19:43:20] Validating config [started]
+ sudo systemctl is-active ghost_blog-justinmallone-com
[19:43:20] Validating config [completed]
[19:43:20] Checking folder permissions [started]
[19:43:21] Checking folder permissions [completed]
[19:43:21] Checking file permissions [started]
[19:43:21] Checking file permissions [completed]
[19:43:21] Checking content folder ownership [started]
[19:43:21] Checking content folder ownership [completed]
[19:43:21] Checking memory availability [started]
[19:43:21] Checking memory availability [completed]
[19:43:21] Checking binary dependencies [started]
[19:43:21] Checking binary dependencies [completed]
[19:43:21] Checking systemd unit file [started]
[19:43:21] Checking systemd unit file [completed]
[19:43:21] Checking systemd node version [started]
[19:43:21] Checking systemd node version - found v16.13.0 [title changed]
[19:43:21] Checking systemd node version - found v16.13.0 [completed]
+ sudo systemctl start ghost_blog-justinmallone-com
☲ Starting Ghost: blog-justinmallone-com

when I ran ghost run in a separate window, while still having ghost start stalled in another window, ghost start finally responded and gave the following remaining output

Received message from Ghost: {
  started: true,
  debug: {
    versions: {
      node: '16.13.0',
      v8: '9.4.146.19-node.13',
      uv: '1.42.0',
      zlib: '1.2.11',
      brotli: '1.0.9',
      ares: '1.17.2',
      modules: '93',
      nghttp2: '1.45.1',
      napi: '8',
      llhttp: '6.0.4',
      openssl: '1.1.1l+quic',
      cldr: '39.0',
      icu: '69.1',
      tz: '2021a',
      unicode: '13.0',
      ngtcp2: '0.1.0-DEV',
      nghttp3: '0.1.0-DEV'
    },
    platform: 'linux',
    arch: 'x64',
    release: {
      name: 'node',
      lts: 'Gallium',
      sourceUrl: 'https://nodejs.org/download/release/v16.13.0/node-v16.13.0.tar.gz',
      headersUrl: 'https://nodejs.org/download/release/v16.13.0/node-v16.13.0-headers.tar.gz'
    }
  }
}
Received message from Ghost: {
  ready: true,
  debug: {
    versions: {
      node: '16.13.0',
      v8: '9.4.146.19-node.13',
      uv: '1.42.0',
      zlib: '1.2.11',
      brotli: '1.0.9',
      ares: '1.17.2',
      modules: '93',
      nghttp2: '1.45.1',
      napi: '8',
      llhttp: '6.0.4',
      openssl: '1.1.1l+quic',
      cldr: '39.0',
      icu: '69.1',
      tz: '2021a',
      unicode: '13.0',
      ngtcp2: '0.1.0-DEV',
      nghttp3: '0.1.0-DEV'
    },
    platform: 'linux',
    arch: 'x64',
    release: {
      name: 'node',
      lts: 'Gallium',
      sourceUrl: 'https://nodejs.org/download/release/v16.13.0/node-v16.13.0.tar.gz',
      headersUrl: 'https://nodejs.org/download/release/v16.13.0/node-v16.13.0-headers.tar.gz'
    }
  }
}
+ sudo systemctl is-enabled ghost_blog-justinmallone-com
✔ Starting Ghost: blog-justinmallone-com

Site crashed again, so none of the changes I made seemed to affect the issue.

Anyone have any more troubleshooting ideas? I’m at a loss.

AFAIK, Ghost isn’t tested on Debian, so this may be a cause for your woes. Is there any reason for choosing Debian over Ubuntu?

In addition, I did find occasional crashes with the smaller Linodes, but not as frequent as you are experiencing, and solved this with performance tweaks.

Ah, I didn’t know there was a potential issue there. I picked Debian on a friend’s recommendation years ago when setting up my linode initially and think I followed this guide to set up Ghost on it initially (though I’ve since moved from mariaDB to mysql since mariadb stopped working with Ghost at some point) How to Install Ghost CMS on Debian 10 | Linode

i uninstalled and reinstalled mysql and ghost from scratch on debian, so I’ll see if that helps first before considering other options

seems to be stable now

2 Likes