Skip to content

feat: easy proxy doctor — pre-flight config & network diagnostic (#22)#24

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

feat: easy proxy doctor — pre-flight config & network diagnostic (#22)#24
montoyaedu merged 1 commit into
masterfrom
feat/issue-22-proxy-doctor

Conversation

@montoyaedu
Copy link
Copy Markdown
Member

Summary

Adds easy proxy doctor, a read-only diagnostic — the safety net the recent outage lacked. That outage was caused by a hand-written vhost using a static upstream {} block: nginx resolves such hosts at startup and aborts if one fails, taking down every site. Nothing surfaced the risk before recreating the container.

What doctor checks

  • Static vhost scan (host-side, no Docker needed) — flags:
    • upstream {} blocks → resolved at nginx startup; one bad host blocks all sites. Advises the variable form.
    • deprecated listen ... http2 directive.
  • nginx config testnginx -t inside the container, when the proxy is running.
  • Proxy networks — lists the Docker networks the container is joined to.
  • Exit code — non-zero only when nginx -t fails (a definite startup blocker); warnings alone don't fail it.

Changes

  • commands/proxy.shdoctor subcommand + __easy_command_proxy_doctor + help entry.
  • test/doctor.bats — 7 tests; test/test_helper.bashmock_docker_nginx_invalid.
  • CLAUDE.md, README.md — command tables; CHANGELOG.md[Unreleased] entry.

Test plan

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

npm run lint   # exits 0
bats test/     # 29/29 (22 + 7 new)

Notes

  • Scoped to the high-value checks. Per-vhost upstream resolvability (DNS-checking each backend from inside the container) is a natural follow-up, not included here.
  • The network check lists the proxy's networks; flagging them against a configured edge network lands with EASY_PROXY_NETWORK — declarative edge network for the proxy #23 (EASY_PROXY_NETWORK).

Closes #22

🤖 Generated with Claude Code

A live outage was caused by a hand-written vhost using a static
`upstream {}` block: nginx resolves such hosts at startup and aborts if
one fails — taking down every site. Nothing surfaced the risk before a
container recreate.

Add `easy proxy doctor`, a read-only diagnostic:
- static vhost scan (host-side): flags `upstream {}` blocks and the
  deprecated `listen ... http2` directive
- nginx config test (`nginx -t`) when the proxy is running
- lists the proxy's Docker networks
- exits non-zero only when `nginx -t` fails (a definite startup blocker)

- commands/proxy.sh: `doctor` subcommand + help entry
- test/doctor.bats: 7 tests; test_helper: mock_docker_nginx_invalid
- CLAUDE.md, README.md: command tables; CHANGELOG.md: Unreleased entry

`npm run lint` exits 0; the bats suite passes 29/29.

Closes #22

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@montoyaedu montoyaedu merged commit 053505c 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 doctor — pre-flight config & network diagnostics

1 participant