feat: easy proxy verify — health check, auto-run by create (#27)#29
Merged
Conversation
`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>
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
easy proxy createreturned exit 0 as soon asdocker runsucceeded — butdocker runonly starts the container. If nginx then crashes on a bad config (e.g. an unresolvable upstream), the container exits andcreatehas already reported success. The operator finds out later viareload("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 fromdocker logsand exits non-zero.easy proxy createauto-runs the verify — afterdocker runit waitsEASY_VERIFY_DELAYseconds (default 2), then verifies the container is actually up. If nginx crashed,createsurfaces the reason and exits non-zero.createno longer lies.Changes
commands/proxy.sh—verifysubcommand +__easy_command_proxy_verify;createcalls it afterdocker run.test/verify.bats— 6 tests;test_helper.bash— statefulmock_docker_lifecycle(run → ps reflects state);easy_setupsetsEASY_VERIFY_DELAY=0so tests don't wait; the 3 existingcreatetests use the new mock.CLAUDE.md,README.md,CHANGELOG.mdupdated.Test plan
TDD — 6 tests written first, watched fail, then made green.
Closes #27
🤖 Generated with Claude Code