hapc(1)

πŸ“¦
version 0.0.7build1 Β· 2 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ‘‘ hapc β€” administrative commands for your haproxy service πŸ‘‘

okay bestie, welcome to hapc(1), straight outta the General Commands Manual section. this is the page for hapc, and honestly? it's giving "small tool, big power". let's get into it πŸ’…


✨ NAME ✨

hapc β€” administrative commands for your haproxy service

like. that's the whole vibe. it's the admin-bestie for your haproxy. 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

hapc <action> [options] [arguments]

that's it. that's the shape of it. you pick an action, you sprinkle on some options, you hand it the arguments, and hapc does the thing. iconic behaviour, no notes. ✨


πŸ’– DESCRIPTION πŸ’–

so what does hapc actually do? it configures the backends of an haproxy setup, which means you can put backend servers into maintenance gracefully. no drama, no dropped connections, no 3am panic. it's the "hey bestie, take a little break" of load balancing. 😌


🌸 OPTIONS 🌸

  • -verbose | -v β€” Display with a more verbose output. she's chatty. she's telling you everything. lowkey obsessed with the details fr fr.

πŸŽ€ ACTIONS πŸŽ€

  • list-backends [-l|--links] β€” List all available backends, asking through the haproxy socket file. (yes, she asks. through the socket. polite queen.) πŸ‘‘
  • list-frontends β€” List all available frontend as configured in the haproxy.cfg file.
  • list-config-backends β€” List all available backends as configured in the haproxy.cfg file.
  • list-servers [-b|--backend] <backend> [-d|--details] β€” List all available servers for a given backend. With --details, the command shows the state of the servers (if they are active in the backend or not). so you can vibe check each server individually πŸ’…
  • list-connections [-b|--backend] <backend> [-s|--server] <server> β€” Show the number of connections for a given backend and server. the receipts. the numbers. the truth. πŸ“Š
  • enable-server [-b|--backend] <backend> [-s|--server] <server> β€” Set a server as ACTIVE in its backend. welcome back to the main character slot bestie 🫢
  • drain-server [-b|--backend] <backend> [-s|--server] <server> [-w|--wait] β€” Gracefuly drain a server from its backend. If the --wait option is added, then hapc waits for all connections to be closed before returning, with a timeout set to 60 seconds. so she'll wait for you, but only for a minute. set a boundary, queen. ⏳
  • stop-server [-b|--backend] <backend> [-s|--server] <server> β€” Forceably remove a server from its backend, eventually killing existing connections.
🚨 okay so this one is the no-mercy one. it forceably removes the server and it eventually kills existing connections. if you wanted gentle, that was drain-server. this is the "we're done here" button. πŸ’€
  • check-safe-to-remove [-b|--backend] <backend> [-s|--server] <server> β€” Check if a server is safe to remove from its backend (ie: check if there's not existing connections to it). the little pre-flight check before you do something you can't undo. bless. πŸ™ˆ
  • reload-haproxy β€” Reload haproxy. that's it. that's the action. reload. haproxy. πŸ”₯

πŸ”§ DESCRIPTION πŸ”§

(yes, again β€” she's thorough, we love her for it ✨)

hapc needs an admin socket to be able to use it. So it is needed to add this to /etc/haproxy/haproxy.cfg:

global
        stats socket /var/lib/haproxy/admin.sock mode 600 level admin
πŸ“Œ no admin socket = no hapc. it's the whole entire prerequisite. put it in the config, or the tool is just gonna sit there looking at you. πŸ₯²

πŸ“œ LICENSE πŸ“œ

This is released under the Apache-2.0 license.


πŸ‘‘ AUTHORS πŸ‘‘

This utility has been written by Olivier Chaze <olivier.chaze at infomaniak dot com> and Thomas Goirand <zigo at debian dot org> for internal use in the Infomaniak servers.


and that's a wrap on the hapc(1) page from the General Commands Manual section, bestie πŸ’– go forth, drain those servers gracefully, and remember: --wait has a 60 second timeout, so don't leave her hanging. byeeeee πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from