echothrust/howtos

A list of OpenBSD (mostly) material

View on GitHub

Echothrust Solutions website maintenance HOWTO

This is a small paper on a method we employ in order to perform scheduled maintenance on our web servers.

The guide assumes you’re running OpenBSD and nginx but the principles can be applied to a variety of applications and services.

The method as its pros and cons but they depend on your own requirements and limitations. In our case we are quite happy with this method and we’ve been using ever since.

The idea

The idea is as the following:

Configuration

Setting your site in maintenance mode

Now in when we want to add our website under maintenance you can simply do

pfctl -t maintenance -T add 0.0.0.0/0

In order to kill any existing connections to the live nginx we use our defined label

pfctl -k label -k www-normal

At this point any request towards our normal webserver should display our nice maintenance.html.

Setting your site back online

In order to finish the maintenance we first have to empty the maintenance table

doas pfctl -t maintenance -T flush

And again we kill any existing sessions that are left open at the maintenance nginx

doas pfctl -k label -k www-maintenance