Question

Upgrade 2 Ghost blogs on same server, 1 quits immediately when run as a service

I have 2 Ghost blogs on a Digital Ocean server running:

  • Ubuntu 14.04.3 LTS
  • Nginx 1.4.6 (Ubuntu)
  • Node v0.12.7

I used the instructions provided by Digital Ocean to set up the blogs, and they have worked fine and survived upgrades before.

On Saturday, I upgraded blog #1 from Ghost v0.6.0 to 0.7.0 and experienced no problems. After upgrading I ran service ghost-{blog1} restart and it came online with pomp and triumph.

I immediately attempted to upgrade blog #2 following the same steps, but when I opened it in my browser after restarting the service, I got the “502 Bad Gateway” error.

I found that npm failed to install SQLite3 correctly, and fixed that. Now, I can start the blog successfully by running npm start --production. The terminal shows that Ghost is running and intercepting requests, and I can use the site and blogging app in my browser.

But when I run service ghost-{blog2} start, it continues to fail without presenting a terminal error. I get the following message:

ghost-{blog2} start/running, process 1693

But I still see the “502 Bad Gateway” error in my browser.

<hr>

I changed my startup script to run npm start --production > ghost-{blog2}.log instead of npm start --production, and I can see that Ghost starts up, and then quits immediately without error:

> ghost@0.7.0 start /var/www/{blog2}/ghost
> node index

That’s all that is in the log, even after hitting the page a few times. Nginx logs the requests, but Ghost doesn’t.

By contrast, when I start the blog by running npm start --production > ghost-{blog2}.log from the terminal, the log continues thus:

> ghost@0.7.0 start /var/www/allder.org/ghost
> node index

Migrations: Up to date at version 004
Ghost is running in production...
Your blog is now available on http://allder.org
Ctrl+C to shut down
{{Requests}}

Can anyone suggest steps I can take to troubleshoot this?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I finally solved this problem!

The answer was to downgrade Node.js to version 0.10.40. When I wrote the above, I was running node vv0.12.7.

Ghost’s install documentation says it supports v0.12.x, but when looking at it again today, I noticed that it recommends v0.10.40.

It’s not clear to me at all why this solves the problem, but I’ll take it.