git404hub

what is 2dc-ha-lab fr?

rafajimenezdev/2dc-ha-lab — explained in plain English

Analysis updated 2026-05-18

0ShellAudience · ops devopsComplexity · 4/5LicenseSetup · hard

tl;dr

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.

vibe map

mindmap
  root((2dc-ha-lab))
    What it does
      Simulates 2 data centers
      PostgreSQL replication
      Failover testing
    Tech stack
      Vagrant
      VirtualBox
      PostgreSQL
      HAProxy
      Bind9
    Use cases
      Disaster recovery practice
      Load balancing tests
      DNS failover drills
    Audience
      SRE learners
      DevOps students
    Requirements
      8GB RAM minimum
      20GB disk space
      Vagrant plus VirtualBox

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Practice promoting a PostgreSQL replica to primary during a simulated switchover.

VIBE 2

Simulate a full data center outage to test disaster recovery procedures safely.

VIBE 3

Learn how HAProxy load balancing and Bind9 DNS failover work together in a realistic setup.

VIBE 4

Study for SRE or DevOps interviews by rehearsing failure scenarios on a local lab instead of production.

what's the stack?

VagrantVirtualBoxPostgreSQLHAProxyBind9Flask

how it stacks up fr

rafajimenezdev/2dc-ha-lab123satyajeet123/bitnet-serveradeilsonrbrito/cross-model-consult
Stars000
LanguageShellShellShell
Setup difficultyhardeasymoderate
Complexity4/52/53/5
Audienceops devopsdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · hard time til it works · 1h+

Requires Vagrant, VirtualBox, and at least 8GB of RAM to run six virtual machines locally.

MIT license: free to use, modify, and distribute, including commercially, as long as the copyright notice is kept.

in plain english

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.

prompts (copy fr)

prompt 1
Walk me through running vagrant up on 2dc-ha-lab and testing that PostgreSQL replication works between the two data centers.
prompt 2
Explain how this repo's HAProxy and Bind9 setup work together during a simulated data center failure.
prompt 3
Show me the steps to simulate the loss of DC1 in 2dc-ha-lab and verify DC2 keeps serving traffic.
prompt 4
What are the minimum RAM and disk requirements to run this lab, and how would I scale the VM resources down for a smaller machine?
prompt 5
Help me add a new automated test scenario to this repo for testing HAProxy round-robin distribution under load.

Frequently asked questions

what is 2dc-ha-lab fr?

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.

What language is 2dc-ha-lab written in?

Mainly Shell. The stack also includes Vagrant, VirtualBox, PostgreSQL.

What license does 2dc-ha-lab use?

MIT license: free to use, modify, and distribute, including commercially, as long as the copyright notice is kept.

How hard is 2dc-ha-lab to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is 2dc-ha-lab for?

Mainly ops devops.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.