Maintenance Mode
Feature Request
Is your feature request related to a problem or unsupported use case? Please describe. Currently, with Richie, this is not possible to mention that the website is under maintenance so during infrastructure operation which implies some service to be turned off, the site can be still online but malfunctions.
To help user to understand what is happening, we could display an info banner when the website is under maintenance. We should be able to switch maintenance mode from the site administration.
@jbpenrath I have implemented a similar feature on our site, 2 years ago... It was an urgent stuff, just before a big migration that we had... https://github.com/fccn/nau-richie-site-factory/commit/5ece2bae441907735ded36b6f6c755bbcbaed65b
It is just a big message "In Maintenance" on header, so people don't create tickets just because they can't enroll on a course.
I don't know if it is possible to have some static generic to the base template. Like @sandroscosta have implemented to our footer logos using a static placeholder.
Do you think that it could generalized and upstream directly to Richie?
- something includable before the page header
- even include a bellow the footer static placeholder - similar to what we have on NAU?
We would like to enable this maintenance mode through site attributes. Because setting this settings through an environment variable obliges us to deploy the app to enable/disable this mode.
@jbpenrath I agree that through environment variable isn't the right solution. What do you mean through "site attributes"?
We could extend the Site model to add a maintenance BooleanField. Then in the django admin, we were able to enable/disable this mode and just show/hide the maintenance banner in the base template according to the value of this flag.
@jbpenrath We are going to have a new maintenance window on our site. What I have planed to do is to include a JS lines via Google Tag Manager (GTM) a couple of days before to warn our users.
It requires to deploy the GTM, but Is as simple as 10 clicks... after 15 minutes all users should see the difference. The GTM JS has 15 minutes client cache. The good news is that it will work on all UI screens (Richie + Open edX Django + and the future Open edX MFEs + other future NAU apps), it just need to include the GTM.
We are using GTM, to include multiple external JS libraries: Google Analytics, support widgets, browser upgrade warning, Cookie consent, other tracking's, etc.
Hope my comment helps.
Maintenance Banner JS example:
var maintenanceBanner = document.createElement("div");
maintenanceBanner.style = "background-color: #ffce35; font-size: 1rem;";
if (document.documentElement.lang.startsWith("pt")) {
maintenanceBanner.innerHTML = "Devido a uma operação de manutenção, ......";
} else {
maintenanceBanner.innerHTML = "Due to a maintenance operation, .....";
}
document.body.insertBefore(maintenanceBanner,document.body.childNodes[0]);
Thanks for the information @igobranco. Looks a versatile workaround 👍