#!/usr/bin/env python3 """Basic health check for Lichen — verifies the dashboard and API are up.""" import argparse import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..')) from utils.tests.helpers import http_get, resolve_domain def main(): parser = argparse.ArgumentParser() parser.add_argument('--domain', default=os.environ.get('TEST_DOMAIN')) args = parser.parse_args() domain = args.domain or resolve_domain('lichen') url = f"https://{domain}" print("Lichen health check") print() # Step 1: TLS check endpoint print("Step 1: Checking /tls-check endpoint ...") status, _ = http_get(f"{url}/tls-check") if status != 200: print(f" FAIL: /tls-check returned HTTP {status}") sys.exit(1) print(f" PASS: /tls-check returned HTTP {status}") # Step 2: Dashboard redirects to login (auth enabled) print("Step 2: Checking dashboard redirects to login ...") status, _ = http_get(url) if status not in (200, 303, 302): print(f" FAIL: Dashboard returned HTTP {status}") sys.exit(1) print(f" PASS: Dashboard returned HTTP {status}") # Step 3: API endpoint print("Step 3: Checking /api/sites endpoint ...") status, _ = http_get(f"{url}/api/sites") if status == 0 or status >= 500: print(f" FAIL: API returned HTTP {status}") sys.exit(1) print(f" PASS: API returned HTTP {status}") print() print("PASS: Lichen health check passed") if __name__ == '__main__': main()