Please check README.md
-
Create an outage in the future
Go to
Dashboard ► Site administration ► Plugins ► Authentication ► Outage manager ► Manage
and clickCreate outage
to create an outage with the following settings:- Outage auto start:
false
- Warning duration:
1 hour
- Start date and time:
Somewhere around 2 hours from now
- Outage duration:
1 hour
- Title and Description:
Leave default
You should not see any warning message yet.
- Outage auto start:
-
Change that outage to activate the warning
Edit the outage, set:
- Start date and time:
Sometime in the future but less than 1 hour from now
The warning bar with a countdown is displayed!
What is happening now? Nothing, this is just a warning for all users.
- Start date and time:
-
Change that outage so it becomes active
Edit the outage, set:
- Start date and time:
Sometime in the past but less than 1 hour ago
The warning changes color and shows the outage estimated end time.
What is happening now? Nothing yet, it is just a warning to all users that the system may be unstable but it is still online. That will change when we are using the IP Blocking feature.
- Start date and time:
-
Activate maintenance mode
Note: This step will happen automatically if you create an outage with the option to
Auto start maintenance mode
.Execute the following command from your Moodle instalation directory:
php admin/cli/maintenance.php --enable
Anyone who tries to use Moodle now will receive a maintenance message.
-
Perform the maintenance activities.
At this point it is safe to perform the required maintenance as no one can use the system, not even admins.
-
Disable the maintenance mode
php admin/cli/maintenance.php --disable
Your site is back, but the outage warning still shows the maintenance (unless the outage ending time has reached).
-
End the outage
Using the GUI, you can do it in a few different ways (choose one)
- Click 'Finish' at the warning bar
- Click 'Finish' at the outage management page
- Edit the outage and lower the duration so it is finished by now
The outage bar should disappear (you may need to refresh the page).
We will manage outages from the CLI this time, but it does not matter which way you create them.
Execute the commands from your Moodle instalation directory and leave the browser open so you can see the changes.
-
Enable IP Blocker and allow your IP Address
Go to
Dashboard ► Site administration ► Plugins ► Authentication ► Outage manager ► Settings
and setAllowed IP list
to127.0.0.1
(or your IP address if not local). -
Create an outage
This command will create an outage starting in 30 seconds, with a warning period of 15 seconds. It will automatically start (trigger maintenance mode).
php auth/outage/cli/create.php -w=20 -s=30 --autostart=Y
Refresh the page but you will not see anything yet.
-
Wait until it starts
Keep refreshing the page, in less than 10 seconds it will display the warning.
Wait until the outage starts.
-
Maintenance mode should be active
You cannot browse anymore because Moodle's maintenance mode is active, no one can use the system until it is manually disabled.
-
Perform the maintenance activities.
At this point it is safe to perform the required maintenance as no one can use the system, not even admins.
-
Disable maintenance mode.
php admin/cli/maintenance.php --disable
-
Browse with an allowed IP
Do not finish the outage yet...
Because you are white-listed in the IP Blocking, you can test the site while it is not open for normal users.
-
Browse with a blocked IP
Change the IP settings to a different IP (but do not leave it blank, which disables IP Blocking):
Go to
Dashboard ► Site administration ► Plugins ► Authentication ► Outage manager ► Settings
and setAllowed IP list
to1.2.3.4
Save and refresh.
You should see the maintenance page until the outage period is over.
-
Finish the outage
Finish the outage using the CLI:
php auth/outage/cli/finish.php --active
Now the site is back and available for everyone.