infra.illanes00.cl — Docs

Documentación · VPS illanes00

Fuente de verdad operativa para despliegues, monitoreo, estilo y runbooks.

Índice

Estado de servicios en vivo

import json
from pathlib import Path

STATUS_PATH = Path("/srv/projects/infra-monitor/status.json")
rows = []
status_missing = False

if STATUS_PATH.exists():
    status = json.loads(STATUS_PATH.read_text(encoding="utf-8"))
    for svc in status.get("services", []):
        rows.append({
            "Servicio": svc.get("slug", "—"),
            "Systemd": svc.get("systemd"),
            "HTTP público": svc.get("http_public"),
            "URL": svc.get("url") or "—",
            "Repositorio": svc.get("repo") or "—",
        })
else:
    status_missing = True
from IPython.display import Markdown, display

def fmt_http(val):
    return {True: "🟢", False: "🔴"}.get(val, "—")

def fmt_systemd(val):
    mapping = {
        "active": "🟢 active",
        "inactive": "🔴 inactive",
        "failed": "🔴 failed",
    }
    return mapping.get(val, "—")

if not rows:
    if status_missing:
        Markdown("> No se encontró `/srv/projects/infra-monitor/status.json`; omitiendo tabla de servicios.")
    else:
        Markdown("> No hay servicios registrados en `infra-monitor/status.json`. Actualiza `update_status.py`. ")
else:
    lines = ["| Servicio | Systemd | HTTP público | URL | Repositorio |", "|---|:---:|:---:|---|---|"]
    for row in sorted(rows, key=lambda r: r["Servicio"]):
        lines.append(
            f"| {row['Servicio']} | {fmt_systemd(row['Systemd'])} | {fmt_http(row['HTTP público'])} | {row['URL']} | {row['Repositorio']} |"
        )
    Markdown("\n".join(lines))

Datos obtenidos de infra-monitor/status.json (generado por update_status.py). Usa la tabla para identificar servicios con health check público o systemd en estado distinto de active.

Documentación por proyecto

from pathlib import Path
from IPython.display import Markdown, display

DOC_ROOT = Path("/srv/projects")
IGNORE_PREFIXES = {"illanes00-docs", "infra-docs.backup", "dist", "tmp", "archive"}
BLOCKED_SEGMENTS = {"data", "assets", "generated", "site_libs", "_site", "node_modules", ".venv", "venv", "__pycache__"}

def should_include(rel: str) -> bool:
    if not rel:
        return False
    head = rel.split("/", 1)[0]
    if head in IGNORE_PREFIXES:
        return False
    if rel.startswith(".") or "/." in rel:
        return False
    if rel.count("/") > 1:
        return False
    for segment in BLOCKED_SEGMENTS:
        if rel == segment or rel.endswith(f"/{segment}") or f"/{segment}/" in rel:
            return False
    return True

docs = set()
for doc_dir in DOC_ROOT.rglob("docs"):
    try:
        relative = doc_dir.parent.relative_to(DOC_ROOT)
    except ValueError:
        continue
    rel_str = relative.as_posix()
    if should_include(rel_str):
        docs.add(rel_str)

LOCAL_DOCS = [
    "compiled",
    "compiled/legacy",
    "pages/clean",
    "pages/imported",
]
for rel in LOCAL_DOCS:
    docs.add(rel)

if not docs:
    display(Markdown("> No se encontraron carpetas `docs/` en `/srv/projects`. Añade una carpeta `docs/` para publicar documentación por proyecto."))
else:
    lines = ["| Ruta | Docs |", "|---|---|"]
    for rel in sorted(docs, key=str.lower):
        lines.append(f"| {rel} | [{rel}/](./{rel}/) |")
    display(Markdown("\n".join(lines)))
Ruta Docs
auth auth/
compiled compiled/
compiled/legacy compiled/legacy/
ep-seguridad ep-seguridad/
illanes00-datos illanes00-datos/
illanes00-datos/archive illanes00-datos/archive/
illanes00-datos/docs illanes00-datos/docs/
illanes00-datos/tasks illanes00-datos/tasks/
illanes00-ep illanes00-ep/
illanes00-ep/dev illanes00-ep/dev/
illanes00-ep/prod illanes00-ep/prod/
illanes00-ep/test illanes00-ep/test/
illanes00-ep/tests illanes00-ep/tests/
illanes00-finance illanes00-finance/
illanes00-kiosk illanes00-kiosk/
illanes00-thesis illanes00-thesis/
pages/clean pages/clean/
pages/imported pages/imported/