haproxy-manager
v0.1.0
Published
Interactive CLI to manage HAProxy HTTP/HTTPS/TCP routes and generate haproxy.cfg
Maintainers
Readme
haproxy-manager
Interactive CLI to manage HAProxy routes (HTTP by domain, HTTPS by SNI, TCP
passthrough) without hand-editing haproxy.cfg. Routes are stored in
haproxy-data/routes.json and generated into haproxy-data/haproxy.cfg.
Usage (on your HAProxy server)
Without installing (npx / bunx)
npx haproxy-manager
# or
bunx haproxy-managerGlobal install
npm install -g haproxy-manager
haproxy-managerLocal install (for development)
git clone https://github.com/fadlee/haproxy-manager.git
cd haproxy-manager
npm install
npm link # makes the `haproxy-manager` command available globally
haproxy-managerOr run it directly without linking:
node src/cli.jsSeed data
data/routes.seed.json holds a representation of the HAProxy config you had
put together manually (vm1 by domain/SNI plus firebird/app/mysql/webnesia_mysql).
To start from it, copy it to the active data location:
mkdir -p haproxy-data
cp data/routes.seed.json haproxy-data/routes.jsonIf haproxy-data/routes.json does not exist at all, the CLI creates an empty
config on first run.
Menu
The main menu is intentionally short — the details live in submenus:
- List all routes — show HTTP, HTTPS, and TCP routes (counts appear in the label)
- Add route → pick a type:
- HTTP (by domain) — name, domain suffixes (comma-separated), backend
- HTTPS (by SNI) — same, but matched via SNI and TLS is forwarded untouched to the backend
- TCP passthrough — open one port and forward it 1:1 to a backend (MySQL, Firebird, etc)
- Modify route → Edit / Delete / Default backend HTTP or HTTPS
- Generate, validate & reload config
- Generate haproxy.cfg — rewrite
haproxy-data/haproxy.cfgfrom current data - Validate haproxy.cfg — run
haproxy -c -f ...(requires thehaproxybinary on PATH) - Reload HAProxy service — run
systemctl reload haproxy(requires permissions, trysudo)
- Generate haproxy.cfg — rewrite
Every submenu has a ← Back option to return to the main menu.
Each prompt also prints short inline hints (what a backend is, what
send-proxy-v2 does, how domain/SNI suffixes match) so you do not need the docs.
Recommended workflow
- Add/edit routes through the CLI menu
- Generate
haproxy.cfg - Validate before using it
- If OK, copy
haproxy-data/haproxy.cfgto your production HAProxy config location (or pointHAPROXY_MANAGER_DIRstraight at your HAProxy config folder, e.g./etc/haproxy, so generate writes there directly — but back up first) - Reload the service
Overriding the data location
HAPROXY_MANAGER_DIR=/etc/haproxy haproxy-managerNotes
- Validation and reload run locally on the machine where this CLI runs — so it is best used directly on the HAProxy server (via SSH), not from your laptop, unless you extend it yourself for remote exec over SSH.
- For reload, the user running the CLI needs permission to
systemctl reload haproxy(usually requiressudoor a dedicated polkit/sudoers rule).
