eldoy / waveorb-server

Waveorb server
MIT License
1 stars 0 forks source link

NGINX restart shows error page #18

Open eldoy opened 9 months ago

eldoy commented 9 months ago

When deploying we are seeing this temporarily, about 5 seconds:

An error occurred.
Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the error log for details.

Faithfully yours, nginx.
eldoy commented 9 months ago

Could it be customized for each app?

eldoy commented 8 months ago

The reason for the error is that when the app@ service is reaped and nginx is restarted, nginx will report 500 until the node app has started (loaded waveorb and app).

Solutions:

  1. Start the app on a different port (find the first available one) and restart the app@ service when the new app has started. This required restart of nginx since the port number must be dynamically added to the nginx config. Bonus with this is that you don't need the port number in the proxy settings for waveorb.json.
  2. Build into waveorb a polling on the listen call so that we can re-use the same port for the application. Are there any other ways we can poll?
  3. Add better default error page for nginx 500 /usr/share/nginx/html/50x.html. Add support for customer 500 page for the application: "We're restarting the application, please wait". This page can then automatically check and reload itself when the app is ready.
  4. Others? Can systemd handle this? Wait until a file has been written or something?