Files
system-config/playbooks/roles/gitea-lb/templates/gitea-haproxy.cfg.j2
Clark Boylan 790fa8bfc2 Have haproxy check gitea's health status endpoint
Previously we ran a HEAD against / and any 2XX or 3XX response would
indicate the server was up. Our new image builds coincide with gitea
server restarts and we've discovered that image builds are getting 503
errors requesting git repo data but presumably HEAD / is returning a 2XX
during this restart period. Make the health check more robust by
checking the actual healthz endpoint which checks the server status
internally instead. This should hopefully keep servers out of rotation
when they are not ready for requests.

Change-Id: I2c6c23027713ebe81d5e07e641759fd77ad01bb9
2025-07-23 09:29:29 -07:00

37 lines
850 B
Django/Jinja

global
uid 1000
gid 1000
log /dev/log local0
maxconn 4000
pidfile /var/haproxy/run/haproxy.pid
stats socket /var/haproxy/run/stats uid 1000 gid 1000 mode 0600 level admin
defaults
log-format "%ci:%cp [%t] %ft [%bi]:%bp %b/%s %Tw/%Tc/%Tt %B %ts %ac/%fc/%bc/%sc/%rc %sq/%bq"
log global
maxconn 8000
option redispatch
retries 3
stats enable
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 2m
timeout server 2m
timeout check 10s
{% for listener in gitea_lb_listeners %}
listen {{ listener.name }}
{% for bind in listener.bind %}
bind {{ bind }}
{% endfor %}
mode tcp
balance source
option httpchk GET /api/healthz
{% for server in listener.servers %}
server {{ server.name }} {{ server.address }} {{ server.check_method }}
{% endfor %}
{% endfor %}