Easy switch to maintenance page #350

Closed
opened 2022-10-17 17:21:44 +02:00 by muppeth · 3 comments
Owner

We used to use ansible to switch template to maintenance when we wanted a service to not be accessible. This works well for cases where service is planned to be in maintenance mode for long time.

However we should have an easy way to load site in maintenance without the need for PR/approval process.

We used to use ansible to switch template to maintenance when we wanted a service to not be accessible. This works well for cases where service is planned to be in maintenance mode for long time. However we should have an easy way to load site in maintenance without the need for PR/approval process.
Author
Owner

I can think of two ways:

  1. Use ansible role as is and add in host_vars extra vhosts (eg. gitea.maintenance) that arent enabled but have all the info such as root pointing to general maintenance page, having all needed certificates etc).

  2. Add task to nginx that will deploy maintenance vhost (eg. gitea.maintenance) as above, if item.maintenance: 'true' for vhost is set.

If we need to switch service to maintenance mode, we just need to remove the current link to sites-enabled and create new link linking to gitea.maintenance vhost. When maintnenance mode is not needed, we either run playbook on proxy servers or change the link back.

Option 1. adds more vhosts in host_vars but doesnt touch the role while the option 2. requires just extra attribute to host_vars but requires extra task on the role.

I can think of two ways: 1. Use ansible role as is and add in host_vars extra vhosts (eg. gitea.maintenance) that arent enabled but have all the info such as root pointing to general maintenance page, having all needed certificates etc). 2. Add task to nginx that will deploy maintenance vhost (eg. gitea.maintenance) as above, if `item.maintenance: 'true'` for vhost is set. If we need to switch service to maintenance mode, we just need to remove the current link to `sites-enabled` and create new link linking to `gitea.maintenance` vhost. When maintnenance mode is not needed, we either run playbook on proxy servers or change the link back. Option 1. adds more vhosts in host_vars but doesnt touch the role while the option 2. requires just extra attribute to host_vars but requires extra task on the role.
Owner

I'd go for solution 2, it seems to me that it will keep host_vars cleaner (in the sense of less vhost)

I'd go for solution 2, it seems to me that it will keep host_vars cleaner (in the sense of less vhost)
muppeth added this to the 11.22 - November milestone 2022-11-02 17:13:59 +01:00
Author
Owner

done. PR pending Disroot-Ansible/nginx#35

done. PR pending https://git.disroot.org/Disroot-Ansible/nginx/pulls/35
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Disroot/Disroot-Project#350
No description provided.