Skip to content

HasithDeAlwis/ha-syncgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ha-syncgen

PostgreSQL High Availability synchronization and failover automation tool


Overview

ha-syncgen is a CLI tool for declaratively managing PostgreSQL high availability (HA) clusters. It generates scripts, configuration files, and systemd services to automate primary-replica setups, health checks, and failover. The tool is powered by a simple YAML configuration and is designed for reliability, transparency, and easy integration with your infrastructure workflows.

Key Features:

  • Declarative YAML configuration for cluster topology and options
  • Script and config generation for all nodes (primary and replicas)
  • Systemd integration for health checks and failover automation
  • Automatic failover to replica on primary failure
  • Observability: Datadog integration and extensible monitoring
  • Cross-platform: Linux, macOS, and Windows support

Quickstart

  1. Install
go install github.com/HasithDeAlwis/ha-syncgen@latest
# or build from source
go build -o syncgen ./
  1. Create/Edit your config See configuration.mdx for all options and examples.
  2. Validate your config
syncgen validate cluster.yaml
  1. Generate scripts
syncgen build cluster.yaml
  1. Deploy
  • Copy scripts from generated/ to your servers
  • Run setup scripts and enable systemd services

CLI Reference

See CLI Reference for all commands, flags, and usage examples.

Documentation

DevOps & Advanced Usage

For AWS/dev automation and advanced workflows, see devenv/aws/main.go.

Contributing

  • Edit docs in docs/content/docs/
  • PRs welcome!

License

GNU GPL 3.0


Features

  • Declarative YAML configuration — Define your cluster, nodes, and options in a single file
  • Script & config generation — All necessary setup, health, and failover scripts are generated for you
  • Systemd integration — Health checks and failover logic run as systemd services/timers
  • Automatic failover — Detects primary failure and promotes a replica
  • Observability — Datadog integration and extensible monitoring hooks
  • Cross-platform — Works on Linux, macOS, and Windows

Roadmap

  • syncgen deploy command for automated deployment
  • syncgen status command for cluster monitoring
  • syncgen promote command for manual failover
  • Advanced validation and error handling
  • Integration tests with real PostgreSQL instances
  • Docker support for development/testing

About

CLI Tool to scaffold HA DBs w/YAML configuration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors