P18: fix #135 #136 #140 — coredns gen, notebook endpoints, dashboard

- gen_coredns.py: generates hosts + Corefile from stack.toml
  [platform].domain and [platform].host_ip
- notebooks: nessie/polaris/sql_generator use cfg.services.*
  instead of hardcoded URLs
- #140: dashboard already derives domain from location.hostname
  via JS — no hardcoded URLs in HTML, only in comments
This commit is contained in:
kert
2026-03-23 19:53:12 -04:00
parent e801b987b6
commit 0091de07ad
5 changed files with 83 additions and 4 deletions

View File

@@ -5,6 +5,13 @@
192.168.1.192 notebooks.homelab.fhirworx.io
192.168.1.192 api.homelab.fhirworx.io
192.168.1.192 s3.homelab.fhirworx.io
192.168.1.192 s3console.homelab.fhirworx.io
192.168.1.192 grafana.homelab.fhirworx.io
192.168.1.192 traefik.homelab.fhirworx.io
192.168.1.192 zotero.homelab.fhirworx.io
192.168.1.192 nessie.homelab.fhirworx.io
192.168.1.192 polaris.homelab.fhirworx.io
192.168.1.192 trino.homelab.fhirworx.io
192.168.1.192 prometheus.homelab.fhirworx.io
192.168.1.192 jaeger.homelab.fhirworx.io
192.168.1.192 loki.homelab.fhirworx.io

View File

@@ -0,0 +1,67 @@
"""Generate coredns/hosts and coredns/Corefile from stack.toml.
Usage::
uv run python dev/scripts/gen_coredns.py
"""
from __future__ import annotations
from pathlib import Path
from conf import ROOT, cfg
SUBDOMAINS = [
"", # bare domain
"gitea",
"ci",
"docs",
"notebooks",
"api",
"s3",
"s3console",
"grafana",
"traefik",
"zotero",
"nessie",
"polaris",
"trino",
"prometheus",
"jaeger",
"loki",
]
OUT_DIR = ROOT / "coredns"
def generate() -> None:
domain = cfg.platform.domain
host_ip = cfg.platform.host_ip
# hosts file
lines = []
for sub in SUBDOMAINS:
fqdn = f"{sub}.{domain}" if sub else domain
lines.append(f"{host_ip} {fqdn}")
(OUT_DIR / "hosts").write_text("\n".join(lines) + "\n")
# Corefile
corefile = f"""{domain} {{
hosts /etc/coredns/hosts {{
fallthrough
}}
log
}}
. {{
forward . 1.1.1.1 8.8.8.8
cache 300
}}
"""
(OUT_DIR / "Corefile").write_text(corefile)
print(f"Generated coredns/hosts ({len(SUBDOMAINS)} entries) and coredns/Corefile")
if __name__ == "__main__":
generate()

View File

@@ -22,7 +22,9 @@ def _():
import requests
import json
NESSIE_API = "http://nessie:19120/api/v2"
from conf import cfg
NESSIE_API = f"{cfg.services.nessie}/api/v2"
return NESSIE_API, json, requests

View File

@@ -24,7 +24,9 @@ def _():
import json
import os
POLARIS_API = "http://polaris:8181"
from conf import cfg
POLARIS_API = cfg.services.polaris
CLIENT_ID = "root"
CLIENT_SECRET = os.environ.get("POLARIS_ROOT_SECRET", "polaris_root_secret")
return POLARIS_API, CLIENT_ID, CLIENT_SECRET, json, requests, os
@@ -123,7 +125,7 @@ def _(POLARIS_API, headers, json, requests):
"allowedLocations": ["s3://polaris/", "s3://lakehouse/"],
"s3": {
"region": "us-east-1",
"endpoint": "http://rustfs:9000",
"endpoint": cfg.services.rustfs,
"pathStyleAccess": True
}
}

View File

@@ -30,9 +30,10 @@ def _(mo):
@app.cell(hide_code=True)
def _():
from aco.lake.transpile import transpile
from conf import cfg
DIALECT = "databricks"
CATALOG = "homelab"
CATALOG = cfg.platform.repo.split("/")[0] # "homelab"
def run_transpile(pipeline, label):
"""Transpile a pipeline and return formatted SQL."""