feat: easy proxy recover — break-glass network recovery (#28)#30
Merged
Conversation
When the proxy is recreated without joining the backends' Docker networks, nginx can't resolve the upstreams and aborts at startup — every proxied site goes down. Recovery meant a manual `docker network connect` loop. Add `easy proxy recover`: - scans the vhost configs for backend hostnames (upstream `server` directives and `proxy_pass` targets) - `docker inspect`s each → tallies the user-defined networks they share (bridge/host/none excluded — the default bridge has no name DNS) - the network shared by the most backends is the de-facto edge network (or EASY_PROXY_NETWORK when set); the rest are reported as outliers - connects the proxy to the backend networks, restarts, runs verify - `--consolidate` attaches the backends to the edge network instead - commands/proxy.sh: `recover` subcommand + help entry - test/recover.bats: 5 tests; test_helper: mock_docker_topology - CLAUDE.md, README.md, CHANGELOG.md updated `npm run lint` exits 0; the bats suite passes 49/49. Closes #28 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Problem
When the proxy is recreated without joining the backends' Docker networks, nginx can't resolve the upstreams and aborts at startup — every proxied site goes down. Recovery meant a manual
docker network connectloop.Fix
easy proxy recover— a break-glass tool that restores service and explains the misconfiguration./domains/*/*.conffor backend hostnames —serverdirectives insideupstream {}blocks andproxy_passtargets.docker inspects each → tallies the user-defined networks they share (bridge/host/noneexcluded — the default bridge has no name-based DNS).EASY_PROXY_NETWORKwhen set); the rest are reported as outliers.--consolidateinstead attaches the backends to the edge network — the clean end state, proxy on one network.The statistical tally is what makes it smart: it picks the network deterministically and surfaces exactly which backends are misconfigured.
Changes
commands/proxy.sh—recoversubcommand +__easy_command_proxy_recover+ help entry.test/recover.bats— 5 tests;test_helper.bash—mock_docker_topology(per-container networks from a topology file).CLAUDE.md,README.md,CHANGELOG.mdupdated.Test plan
TDD — 5 tests written first, watched fail, then made green.
Closes #28
🤖 Generated with Claude Code