Skip to content

feat: easy proxy verify — health check, auto-run by create (#27)#29

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

feat: easy proxy verify — health check, auto-run by create (#27)#29
montoyaedu merged 1 commit into
masterfrom
feat/issue-27-proxy-verify

Conversation

@montoyaedu
Copy link
Copy Markdown
Member

Problem

easy proxy create returned exit 0 as soon as docker run succeeded — but docker run only starts the container. If nginx then crashes on a bad config (e.g. an unresolvable upstream), the container exits and create has already reported success. The operator finds out later via reload ("Proxy is not running.") or the logs. This caused real confusion during two outages.

Fix

  • easy proxy verify — read-only command. Exits 0 when the proxy container is running; otherwise prints the startup error from docker logs and exits non-zero.
  • easy proxy create auto-runs the verify — after docker run it waits EASY_VERIFY_DELAY seconds (default 2), then verifies the container is actually up. If nginx crashed, create surfaces the reason and exits non-zero. create no longer lies.

Changes

  • commands/proxy.shverify subcommand + __easy_command_proxy_verify; create calls it after docker run.
  • test/verify.bats — 6 tests; test_helper.bash — stateful mock_docker_lifecycle (run → ps reflects state); easy_setup sets EASY_VERIFY_DELAY=0 so tests don't wait; the 3 existing create tests use the new mock.
  • CLAUDE.md, README.md, CHANGELOG.md updated.

Test plan

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

npm run lint   # exits 0
bats test/     # 44/44 (38 + 6 new)

Closes #27

🤖 Generated with Claude Code

`easy proxy create` returned exit 0 as soon as `docker run` succeeded —
but `docker run` only starts the container; nginx can still crash on a
bad config and the container exits. `create` had already reported
success. This caused real confusion during two outages.

- commands/proxy.sh:
  - `easy proxy verify` — checks the container is running; if not, prints
    the startup error from `docker logs`. Exits non-zero when unhealthy.
  - `easy proxy create` runs the verify after `docker run` (after a short
    EASY_VERIFY_DELAY), so it no longer reports success on a crash.
- test/verify.bats: 6 tests; test_helper: stateful `mock_docker_lifecycle`;
  easy_setup sets EASY_VERIFY_DELAY=0; the 3 create tests use the new mock
- CLAUDE.md, README.md, CHANGELOG.md updated

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

Closes #27

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@montoyaedu montoyaedu merged commit 9108bc4 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 verify — health check after create (create currently lies)

1 participant