How do I setup a web page to show "Under Maintenance" while my Linode is being resized?
My Linode is going to be shutdown for while it is being resized and I'd like my customers to get a message explaining what is going on while this is happening. I don't want to change my DNS settings. Is there a way I can do this?
With a little forethought, this is relatively straight forward:
Create a new temporary Linode 1GB in the same datacenter as the Linode which is going to be resized. Deploy your Linode using the Debian 10 image or adjust the following steps accordingly if you want to use a different distribution.
Update your packages and install Apache2:
sudo apt-get update && sudo apt-get upgrade sudo apt-get install apache2 sudo a2enmod alias sudo nano /etc/apache2/sites-enabled/000-default.conf
- Edit the default configuration (add the following lines after your "DocumentRoot" line:
AliasMatch ^/(.*)$ /var/www/html/index.html ErrorDocument 404 /var/www/html/index.html
Edit /var/www/html/index.html to show the error page you want. (If you don't feel like manually creating your own maintenance page, you can use https://better-error-pages.statuspage.io to generate an error page. Disclaimer: this site is not affiliated with Linode.com)
Start your webserver:
sudo systemctl enable apache2 sudo systemctl start apache2
Use the transfer IP address feature in the Cloud Manager to swap you Linode's IP address with the new server
Shutdown your original Linode
Reboot your new temporary Linode to pick up the new IP address
Perform your maintenance
Use the transfer IP address feature again to move your IP address back to the original Linode.
Shutdown your temporary Linode
Boot your original Linode
You can now delete the temporary Linode or use the Linode Images feature to keep a copy of your maintenance Linode ready to deploy again if you ever need to do maintenance in the future.