mirror of
https://github.com/blackboxprogramming/BlackRoad-Operating-System.git
synced 2026-03-17 09:37:55 -05:00
Implements a declarative domain orchestrator that reads ops/domains.yaml and automatically applies DNS and forwarding configuration via GoDaddy and Cloudflare APIs. Features: - YAML-based configuration for all domains (ops/domains.yaml) - Python script to apply changes idempotently (ops/scripts/apply_domains.py) - GitHub Actions workflow to sync on YAML changes (sync-domains.yml) - Optional health check workflow (domain-health.yml) - Comprehensive documentation (docs/domains-overview.md) The system supports: - GoDaddy: DNS records and 301 forwarding - Cloudflare: DNS records (CNAME, A) All API credentials are read from GitHub secrets (GODADDY_API_KEY, GODADDY_API_SECRET, CLOUDFLARE_TOKEN).
47 lines
1.2 KiB
YAML
47 lines
1.2 KiB
YAML
name: Domain Health Check
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 */6 * * *" # every 6 hours
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
health:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install pyyaml requests
|
|
|
|
- name: Run health checks
|
|
env:
|
|
# Add any API keys if needed for your health checks (not required for simple HTTP GET)
|
|
run: |
|
|
python - <<'PY'
|
|
import yaml, requests, os
|
|
|
|
with open("ops/domains.yaml") as f:
|
|
cfg = yaml.safe_load(f)
|
|
|
|
for d in cfg.get("domains", []):
|
|
# Only health-check DNS records pointing to HTTP(S) targets
|
|
health = d.get("healthcheck", False)
|
|
if d.get("mode") == "dns" and health:
|
|
url = "https://" + d["name"]
|
|
try:
|
|
r = requests.get(url, timeout=10)
|
|
status = "healthy" if r.status_code < 400 else f"unhealthy (status {r.status_code})"
|
|
except Exception as e:
|
|
status = f"unhealthy (error {e})"
|
|
print(f"{d['name']}: {status}")
|
|
PY
|