Skip to content

fix: activate healthchecks for HAProxy backends#163

Merged
jansdhillon merged 8 commits into
canonical:mainfrom
jansdhillon:fix-haproxy-health-checks
Jul 8, 2026
Merged

fix: activate healthchecks for HAProxy backends#163
jansdhillon merged 8 commits into
canonical:mainfrom
jansdhillon:fix-haproxy-health-checks

Conversation

@jansdhillon

@jansdhillon jansdhillon commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

https://warthogs.atlassian.net/browse/LNDENG-4768

Health checks were being ignored for most backends because interval, rise, and fall were not set, so HAProxy can't correctly detect when the services are up. The haproxy-route library only activates health checks when all three are provided:

if interval and rise and fall:
    server_healthcheck_configuration = {
        "interval": interval,
        "rise": rise,
        "fall": fall,
        "path": path,
        "port": port,
    }

This PR adds check_interval=2, check_rise=2, check_fall=3 to all backends that were missing them, and keeps check_path set to the path each service actually serves (e.g. /ping for pingserver, /message-system for message-server).

Manual testing

make deploy

After the services start, set the HAProxy unit IP to landscape.local in /etc/hosts. Then verify all routes are healthy:

# appserver
http --verify=no -h get https://landscape.local/ | grep HTTP/ | cut -d ' ' -f 2
# api
http --verify=no -h get https://landscape.local/api/about | grep HTTP/ | cut -d ' ' -f 2
# pingserver
http --verify=no -h get http://landscape.local/ping | grep HTTP/ | cut -d ' ' -f 2
# msgserver
http --verify=no -h get https://landscape.local/message-system | grep HTTP/ | cut -d ' ' -f 2
# pkg upload
http --verify=no -h get https://landscape.local/upload | grep HTTP/ | cut -d ' ' -f 2

...

200
200
200
200
200

@jansdhillon jansdhillon added the bug Something isn't working label Jun 30, 2026
@jansdhillon jansdhillon changed the title fix: activate healthchecks for HAProxy backends, use ports instead of paths fix: activate healthchecks for HAProxy backends Jun 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ensures HAProxy health checks are actually enabled for Landscape’s routed backends by providing the full health-check timing tuple (check_interval, check_rise, check_fall) everywhere it was missing, and by aligning check_path values with real service endpoints (notably updating API to use /api/about).

Changes:

  • Add check_interval=2, check_rise=2, check_fall=3 to the appserver, pingserver, message-server, and API HAProxy routes.
  • Normalize package-upload health-check interval to 2 (seconds) and remove the repository route’s unused health-check path.
  • Expand unit tests to assert per-route check_path and health-check timing, and to ensure check_port is not set.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/charm.py Enables HAProxy health checks for key backends by supplying interval/rise/fall and updates API check path to /api/about; removes repository’s unused check path.
tests/unit/test_haproxy_route.py Updates interval unit expectation (seconds) and adds coverage for per-route check paths and health-check timing configuration.

@HJK-X HJK-X left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jansdhillon jansdhillon merged commit 67f0146 into canonical:main Jul 8, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants