5.0 KiB
name, description
| name | description |
|---|---|
| docs_architecture | Exact technical architecture, routing, and deployment workflow for WompMacho's decoupled Hugo/Gitea/Nginx Wiki infrastructure. |
Docs Architecture Skill
This skill documents the exact technical architecture, routing, and deployment workflow for WompMacho's decoupled Hugo/Gitea/Nginx Wiki infrastructure.
🏗️ 1. Core Architecture (Decoupled Repositories)
The system is split into three independent Git repositories hosted on git.wompmacho.com:
-
Framework (
/srv/dev/hugo/wiki): Repositoryhugo-framework- Purpose: The central Hugo engine. The Blowfish theme is fully decoupled/vendored directly into the project's root folders (
layouts/,assets/,static/,data/,i18n/,archetypes/). No theme submodules are used, protecting the site from upstream updates breaking the build. - Rule: NEVER place content (
.mdfiles) here. NEVER place environment-specific overrides (like hardcodededitURLsor top-level menus) in the global config.
- Purpose: The central Hugo engine. The Blowfish theme is fully decoupled/vendored directly into the project's root folders (
-
Public Wiki (
/srv/docs/public): Repositorydocs-public- Purpose: Public-facing markdown notes, assets (
/static), and its own top-bar menu configuration (config/_default/menus.en.toml). - Deployment Target:
/srv/www/docs-public - Live URL:
https://wiki.wompmacho.com(proxied by NPM).
- Purpose: Public-facing markdown notes, assets (
-
Private Wiki (
/srv/docs/private): Repositorydocs-private- Purpose: Personal, private markdown notes, assets (
/static), and its own top-bar menu configuration (config/_default/menus.en.toml). - Deployment Target:
/srv/www/docs-private - Live URL:
http://10.0.0.190:9897(orhttp://privatevia NPM).
- Purpose: Personal, private markdown notes, assets (
💻 2. Local Development ("Live Link" Automation)
When working on content, the user uses Code-Server. To see real-time updates without deploying, the framework repository uses automated symlinking and preview scripts.
preview.sh [public|private]:- Creates symlinks:
content -> /srv/docs/[public|private]andstatic -> /srv/docs/[public|private]/static. - Overwrites or symlinks specific config overrides (like
menus.en.toml). - Executes
run-dev.shto start the local preview server. - Traps exits (Ctrl+C, normal exit) to cleanly restore standard framework defaults and remove preview symlinks automatically.
- Creates symlinks:
run-dev.sh:- Launches the server bound to
0.0.0.0:1313with code-server proxy parameters. - Passes
--renderToMemoryto prevent local watch loops and file write latency.
- Launches the server bound to
🚀 3. CI/CD Pipeline (Gitea Actions)
Both docs-public and docs-private have a .gitea/workflows/deploy.yaml action.
The Build Process
- Checkout Content: The runner checks out the markdown content.
- Clone Framework: The runner clones the central
hugo-frameworkrepository directly. Because the Blowfish theme is fully decoupled, there is no need for submodule initialization. - Inject Content: Markdown and static files are copied into the framework's workspace.
- Inject Dynamic Menus: The
config/_default/menus.en.tomlis injected, automatically overriding the framework's top navigation bar for that specific site. - Inject Edit Links (CRITICAL RULE): The "Edit this page" link on the bottom of posts MUST NOT be configured via a
params.tomloverride, as Hugo replaces the entire file instead of merging it, destroying the Blowfish styling.- Fix: It is injected dynamically via an Environment Variable right before the build command:
HUGO_PARAMS_ARTICLE_EDITURL="https://git.../src/branch/main" hugo --minify ...
- Deploy: The output
/publicfolder is copied directly to the mounted/deployvolume.
🌐 4. Web Server Routing (Nginx)
The system relies on two extremely lightweight nginx:alpine containers defined in gitea/docker-compose.yaml to serve static files. They act as file servers behind Nginx Proxy Manager (NPM).
- Public (
public_wiki- Port 9896):- Mounts
/srv/www/docs-publicas read-only. - NPM routes
wiki.wompmacho.comto Docker Host IP on port9896.
- Mounts
- Private (
private_wiki- Port 9897):- Mounts
/srv/www/docs-privateas read-only. - NPM routes
http://privateto Docker Host IP on port9897.
- Mounts
🛠️ 5. Known Quirks and Formatting Rules
- Decoupled Theme: The Blowfish theme is committed directly in the main codebase. Do not use Git submodules to track the theme.
- Blowfish Homepage: If the homepage is blank, it means there are no recent posts. By default, Blowfish's
homelayout only lists files withtype: "article"ortype: "posts". For generic folders, settype: "page"andlayout: "list"in_index.md. - Frontmatter: Blowfish expects standard Hugo frontmatter (
date:as a string,authors: ["Name"]as an array). MkDocs-style nested YAML is incompatible and will crash the build. - Troubleshooting: See
references/troubleshooting.mdfor handling theme updates, build loops, and TOC configuration.