Best practice approach when a service goes offline?

A Caddy reverse proxy has enabled me, with a degree of confidence, to expose, to the public network, selected services on the private network, such as Nextcloud and WordPress.

When there’s unscheduled downtime or scheduled maintenance of a service, such as a major upgrade of the service or say disaster recovery testing, I’m wondering what the best strategy is to keep users of the service informed of what’s going on while the service is unavailable. Atm, Caddy is pivotal in what I’ve put in place, but I’m wondering if I’m going about it the right way, whether I should be using Caddy at all or if there’s a better way:

For my Caddyfile, this is a snippet I use for simple reverse proxies under normal operating conditions:

(online) {
  {args.0}.udance.com.au {
    encode gzip
    import dnschallenge

    log {
      format json
      output file /var/log/caddy/{args.0}.log {
        roll_keep 7
      }
    }

    reverse_proxy http://{args.1}
  }
}

For example:

import online blog 10.1.1.4   # blog.udance.com.au

If I have to take the service offline, I’ll invoke this snippet in the Caddyfile:

(offline) {
  {args.0}.udance.com.au {
    encode gzip
    import dnschallenge

    redir https://udance.statuspage.io{uri} temporary
  }
}

and change online to offline for the site I want to take offline e.g.

import offline blog 10.1.1.4   # blog.udance.com.au

Statuspage is an online service I use to keep my customer base informed of any downtime or scheduled maintenance.

Would you do things any differently?

1 Like

@francislavoie Your like tells me I’m on the right track. Thanks!

Yeah that approach seems good to me. Serving anything else that tells the users it’s under maintenance works. You could have a simple html page + file_server as a fallback as well if you prefer. I like the import for swapping quickly.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.