Creating a Maintenance Page
Sometimes there is a need to be able to completely disable access to content on your repository, but you want users to be aware that the repository is just unavailable temporarily for scheduled maintenance, which turning off your web server would not be possible. A common situation where you may want to do this is when you need to make alterations to the database and you want to ensure this does not otherwise change whilst you are making these alterations. The best way of doing this is to create a maintenance page, for which requests to your repository will be redirected.
The following guide provides instructions on how to produce a fully branded maintenance page. It is based on an approach originally developed for the CentOS 7 Linux but should work more generally, however, file paths are liable to be different. Similarly, if you are running Apache 2.2, then the Require all granted line will be different (see Apache's Upgrade Note).
On the repository's server, as root create a copy of the archive's cfg/lang/langID/static/ directory to /var/www/maintenance. E.g.
cp -r /opt/eprints3/archives/example/cfg/static/ /var/www/maintenance
Move to the /var/www/maintenance/ directory and download the homepage of your repository. E.g.
wget -O index.html http://eprints.example.org/
Edit /var/www/maintenance/index.html and insert the following HTML markup, adjusting the dates DD/MM/YYYY, time HH:MM and REPOSITORY_NAME as appropriate. Where to put this will vary between repository; it is usually best placed after the title in the main content part of your page. (It may also be worth removing various parts of this page, such as the Latest Additions, as visitors will not be able to access them):
<div class="ep_msg_warning"> <div class="ep_msg_warning_content"> <table style="padding:5px"> <tr> <td style="padding-right: 10px; padding-top: 5px; vertical-align: top;"> <img alt="Warning" src="/style/warning.png" /> </td> <td> <h3 style="padding: 10px 0 5px; 0; margin: 0;">Notice of Scheduled Maintenance</h3> <p>Please note that REPOSITORY_NAME will be unavailable from HH:MM on DD/MM/YYYY until HH:MM on DD/MM/YYYY due to scheduled maintenance. We apologise for any inconvenience.</p> </td> </tr> </table> </div> </div>
Create /root/eprints-maintenance.conf containing the following lines, while updating ServerName and ServerAdmin as appropriate:
If your repository uses HTTPS you will also need to create a file called /root/eprints-maintenance-ssl.conf with the following contents. Update ServerName, ServerAdmin, SSLCertificateFile, SSLCertificateKeyFile and SSLCertificateChainFile as appropriate:
Next you will need to find the line in /etc/httpd/ (On RHEL/CentOS/Fedora) or /etc/apache2/ (on Ubuntu/Debian):
and comment it out and below put the line:
Again if you are running HTTPS on your repository you will need to find the following or similar line in /etc/httpd/ or /etc/apache2/:
and comment it out and below put:
Finally, you will need to restart the web server:
You should now see that any request to your repository is redirected to /index.html (e.g. http://eprints.example.org/index.html), which displays your maintenance page.
Once maintenance is completed all you need to do is uncomment the line(s) commented out in step 6 (and step 7) where appropriate and to save time for future scheduled maintenance, comment out the new lines you added. Then just restart the web server like in step 8.
If you have planned maintenance again, assuming your branding does not change in the meantime, all you need to do is update the times in /var/www/maintenance/index.html uncomment and comment out the lines in steps 6 and 7 as appropriate and restart the web server and your maintenance page is back in place.