Add standalone managed ingress diagnostics
This commit is contained in:
@@ -200,12 +200,24 @@ if not location.startswith("https://localhost"):
|
||||
]
|
||||
)
|
||||
except subprocess.CalledProcessError:
|
||||
logs = _run(["docker", "logs", container], check=False).stdout.strip()
|
||||
if logs:
|
||||
print(f"managed ingress logs:\n{logs}", file=sys.stderr)
|
||||
_print_container_diagnostics(container)
|
||||
raise
|
||||
|
||||
|
||||
def _print_container_diagnostics(container: str) -> None:
|
||||
state = _run(
|
||||
["docker", "inspect", "--format", "{{json .State}}", container],
|
||||
check=False,
|
||||
)
|
||||
state_detail = (state.stdout + state.stderr).strip()
|
||||
if state_detail:
|
||||
print(f"managed ingress state:\n{state_detail}", file=sys.stderr)
|
||||
logs = _run(["docker", "logs", container], check=False)
|
||||
log_detail = (logs.stdout + logs.stderr).strip()
|
||||
if log_detail:
|
||||
print(f"managed ingress logs:\n{log_detail}", file=sys.stderr)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--caddy-image", required=True)
|
||||
|
||||
Reference in New Issue
Block a user