Conversation
Two relays behind HAProxy with /readyz health checks, DNS re-resolution for recreated containers, and option redispatch. Adds a rolling recreate script that replaces one relay at a time so a ready backend always serves traffic.
🦋 Changeset detectedLatest commit: 967d4af The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pr adds an alternative production topology: two relay containers (
nostream-blue,nostream-green) behind HAProxy on127.0.0.1:8008, and a script that replaces them one at a time.deploy/haproxy/haproxy.cfg:- round-robin across both relays,/readyzhealth checks, andoption redispatchso a request that fails on a dying backend is retried on the other one rather than returned to the client.A
resolvers dockerblock re-resolves backend names against Docker's embedded DNS every 2s, so a recreated container's new IP is picked up;init-addr libc,nonelets HAProxy boot before the relays are resolvable.deploy/docker-compose.haproxy.yml:- HAProxy plus the two relays, sharing one YAML anchor. Postgres, Redis, and the migrate job are unchanged fromdocker-compose.prod.yml. Relays getstop_grace_period: 45sso theWS_DRAIN_TIMEOUT_MSdrain finishes before Docker escalates to SIGKILL.deploy/rolling-relay-recreate.sh:- stops one relay, waits for its replacement to report healthy viaup --wait, then moves to the second.deploy/README.md— install and update procedure.docker-compose.prod.ymland the single-relay flow are untouched; operators opt in by using the new compose file.Related Issue
Closes:- #776 and Relates to #773
Motivation and Context
How Has This Been Tested?
docker compose -f deploy/docker-compose.haproxy.yml configparses, and both relays correctly inheritdepends_on,healthcheck, andstop_grace_periodfrom the shared anchorhaproxy -c -f haproxy.cfgagainsthaproxy:3.0-alpineexits 0. It emits two[NOTICE]lines about unresolvable backends when run outside the Compose network, which is the expectedinit-addr libc,nonepath — HAProxy parks theservers and boots instead of aborting
rolling-relay-recreate.shwith a WebSocket client connected to confirm no dropped requests during cutover.Screenshots (if appropriate):
Types of changes
Checklist: