Always error 503 on Ghost startup

#1

Hi

I’ve installed latest version of Ghost on Apache + Passenger setup. On this kind of setup the Ghost app is not running permanently, Apache/Passenger manages process startup and shutdown.

If the Ghost app is not running the next user accessing the website will force Ghost startup and he will always get an 503 error. The following is logged:

App 936 output: [2019-03-26 00:24:21] WARN Theme’s file locales/es.json not found.
App 936 output: [2019-03-26 00:24:21] WARN Falling back to locales/en.json.
App 936 output: [2019-03-26 00:24:21] WARN Theme’s file locales/en.json not found.
App 936 output: [2019-03-26 00:24:22] INFO Ghost is running in production…
App 936 output: [2019-03-26 00:24:22] INFO Your blog is now available on http://www.domain.com
App 936 output: [2019-03-26 00:24:22] INFO Ctrl+C to shut down
App 936 output: [2019-03-26 00:24:22] INFO Ghost is running in production…
App 936 output: [2019-03-26 00:24:22] INFO Your blog is now available on http://www.domain.com/
App 936 output: [2019-03-26 00:24:22] INFO Ctrl+C to shut down
App 936 output: [2019-03-26 00:24:22] INFO Ghost boot 2.555s
App 936 output: ERROR [2019-03-26 00:24:22] “GET /feed/” 503 26ms
App 936 output:
App 936 output: NAME: MaintenanceError
App 936 output: MESSAGE: Site is starting up, please wait a moment then retry.
App 936 output:
App 936 output: level:normal
App 936 output:
App 936 output: empty
App 936 output: empty
App 936 output: ERROR DETAILS:
App 936 output: empty
App 936 output:
App 936 output: MaintenanceError: Site is starting up, please wait a moment then retry.

If I access the site again everything works, if someone else access the site everything works.

But after a few minutes or hours Apache/Passenger will shutdown the app and the next user will get the 503 error again.

Is there anyway to avoid these errors? Ghost does not support this kind of setup/environment?

Returning an error on every startup does not look like a good idea.

Many thanks

#2

@aitor Ghost can take a few seconds to start up, especially if you have a large number of posts or tags as it needs to build it’s routing map. During startup it will respond with a 503 so that a reasonable error is returned during ghost-cli upgrades - that’s normally the only time a production install would be restarted.

It’s not recommended to serve Ghost in an environment where it will be automatically shutdown unless you build in a provision for it’s startup time and 503 response. If you’re set on using passenger you’ll also want to make sure it never spins up more than one Ghost process because you’ll run into problems with that.

#3

Thanks Kevin

What do you mean with “unless you build in a provision for it’s startup time and 503 response”?

Is there anyway to avoid Ghost responding with the 503?

You can see in the log I sent tyaht the startup time is just 2,55s

Thanks!

#4

What do you mean with “unless you build in a provision for it’s startup time and 503 response”?

Build your own system around it that can handle Ghost being unavailable for short periods whilst starting up. You could serve cached content rather than a 503 for instance, or configure your proxy setup to retry requests if it receives a 503. How you do that would be up to you.

Is there anyway to avoid Ghost responding with the 503?

No, it’s there to enable the startup state to be handled, the alternative of not responding to requests would be worse. If you don’t want to deal with 503s then you’re better off configuring your environment to keep the Ghost process running permanently which is what it was designed for.

#5

Thanks Kevin

closed #6

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.