Website offline message whilst resizing?

March 8, 2018 251 views
DigitalOcean Ubuntu 16.04

Are there any options to display a message to visitors whilst a droplet it powered off during a resize?

Some sort of temporary redirect to a different droplet perhaps?

Just curious if there are any options.

Thanks

1 Answer
ryanpq MOD March 8, 2018
Accepted Answer

There isn't a service for this available by default. Since your domain points directly to your droplet's IP address, if a request comes in for the domain while your droplet is powered off during a resize there is nothing at that IP address to answer. One way you could achieve this would be to use another droplet as an nginx reverse proxy using the proxy_pass directive in your nginx configuration.

With this you would point your domain to the nginx proxy and it would request the data from your application server. You can also set up caching on the nginx proxy if you want which would reduce the load on your app server. With this configuration, if the droplet running your app were to go down it would trigger the nginx proxy to return a 502 error indicating that it could not reach the upstream service. By creating a custom 502 error page you could then display the page of your choice automatically anytime your app server is unavailable for any reason.

Have another answer? Share your knowledge.