Skip Navigation

Loadbalancing between 2 locations

Hello everyone!

My friend and I have each bought an optiplex server. Our goal is to selfhost a web app (static html) with redundancy. If my server goes down, his takes over and vice versa. I've looked into Docker Swarm, but each server has to be totally independent (each runs its own apps, with a few shared ones).

I can't find a solution that allows each server to take over and manage loadbalancing between the two. Ideally with traefik, because that's what we're currently using. To me the real issue is the DNS A record that point to only one IP :(

20 comments
  • Essentially you need a load balancer hosted somewhere that the traffic hits before getting routed to one of the 2 servers. That could be a VPS running Traefik if you prefer that.

    Alternatively you could both run something like IPFS and run the static site on that, but anyone accessing the site would either need IPFS installed, or use a gateway hosted somewhere (Cloudflare has a public for example).

  • Many moons ago I used heartbeat for this, but you’d need both servers in the same cidr range. I assume that’s not the case here.

    In your case you could probably use a dynamic DNS service to move the IP around, but the challenge would be knowing when to kick it off.

    You could write scripts to determine when the live one goes down, but we’re probably already more complicated than you were looking for.

20 comments