rafajimenezdev/2dc-ha-lab — explained in plain English
Analysis updated 2026-05-18
Practice promoting a PostgreSQL replica to primary during a simulated switchover.
Simulate a full data center outage to test disaster recovery procedures safely.
Learn how HAProxy load balancing and Bind9 DNS failover work together in a realistic setup.
Study for SRE or DevOps interviews by rehearsing failure scenarios on a local lab instead of production.
| rafajimenezdev/2dc-ha-lab | 123satyajeet123/bitnet-server | adeilsonrbrito/cross-model-consult | |
|---|---|---|---|
| Stars | 0 | 0 | 0 |
| Language | Shell | Shell | Shell |
| Setup difficulty | hard | easy | moderate |
| Complexity | 4/5 | 2/5 | 3/5 |
| Audience | ops devops | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires Vagrant, VirtualBox, and at least 8GB of RAM to run six virtual machines locally.
This project is a self-contained practice lab that simulates two data centers running a highly available PostgreSQL setup, built entirely with Vagrant and VirtualBox. It spins up six virtual machines on your own computer to recreate a realistic production style environment where you can safely break things and watch how failover works, without any risk to a real system. The lab includes a primary PostgreSQL 16 database in one simulated data center that replicates in real time to a replica database in the second data center, a small Flask application running in each data center that talks to its local database, an HAProxy load balancer that spreads traffic across both application servers, and a Bind9 DNS server that can redirect traffic to a new primary during a failover. Everything is defined as infrastructure as code in a single Vagrantfile plus provisioning scripts, so the whole environment is built from scratch with one command, vagrant up, and torn down just as easily with vagrant destroy. Once running, you can test scenarios such as promoting the replica database to primary during a planned switchover, simulating a complete loss of one data center to check disaster recovery, killing a database or application server to see how the system reacts, updating DNS records to reflect a new primary, and observing how HAProxy balances requests across servers. The README includes example commands using curl to insert data and confirm it appears correctly after replication. Running the lab requires Vagrant 2.4 or newer and VirtualBox 7.0 or newer, along with a reasonably capable machine: at least 8GB of RAM is the stated minimum, with 16GB or more recommended, plus 20 to 40GB of free disk space. It has been tested on Windows 11 with VirtualBox and Vagrant, and the author notes it should also work on macOS and Linux with possibly minor adjustments. This is aimed at people learning database replication, load balancing, and disaster recovery concepts hands on, such as those studying for site reliability engineering or DevOps roles. The project is released under the MIT license.
A Vagrant-based lab that simulates two data centers with PostgreSQL replication, load balancing, and DNS failover so you can practice disaster recovery scenarios safely.
Mainly Shell. The stack also includes Vagrant, VirtualBox, PostgreSQL.
MIT license: free to use, modify, and distribute, including commercially, as long as the copyright notice is kept.
Setup difficulty is rated hard, with roughly 1h+ to a first successful run.
Mainly ops devops.
This repo across BitVibe Labs
double-check against the repo, no cap.