-
Notifications
You must be signed in to change notification settings - Fork 0
Fix maintenance flow, readiness gating, and quickstart #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ PODMAN ?= podman | |
| PYTHON ?= python3 | ||
| EGRESSD_IMAGE ?= localhost/hg-proxychains-egressd-validate:latest | ||
|
|
||
| .PHONY: deps smoke down logs health ready pycheck unittest test check preflight validate-config validate-image repo-scan repo-clean maintenance maintenance-fix bundle clean | ||
| .PHONY: deps smoke down logs health ready pycheck unittest test check preflight validate-config validate-image repo-scan repo-scan-json repo-clean maintenance maintenance-json maintenance-fix maintenance-all maintenance-all-json maintenance-baseline bundle clean | ||
|
|
||
| deps: | ||
| scripts/bootstrap-third-party.sh | ||
|
|
@@ -24,7 +24,7 @@ ready: | |
| curl -i http://localhost:9191/ready | ||
|
|
||
| pycheck: | ||
| $(PYTHON) -m py_compile egressd/supervisor.py egressd/chain.py egressd/readiness.py egressd/preflight.py egressd/test_supervisor.py egressd/test_supervisor_readiness.py client/test_client.py exitserver/echo_server.py funkydns-smoke/check_resolution.py funkydns-smoke/generate_cert.py funkydns-smoke/run_funkydns.py tests/test_chain.py tests/test_preflight.py tests/test_hop_connectivity.py | ||
| $(PYTHON) -m py_compile egressd/supervisor.py egressd/chain.py egressd/readiness.py egressd/preflight.py egressd/test_supervisor.py egressd/test_supervisor_readiness.py client/test_client.py exitserver/echo_server.py funkydns-smoke/check_resolution.py funkydns-smoke/generate_cert.py funkydns-smoke/run_funkydns.py tests/test_chain.py tests/test_preflight.py tests/test_hop_connectivity.py scripts/repo_hygiene.py scripts/repo_maintenance.py scripts/test_repo_hygiene.py | ||
|
|
||
| unittest: | ||
| $(PYTHON) -m unittest egressd/test_supervisor_readiness.py egressd/test_supervisor.py tests/test_readiness.py tests/test_supervisor.py tests/test_chain.py tests/test_preflight.py tests/test_hop_connectivity.py scripts/test_repo_hygiene.py | ||
|
|
@@ -43,65 +43,31 @@ validate-config: validate-image | |
| $(PODMAN) run --rm -e EGRESSD_VALIDATE_ONLY=1 $(EGRESSD_IMAGE) $(PYTHON) /opt/egressd/supervisor.py | ||
|
|
||
| repo-scan: | ||
| $(PYTHON) scripts/repo_hygiene.py scan --repo-root . | ||
| $(PYTHON) scripts/repo_hygiene.py scan --repo-root . --no-include-third-party | ||
|
|
||
| repo-clean: | ||
| $(PYTHON) scripts/repo_hygiene.py clean --repo-root . | ||
| $(PYTHON) scripts/repo_hygiene.py clean --repo-root . --no-include-third-party | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| maintenance: | ||
| $(PYTHON) scripts/repo_maintenance.py | ||
| $(PYTHON) scripts/repo_maintenance.py --no-include-third-party | ||
|
|
||
| maintenance-fix: | ||
| $(PYTHON) scripts/repo_maintenance.py --fix | ||
| $(PYTHON) scripts/repo_maintenance.py --no-include-third-party --fix | ||
|
|
||
| repo-scan-json: | ||
| python3 scripts/repo_hygiene.py scan --repo-root . --json | ||
|
|
||
| maintenance: | ||
| python3 scripts/repo_maintenance.py --no-include-third-party | ||
|
|
||
| maintenance-fix: | ||
| python3 scripts/repo_maintenance.py --no-include-third-party --fix | ||
| $(PYTHON) scripts/repo_hygiene.py scan --repo-root . --no-include-third-party --json | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| maintenance-json: | ||
| python3 scripts/repo_maintenance.py --no-include-third-party --json | ||
| $(PYTHON) scripts/repo_maintenance.py --no-include-third-party --json | ||
|
|
||
| maintenance-all: | ||
| python3 scripts/repo_maintenance.py | ||
| $(PYTHON) scripts/repo_maintenance.py --include-third-party | ||
|
|
||
| maintenance-all-json: | ||
| python3 scripts/repo_maintenance.py --json | ||
|
|
||
| maintenance: | ||
| python3 scripts/repo_hygiene.py scan --repo-root . --include-third-party | ||
|
|
||
| maintenance-fix: | ||
| python3 scripts/repo_hygiene.py clean --repo-root . --include-third-party | ||
| $(PYTHON) scripts/repo_maintenance.py --include-third-party --json | ||
|
|
||
| maintenance-baseline: | ||
| python3 scripts/repo_hygiene.py baseline --repo-root . --include-third-party | ||
|
|
||
| maintenance: | ||
| python3 scripts/repo_maintenance.py --no-include-third-party | ||
|
|
||
| maintenance-fix: | ||
| python3 scripts/repo_maintenance.py --no-include-third-party --fix | ||
|
|
||
| maintenance: | ||
| python3 scripts/repo_hygiene.py scan --repo-root . --json | ||
|
|
||
| maintenance-fix: | ||
| python3 scripts/repo_hygiene.py clean --repo-root . --json | ||
|
|
||
| maintenance: repo-scan | ||
|
|
||
| maintenance-fix: repo-clean | ||
|
|
||
| repo-scan: | ||
| $(MAKE) maintenance | ||
|
|
||
| repo-clean: | ||
| $(MAKE) maintenance-fix | ||
| $(PYTHON) scripts/repo_hygiene.py baseline --repo-root . --include-third-party | ||
|
|
||
| bundle: | ||
| tar -czf egressd-starter.tar.gz . | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # QUICKSTART | ||
|
|
||
| Fastest path to verify the smoke harness end to end: | ||
|
|
||
| 1. Initialize the private FunkyDNS submodule: | ||
| ```bash | ||
| git submodule update --init --recursive third_party/FunkyDNS | ||
| ``` | ||
| If you prefer the helper script, run `make deps` instead. | ||
|
|
||
| 2. Start the stack: | ||
| ```bash | ||
| podman-compose up --build | ||
| ``` | ||
| Or run `make smoke`. | ||
|
|
||
| 3. Wait for the one-shot `client` container to finish. A good run prints: | ||
| - `DNS OK` / `DoH OK` for `smoke.test` | ||
| - `DNS OK` / `DoH OK` for `hosts.smoke.internal` | ||
| - `DNS OK` / `DoH OK` for `printer` | ||
| - `CONNECT` followed by `OK from exit-server` | ||
|
|
||
| 4. Spot-check health endpoints: | ||
| ```bash | ||
| curl -sk https://localhost:18443/healthz | ||
| curl http://localhost:9191/health | ||
| curl -f http://localhost:9191/ready | ||
| ``` | ||
|
|
||
| 5. Tear it down when finished: | ||
| ```bash | ||
| podman-compose down -v | ||
| ``` | ||
| Or run `make down`. | ||
|
|
||
| If anything looks off, use `make logs` and then read `README.md` or `docs/USER-FLOW-REVIEW.md` for the deeper walkthrough. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -234,6 +234,16 @@ def parse_proxy_url(url: str) -> Tuple[str, int, Optional[str]]: | |
| return host, port, auth_header | ||
|
|
||
|
|
||
| def _parse_http_status_code(status_line: str) -> Optional[int]: | ||
| parts = status_line.split() | ||
| if len(parts) < 2: | ||
| return None | ||
| try: | ||
| return int(parts[1]) | ||
| except ValueError: | ||
| return None | ||
|
|
||
|
|
||
| def check_hop_connectivity(hop_url: str, target: str, timeout: float = 3.0) -> Dict[str, Any]: | ||
| start = time.time() | ||
| checked_at = int(start) | ||
|
|
@@ -254,11 +264,15 @@ def check_hop_connectivity(hop_url: str, target: str, timeout: float = 3.0) -> D | |
| sock.sendall(request.encode("utf-8")) | ||
| response = sock.recv(4096).decode("utf-8", errors="ignore") | ||
| status_line = response.splitlines()[0] if response else "<no-response>" | ||
| ok = any(code in status_line for code in (" 200 ", " 403 ", " 407 ")) | ||
| status_code = _parse_http_status_code(status_line) | ||
| reachable = status_code is not None | ||
| ok = status_code is not None and 200 <= status_code < 300 | ||
| result = { | ||
| "ok": ok, | ||
| "reachable": reachable, | ||
| "proxy": proxy_label, | ||
| "status_line": status_line, | ||
| "status_code": status_code, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Error path missing new
|
||
| "elapsed_ms": int((time.time() - start) * 1000), | ||
| "checked_at": checked_at, | ||
| } | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
--no-include-third-partyflag is redundant.scripts/repo_hygiene.pydefaults to excluding third-party directories, so this flag can be removed to simplify the command.