I’m thinking of expanding my homelab to support running some paid SaaS projects out of my house, and so I need to start thinking about uptime guarantees.
I want to set up a cluster where every service lives on at least two machines, so that no single machine dying can take a service down. The problem is the reverse proxy: the router still has to point port 443 at a single fixed IP address running Caddy, and that machine will always be a single point of failure. How would I go about running two or more reverse proxy servers with failover?
I’m guessing the answer has something to do with the router, and possibly getting a more advanced router or running an actual OS on the router that can handle failover. But at that point the router is a single point of failure! And yes, that’s unavoidable… but I’m reasonably confident that the unmodified commodity router I’ve used for years is unlikely to spontaneously die, whereas I’ve had very bad luck with cheap fanless and single-board computers, so anything I buy to use as an advanced router is just a new SPOF and I might as well have used it for the reverse proxy.
The term you’re looking for is load balancing. DNS load balancing will work fine for your purposes. Use a DNS host that supports health checks to the endpoints, and you’re all set. If one goes down, DNS will not be returned when querying the record for the downed host.
For what OP is asking DNS has no part in DNAT, they need a load balancer.
Personally, asking about high uptime on a residential ISP is the larger issue here, but alas.
I don’t think this is it. The router doesn’t know anything about DNS, it only knows “this port goes to this IP address”. It seems like I either need multiple devices sharing an IP address or router software that inherently supports load balancing.
You just described a load balancer. The router doesn’t know about DNS but clients using your service use DNS. You can do some simple load balancing behind DNS. If you want to do it by IP address you want a load balancer though.
If your current router doesn’t support static DNS entries or advanced management of them, you could run a DNS service, or just get a router that runs OpenWRT. GL.Inet makes solid devices for relatively cheap.