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 :(

@cron@feddit.org
link
fedilink
English
1113d

Your challenge is that you need a loadbalancer. By hosting the loadbalancer yourself (e.g. on a VPS), you could also host your websites directly there…

My approach would be DNS-based. You can have multiple DNS A records, and the client picks one of them. With a little script you could remove one of the A Records of that server goes down. This way, you wouldn’t need a central hardware.

@Mateleo@lemmy.dbzer0.com
creator
link
fedilink
English
28d

The VPS remains this single point of failure :(

The DNS-based approach seems to be the best bet for my use case.

Jeena
link
fedilink
English
3
edit-2
13d

That’s an interesting idea, need to check if they offer some kind of a API for that.

But then there is this other thing, what about dns cache?

@cron@feddit.org
link
fedilink
English
313d

Set the DNS cache time to 60 seconds.

Set the script to run on every host delayed by some time to avoid simultaneously accessing the API (e.g. run the script every other minute).

With this approach, you get automatic failover in at most 3 minutes.

@lando55@lemmy.world
link
fedilink
English
213d

Where would you host the script? If it’s expected that the server that fires it off is always online and performing health checks, why not have it host a load-balancer? Or another local instance of the website? It’s something fun to play around with, but if this is for anything beyond a fun exercise there are much better ways to accomplish this.

@cron@feddit.org
link
fedilink
English
713d

I’d host it on both webservers. The script sets the A record to all the servers that are online. Obviously, the script als has to check it’s own service.

It seems a little hacky though, for a business use case I would use another approach.

Create a post

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.

Rules:

  1. Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

  • 1 user online
  • 248 users / day
  • 643 users / week
  • 1.41K users / month
  • 3.93K users / 6 months
  • 1 subscriber
  • 3.78K Posts
  • 76.7K Comments
  • Modlog