[ENG-10768] Have a display of some form when the OSF is down for planned maintenance #11706
[ENG-10768] Have a display of some form when the OSF is down for planned maintenance #11706mkovalua wants to merge 3 commits intoCenterForOpenScience:feature/pbs-26-6from
Conversation
brianjgeiger
left a comment
There was a problem hiding this comment.
A few comments. Also, please add some API tests to ensure that all the functionality is working properly.
| if request.path.endswith(('/v2', '/v2/')): | ||
| return self.get_response(request) |
There was a problem hiding this comment.
I see why you did this, based on the ticket, but I don't think this is explicitly necessary. Having the /v2 route return just the information from the maintenance mode section below would be fine.
| { | ||
| 'meta': { | ||
| 'maintenance_mode': True, | ||
| 'status_page': 'status', |
There was a problem hiding this comment.
I think this is supposed to be https://status.cos.io.
| request.session = SessionStore() | ||
|
|
||
|
|
||
| class MaintenanceModeMiddleware: |
There was a problem hiding this comment.
I'm not super-familiar with Middleware in Django. Will this also prevent incoming requests from being processed (i.e. if someone POSTs or PATCHes something, will we prevent that from affecting the OSF DB)?
| def test_bypasses_v2_root_if_maintenance_mode_on(self, mock_maintenance, client): | ||
| response = client.get('/v2') | ||
| assert response.status_code != 503 | ||
| mock_maintenance.assert_not_called() |
There was a problem hiding this comment.
No, I said we shouldn't special case the /v2/ endpoint. It should behave the same as the other endpoints.

Ticket
Purpose
When OSF undergoes planned downtime for software releases, users who are unaware of the maintenance window have no way of knowing the site is intentionally offline — they simply experience a broken site. A backend maintenance mode is needed so that when enabled, the API halts normal request processing and signals to clients that the system is in maintenance.
Changes
return 503 for API if maintanence_mode is set to true
set maintenance mode via admin
8758-3bb9-4cb1-867c-eee081c8032e.mp4
Side Effects
QE Notes
CE Notes
Documentation