API Host
Control- Go 1.22+
ansible-playbookinstalled- SSH client with key-based access to all target DB nodes
- HAProxy installed if proxy features are enabled
sudopermission for HAProxy reload command
erawan-cluster is a Go API that drives Ansible-based database cluster provisioning for MySQL InnoDB Cluster, PostgreSQL Patroni with etcd, and optional HAProxy tenant config generation.
Build
Go + Chi
Lean REST API surface with strict JSON validation and job state persistence.
Automation
Ansible
Cluster rollout, service bootstrap, verification, and job resume flows.
Topologies
1-N Nodes
Single-node bootstrap or full primary plus replicas depending on the stack.
System View
API Host
Go + AnsibleServes REST endpoints, writes job state, runs Ansible playbooks, and pushes HAProxy updates.
MySQL Path
InnoDB Cluster + MySQL Shell, optional Router bootstrap, resume and rollback support.
PostgreSQL Path
Patroni + etcd bootstrap with leader election, replica bring-up, and verification.
Important current behavior
Requirements
This section consolidates the current repo requirements from the API host, MySQL, and PostgreSQL docs into one operational checklist.
ansible-playbook installedsudo permission for HAProxy reload commandmysqlsh installedroot through a Unix socketmysqlrouter if Router bootstrap is enabled3306 or the chosen MySQL portpatroni[etcd] installedetcd installed2379, 2380, 5432, and 8008 reachableDeployment Model
Every cluster rollout is broken into tagged Ansible steps. That gives the API enough structure to track progress, resume from failure points, and keep the deployment shape predictable.
MySQL
Preflight, instance preparation, cluster creation, optional add-instance, optional Router bootstrap, verify, and optional app DB init.
PostgreSQL
Preflight, base config, primary and standby config, cluster bootstrap, verification, and optional app DB init.
MySQL Flow
PostgreSQL Flow
Credential Handling
MySQL
Caller provides SSH credentials. Cluster-admin credentials are generated and managed internally. MySQL root password is no longer part of the public API contract.
PostgreSQL
Superuser, replication, and admin passwords are generated internally if not supplied. All three are returned in the deploy 202 response under secret and reused automatically on resume. Use postgres_user and postgres_password from the deploy response to call the metrics endpoint.
Endpoints
GET /health GET /docs
POST /haproxy/config/mysql POST /haproxy/config/pgsql DELETE /haproxy/config GET /haproxy/configs GET /haproxy/configs/download POST /haproxy/reload
POST /cluster/mysql/deploy
GET /cluster/mysql/jobs
GET /cluster/mysql/jobs/{jobID}
POST /cluster/mysql/jobs/{jobID}/resume
POST /cluster/mysql/jobs/{jobID}/rollback
POST /cluster/pgsql/deploy
POST /cluster/pgsql/metrics
GET /cluster/pgsql/jobs
GET /cluster/pgsql/jobs/{jobID}
POST /cluster/pgsql/jobs/{jobID}/resume
Payloads
MySQL Deploy
Current examples reflect the reduced external credential requirements.
{
"cluster_name": "prodCluster",
"primary_ip": "192.168.122.154",
"standby_ips": ["192.168.122.111"],
"new_user": "appuser",
"new_user_password": "AppUser#2026",
"new_user_ssl_required": true,
"new_db": "appdb",
"assume_prepared": false,
"bootstrap_router": true,
"ssh_port": 22,
"mysql_port": 3306,
"step_timeout_seconds": 900
}
Resume Payload
{
"new_user_password": "AppUser#2026"
}
MySQL Rollback
{}
Behavior Notes
standby_ips: [] for single-node bootstrap.bootstrap_router: false to skip MySQL Router.assume_prepared: true only when MySQL nodes were prepared earlier.postgres_version to target a specific major version (14–18). Defaults to 16.POST /cluster/pgsql/metrics, point host/port at HAProxy and supply node_ips for Patroni leader discovery.Developer
Repository ownership and project contact are linked here so the landing page also works as a simple handoff point for collaborators, reviewers, and future maintenance.
Name
Nann Visal
Maintainer and developer contact for the erawan-cluster repository.
Repository
github.com/Nann-Visal/erawan-cluster
Use the repository page for project source, issue tracking, and direct maintainer context.