haproxy-reload-wrapper

command module
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 9 Imported by: 0

README

HAProxy Reload Wrapper

Build Release E2E Tests Go Report Card Releases License

The haproxy-reload-wrapper watches the HAProxy configuration file using an inotify watcher and, if a change is detected, performs a hitless reload by transferring listening sockets from the old HAProxy process to the new, reloaded process. If the new HAProxy process fails to start or the changed configuration is invalid, the old process continues to operate to avoid any interruptions. More details about the reload mechanism in HAProxy can be found in the following blog post: Truly Seamless Reloads with HAProxy – No More Hacks!.

Features

  • Tracking changes in the configuration file and triggering seamless reloads of the HAProxy
  • Graceful signal (termination) handling and transparent management of HAProxy processes
  • Support for configuration files from mounted ConfigMap

How to use

  1. Configure a socket with the expose-fd listeners option in the haproxy.cfg file:
global
  stats socket /var/run/haproxy.sock mode 600 level admin expose-fd listeners
  1. Set the HAPROXY_SOCKET environment variable to the path of the socket if it is different from the default path: /var/run/haproxy.sock.
  2. Optionally set the WATCH_PATH environment variable to watch a directory instead of the haproxy.cfg file only
  3. Replace the docker.io/haproxy image with the ghcr.io/snorwin/haproxy image on container platforms or compile the source code and run ./haproxy-reload-wrapper on a Linux system. As an example, check out the Helm chart used for the tests.
  4. Modify the configuration file and let the magic happen.✨

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL