Skip to content

feat: easy proxy recover — break-glass network recovery (#28)#30

Merged
montoyaedu merged 1 commit into
masterfrom
feat/issue-28-proxy-recover
May 18, 2026
Merged

feat: easy proxy recover — break-glass network recovery (#28)#30
montoyaedu merged 1 commit into
masterfrom
feat/issue-28-proxy-recover

Conversation

@montoyaedu
Copy link
Copy Markdown
Member

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 connect loop.

Fix

easy proxy recover — a break-glass tool that restores service and explains the misconfiguration.

  1. Scans /domains/*/*.conf for backend hostnames — server directives inside upstream {} blocks and proxy_pass targets.
  2. docker inspects each → tallies the user-defined networks they share (bridge/host/none excluded — the default bridge has no name-based DNS).
  3. 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.
  4. Connects the proxy to the backend networks, restarts, and runs the verify.
  5. --consolidate instead 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.shrecover subcommand + __easy_command_proxy_recover + help entry.
  • test/recover.bats — 5 tests; test_helper.bashmock_docker_topology (per-container networks from a topology file).
  • CLAUDE.md, README.md, CHANGELOG.md updated.

Test plan

TDD — 5 tests written first, watched fail, then made green.

npm run lint   # exits 0
bats test/     # 49/49 (44 + 5 new)

Closes #28

🤖 Generated with Claude Code

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>
@montoyaedu montoyaedu merged commit 81a3866 into master May 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

easy proxy recover — break-glass network recovery with statistical edge-network detection

1 participant