Generate homelab Christmas tree ornaments
Homelab Main / validate (push) Waiting to run Details
Homelab Main / running-update (push) Blocked by required conditions Details
Homelab Main / debian-ops (push) Blocked by required conditions Details

This commit is contained in:
juvenal.diaz 2026-11-06 19:43:37 -06:00
parent b91218d20e
commit 32471aff2c
8 changed files with 189 additions and 76 deletions

View File

@ -27,6 +27,7 @@ jobs:
run: |
set -e
python3 scripts/render-website-architecture.py --check
python3 scripts/render-website-tree.py --check
./jeannie validate
running-update:

View File

@ -55,6 +55,23 @@ website` check the generated SVG before deployment. PyYAML is required on
Debian; Ruby's YAML parser is used as a fallback where PyYAML is unavailable.
Graphify remains a code-navigation aid, not an architecture source of truth.
The Christmas tree retains its festive artwork and uses the curated
`architecture/tree-model.json` for its technology ornaments and explanations.
The `Learning` category marks experiments rather than production claims.
Edit the model when technologies or descriptions change, then run:
```sh
python3 scripts/render-website-tree.py
python3 scripts/render-website-tree.py --check
python3 -m unittest discover -s tests/jeannie -p test_website_tree.py
```
Commit `tree-model.json` and the generated `tree-data.json` together. The
generator checks the shared profile model and any explicit inventory
references; technologies without inventory references are editorial and need
manual review. CI and `jeannie apps website` refuse stale generated data.
The tree illustrates configured technologies, not current service health.
Keep `blog.php`, `homelab-tree.php` and `lang/en.php` aligned with
`homelab.yml` and [the code map](../../docs/code-map.md). The blog distinguishes
the three exclusive cluster profiles and the confirmed native-node readiness

View File

@ -0,0 +1,16 @@
{
"ornaments": [
{"name":"Gitea","detail":"source control","description":"The lab keeps its Git service outside the cluster it deploys.","category":"Delivery","color":"blue","inventory":"services.gitea.host","link":"case-platform"},
{"name":"Actions","detail":"CI runner","description":"Automation checks changes before delivery.","category":"Delivery","color":"gold","link":"case-platform"},
{"name":"Gitleaks","detail":"secret checks","description":"Secret scanning is part of the delivery workflow.","category":"Security","color":"red","link":"case-platform"},
{"name":"OpenTofu","detail":"infrastructure","description":"Infrastructure as code keeps cluster setup repeatable.","category":"Platform","color":"purple","link":"case-jeannie"},
{"name":"Trivy","detail":"image checks","description":"Image and configuration checks help surface risks.","category":"Security","color":"teal","link":"case-platform"},
{"name":"Calico","detail":"networking","description":"Cluster networking and policy are part of the lab.","category":"Platform","color":"green","link":"case-platform"},
{"name":"Argo CD","detail":"GitOps","description":"Argo CD reconciles applications from Git.","category":"Delivery","color":"blue","link":"case-platform"},
{"name":"Registry","detail":"images","description":"A local registry stores images for the lab.","category":"Delivery","color":"red","inventory":"services.local_registry.host","link":"case-platform"},
{"name":"Buildx","detail":"multi-arch","description":"Builds target the architectures used in the lab.","category":"Delivery","color":"gold","link":"case-platform"},
{"name":"Grafana","detail":"dashboards","description":"Dashboards make service and host behaviour visible.","category":"Observability","color":"teal","link":"case-platform"},
{"name":"Ollama","detail":"model serving","description":"Local model serving supports hands-on AI experiments.","category":"Learning","color":"purple","inventory":"services.ollama.host","link":"case-jeannie"},
{"name":"Jeannie","detail":"operations","description":"The lab's toolkit connects deployment, diagnostics, and recovery.","category":"Platform","color":"green","link":"case-jeannie"}
]
}

View File

@ -0,0 +1,16 @@
{
"ornaments": [
{"name":"Gitea","detail":"source control","description":"The lab keeps its Git service outside the cluster it deploys.","category":"Delivery","color":"blue","inventory":"services.gitea.host","link":"case-platform"},
{"name":"Actions","detail":"CI runner","description":"Automation checks changes before delivery.","category":"Delivery","color":"gold","link":"case-platform"},
{"name":"Gitleaks","detail":"secret checks","description":"Secret scanning is part of the delivery workflow.","category":"Security","color":"red","link":"case-platform"},
{"name":"OpenTofu","detail":"infrastructure","description":"Infrastructure as code keeps cluster setup repeatable.","category":"Platform","color":"purple","link":"case-jeannie"},
{"name":"Trivy","detail":"image checks","description":"Image and configuration checks help surface risks.","category":"Security","color":"teal","link":"case-platform"},
{"name":"Calico","detail":"networking","description":"Cluster networking and policy are part of the lab.","category":"Platform","color":"green","link":"case-platform"},
{"name":"Argo CD","detail":"GitOps","description":"Argo CD reconciles applications from Git.","category":"Delivery","color":"blue","link":"case-platform"},
{"name":"Registry","detail":"images","description":"A local registry stores images for the lab.","category":"Delivery","color":"red","inventory":"services.local_registry.host","link":"case-platform"},
{"name":"Buildx","detail":"multi-arch","description":"Builds target the architectures used in the lab.","category":"Delivery","color":"gold","link":"case-platform"},
{"name":"Grafana","detail":"dashboards","description":"Dashboards make service and host behaviour visible.","category":"Observability","color":"teal","link":"case-platform"},
{"name":"Ollama","detail":"model serving","description":"Local model serving supports hands-on AI experiments.","category":"Learning","color":"purple","inventory":"services.ollama.host","link":"case-jeannie"},
{"name":"Jeannie","detail":"operations","description":"The lab's toolkit connects deployment, diagnostics, and recovery.","category":"Platform","color":"green","link":"case-jeannie"}
]
}

View File

@ -2,6 +2,13 @@
require_once __DIR__ . '/lang_helper.php';
$blogHref = 'blog.php?lang=' . urlencode($lang);
$treeData = json_decode(file_get_contents(__DIR__ . '/architecture/tree-data.json'), true);
$ornaments = $treeData['ornaments'] ?? [];
$ornamentPositions = [
[430, 266, 38], [592, 276, 38], [346, 392, 40], [520, 398, 44],
[696, 394, 40], [278, 534, 42], [430, 548, 42], [592, 548, 42],
[750, 532, 42], [350, 646, 44], [522, 664, 46], [700, 646, 44],
];
?>
<!DOCTYPE html>
<html lang="<?php echo $lang; ?>">
@ -96,77 +103,18 @@ $blogHref = 'blog.php?lang=' . urlencode($lang);
<polygon class="tree-layer tree-layer-top" points="520,140 314,320 430,320 254,470 396,470 182,650 858,650 644,470 786,470 610,320 726,320"></polygon>
<polygon class="tree-layer tree-layer-shadow" points="520,214 358,346 452,346 306,470 428,470 250,620 792,620 612,470 734,470 588,346 682,346"></polygon>
<g class="tree-ornament ornament-blue" transform="translate(430 266)">
<circle r="38"></circle>
<text y="-7">Gitea</text>
<text class="tree-small" y="14">repo + web UI</text>
</g>
<g class="tree-ornament ornament-gold" transform="translate(592 276)">
<circle r="38"></circle>
<text y="-7">Actions</text>
<text class="tree-small" y="14">runner</text>
</g>
<g class="tree-ornament ornament-red" transform="translate(346 392)">
<circle r="40"></circle>
<text y="-8">Gitleaks</text>
<text class="tree-small" y="14">secrets</text>
</g>
<g class="tree-ornament ornament-purple" transform="translate(520 398)">
<circle r="44"></circle>
<text y="-10">OpenTofu</text>
<text class="tree-small" y="12">jeannie apply</text>
</g>
<g class="tree-ornament ornament-teal" transform="translate(696 394)">
<circle r="40"></circle>
<text y="-8">Trivy</text>
<text class="tree-small" y="14">posture</text>
</g>
<g class="tree-ornament ornament-green" transform="translate(278 534)">
<circle r="42"></circle>
<text y="-8">Calico</text>
<text class="tree-small" y="14">network</text>
</g>
<g class="tree-ornament ornament-blue" transform="translate(430 548)">
<circle r="42"></circle>
<text y="-8">Argo CD</text>
<text class="tree-small" y="14">sync loop</text>
</g>
<g class="tree-ornament ornament-red" transform="translate(592 548)">
<circle r="42"></circle>
<text y="-8">Registry</text>
<text class="tree-small" y="14">:30500</text>
</g>
<g class="tree-ornament ornament-gold" transform="translate(750 532)">
<circle r="42"></circle>
<text y="-8">Buildx</text>
<text class="tree-small" y="14">arm64</text>
</g>
<g class="tree-ornament ornament-teal" transform="translate(350 646)">
<circle r="44"></circle>
<text y="-9">Website</text>
<text class="tree-small" y="13">portfolio pod</text>
</g>
<g class="tree-ornament ornament-purple" transform="translate(522 664)">
<circle r="46"></circle>
<text y="-9">Registry</text>
<text class="tree-small" y="13">image cache</text>
</g>
<g class="tree-ornament ornament-green" transform="translate(700 646)">
<circle r="44"></circle>
<text y="-9">Demos</text>
<text class="tree-small" y="13">static app</text>
</g>
<?php foreach ($ornaments as $index => $ornament): ?>
<?php if (!isset($ornamentPositions[$index])) { continue; } ?>
<?php [$x, $y, $radius] = $ornamentPositions[$index]; ?>
<a href="<?php echo htmlspecialchars($blogHref . '#' . $ornament['link'], ENT_QUOTES, 'UTF-8'); ?>" aria-label="<?php echo htmlspecialchars($ornament['name'] . ': ' . $ornament['description'], ENT_QUOTES, 'UTF-8'); ?>">
<g class="tree-ornament ornament-<?php echo htmlspecialchars($ornament['color'], ENT_QUOTES, 'UTF-8'); ?>" transform="translate(<?php echo $x . ' ' . $y; ?>)">
<title><?php echo htmlspecialchars($ornament['description'], ENT_QUOTES, 'UTF-8'); ?></title>
<circle r="<?php echo $radius; ?>"></circle>
<text y="-8"><?php echo htmlspecialchars($ornament['name'], ENT_QUOTES, 'UTF-8'); ?></text>
<text class="tree-small" y="14"><?php echo htmlspecialchars($ornament['detail'], ENT_QUOTES, 'UTF-8'); ?></text>
</g>
</a>
<?php endforeach; ?>
<g class="tree-bell" transform="translate(226 442)">
<path d="M0,-24 C24,-18 30,12 22,30 L-22,30 C-30,12 -24,-18 0,-24 Z"></path>
@ -181,9 +129,9 @@ $blogHref = 'blog.php?lang=' . urlencode($lang);
</g>
<rect class="tree-trunk" x="468" y="650" width="104" height="142" rx="12"></rect>
<text class="tree-trunk-text" x="520" y="700">opi5plus</text>
<text class="tree-trunk-text tree-small" x="520" y="722">native K3s</text>
<text class="tree-trunk-text tree-small" x="520" y="744">192.168.100.80</text>
<text class="tree-trunk-text" x="520" y="700">Kubernetes</text>
<text class="tree-trunk-text tree-small" x="520" y="722">three profiles</text>
<text class="tree-trunk-text tree-small" x="520" y="744">one at a time</text>
<path class="tree-root" d="M520 790 C456 814 390 822 310 822"></path>
<path class="tree-root" d="M520 790 C584 816 660 824 740 822"></path>
@ -245,12 +193,17 @@ $blogHref = 'blog.php?lang=' . urlencode($lang);
<li><strong>Star:</strong> public DNS, TLS, and the entry point users actually type.</li>
<li><strong>Garlands:</strong> Tailscale routing, NodePorts, and the GitOps sync loop connecting the layers.</li>
<li><strong>Branches:</strong> Kubernetes namespaces and workloads that carry the visible services.</li>
<li><strong>Ornaments:</strong> external Gitea, Actions, Argo CD, Buildx, Trivy, Gitleaks, Calico, registry, website, and demos.</li>
<li><strong>Ornaments:</strong> the technologies below; select one to explore a related case study.</li>
<li><strong>Bells:</strong> probes and health checks that make noise before users do.</li>
<li><strong>Trunk:</strong> native K3s on the Orange Pi. The Debian and Pimox kubeadm layouts remain alternative profiles; only one runs at a time.</li>
<li><strong>Trunk:</strong> hybrid kubeadm, Pimox kubeadm, and native K3s are alternative profiles; only one runs at a time.</li>
<li><strong>Roots:</strong> OpenEBS retained volumes, external SSD storage, Gitea dumps, and restore discipline.</li>
<li><strong>Gifts:</strong> the OCI edge host, Raspberry Pi support services, monitoring, and the improvement backlog.</li>
</ul>
<ul class="tree-key-list" aria-label="Technology ornaments">
<?php foreach ($ornaments as $ornament): ?>
<li><strong><?php echo htmlspecialchars($ornament['name'], ENT_QUOTES, 'UTF-8'); ?></strong> (<?php echo htmlspecialchars($ornament['category'], ENT_QUOTES, 'UTF-8'); ?>): <?php echo htmlspecialchars($ornament['description'], ENT_QUOTES, 'UTF-8'); ?> <a href="<?php echo htmlspecialchars($blogHref . '#' . $ornament['link'], ENT_QUOTES, 'UTF-8'); ?>">Explore</a></li>
<?php endforeach; ?>
</ul>
</section>
</main>

View File

@ -7967,6 +7967,7 @@ apps() {
if [[ "${deploy_website}" == "true" ]]; then
python3 "${REPO_ROOT}/scripts/render-website-architecture.py" --check || return 1
python3 "${REPO_ROOT}/scripts/render-website-tree.py" --check || return 1
fi
registry_endpoint="$(apps_registry_endpoint)"

View File

@ -0,0 +1,62 @@
#!/usr/bin/env python3
"""Validate and generate the public Christmas tree ornament data."""
import argparse
import importlib.util
import json
import re
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
TREE_MODEL = ROOT / 'apps/website/architecture/tree-model.json'
TREE_DATA = ROOT / 'apps/website/architecture/tree-data.json'
ARCH_MODEL = ROOT / 'apps/website/architecture/model.json'
ARCH_SCRIPT = ROOT / 'scripts/render-website-architecture.py'
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--check', action='store_true', help='check the generated data without writing')
args = parser.parse_args()
try:
spec = importlib.util.spec_from_file_location('architecture_renderer', ARCH_SCRIPT)
architecture = importlib.util.module_from_spec(spec)
spec.loader.exec_module(architecture)
data = architecture.inventory()
architecture.render(json.loads(ARCH_MODEL.read_text(encoding='utf-8')), data)
source = TREE_MODEL.read_text(encoding='utf-8')
ornaments = json.loads(source)['ornaments']
if not isinstance(ornaments, list) or len(ornaments) != 12:
raise ValueError('The tree has twelve positions; provide exactly twelve ornaments')
names = set()
for ornament in ornaments:
if not isinstance(ornament, dict):
raise ValueError('Every ornament must be an object')
for key, limit in [('name', 12), ('detail', 18), ('category', 20), ('description', 180)]:
value = ornament.get(key)
if not isinstance(value, str) or not value.strip() or len(value) > limit:
raise ValueError(f'Invalid {key} for ornament {ornament.get("name", "?")}')
if ornament['name'] in names:
raise ValueError(f'Duplicate ornament: {ornament["name"]}')
names.add(ornament['name'])
if ornament.get('color') not in {'blue', 'gold', 'red', 'purple', 'teal', 'green'}:
raise ValueError(f'Invalid color for {ornament["name"]}')
if not re.fullmatch(r'case-[a-z0-9-]+', ornament.get('link', '')):
raise ValueError(f'Invalid local case-study link for {ornament["name"]}')
if ornament.get('inventory'):
architecture.lookup(data, ornament['inventory'])
if args.check:
if not TREE_DATA.exists() or TREE_DATA.read_text(encoding='utf-8') != source:
raise ValueError('Tree data is stale; run python3 scripts/render-website-tree.py')
print('Website Christmas tree is current.')
else:
TREE_DATA.write_text(source, encoding='utf-8')
print(f'Wrote {TREE_DATA.relative_to(ROOT)}')
except (OSError, ValueError, KeyError, TypeError, AttributeError, json.JSONDecodeError) as exc:
print(f'Website Christmas tree: {exc}', file=sys.stderr)
return 1
return 0
if __name__ == '__main__':
sys.exit(main())

View File

@ -0,0 +1,47 @@
"""Checks for the curated, generated Christmas tree data."""
import contextlib
import importlib.util
import io
import json
import sys
import tempfile
import unittest
from pathlib import Path
from unittest.mock import patch
ROOT = Path(__file__).resolve().parents[2]
SPEC = importlib.util.spec_from_file_location('website_tree', ROOT / 'scripts/render-website-tree.py')
tree = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(tree)
class WebsiteTreeTests(unittest.TestCase):
def setUp(self):
self.temp = tempfile.TemporaryDirectory()
self.addCleanup(self.temp.cleanup)
self.model = Path(self.temp.name) / 'model.json'
self.output = Path(self.temp.name) / 'data.json'
self.model.write_text(tree.TREE_MODEL.read_text(encoding='utf-8'), encoding='utf-8')
def run_tree(self, *args):
with patch.object(tree, 'TREE_MODEL', self.model), patch.object(tree, 'TREE_DATA', self.output), \
patch.object(sys, 'argv', ['render-website-tree.py', *args]), \
contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(io.StringIO()):
return tree.main()
def test_generate_and_detect_stale_data(self):
self.assertEqual(self.run_tree(), 0)
self.assertEqual(self.run_tree('--check'), 0)
self.output.write_text('{}\n', encoding='utf-8')
self.assertEqual(self.run_tree('--check'), 1)
def test_rejects_invalid_ornament(self):
model = json.loads(self.model.read_text(encoding='utf-8'))
model['ornaments'][0]['link'] = 'https://example.invalid/'
self.model.write_text(json.dumps(model), encoding='utf-8')
self.assertEqual(self.run_tree(), 1)
self.assertFalse(self.output.exists())
if __name__ == '__main__':
unittest.main()