Skip to content

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.

License

Notifications You must be signed in to change notification settings

snorwin/haproxy-reload-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.✨

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •