Skip to main content

Documentation Guide

This guide explains how documentation works in Urbalurba Infrastructure and how to contribute to it.

Documentation Architecture​

Documentation is built with Docusaurus and deployed to GitHub Pages:

EnvironmentURLUse Case
Local Developmenthttp://localhost:3000Live editing with hot reload
Productionhttps://uis.sovereignsky.noPublic documentation

How It Works​

┌─────────────────────────────────────────────────────────────────────┐
│ website/docs/ folder │
│ (Markdown source files) │
└─────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ docusaurus.config.ts │
│ (Site configuration) │
└─────────────────────────────────────────────────────────────────────┘
│
┌───────────────────────┴───────────────────────┐
▼ ▼
┌───────────────┐ ┌───────────────┐
│ npm start │ │ GitHub Action │
│ (local dev) │ │ (on push) │
└───────────────┘ └───────────────┘
│ │
▼ ▼
┌───────────────┐ ┌───────────────┐
│ localhost:3000│ │ GitHub Pages │
└───────────────┘ └───────────────┘

Writing Documentation​

Local Development Workflow​

  1. Install dependencies:

    cd website
    npm install
  2. Start the local server:

    npm start
  3. Open browser at http://localhost:3000

  4. Edit markdown files in website/docs/ - changes appear instantly with hot reload

  5. Run the build before you push — this is a required pre-flight, not a habit:

    cd website
    npm run build

    The build must exit 0. It is the same build GitHub Actions runs (.github/workflows/docs.yml) — that workflow and this pre-flight both read the node version from website/.nvmrc, so nvm use before building if you manage node versions.

    Expect 2–4 minutes cold and under a minute on a rebuild, plus ~40 s for npm ci the first time. (Measured on two machines: 31 s cold on a 2-core x86 LXC with a warm npm cache, 3m49s cold on a 4-core Sandy Bridge.) A slow first build is normal — it has not hung.

    Needs more than 2 GB of RAM

    On a machine or container limited to 2 GB, npm run build dies with:

    FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
    Aborted (core dumped) # exit 134

    That is RAM, not a broken page. If you see exit 134 or JavaScript heap out of memory, stop looking for a bad link and check how much memory the machine actually has.

    Measured on two machines: 2 GB fails, 3 GB and 4 GB pass. ⚠️ The 2 GB failure needs a cold cache — with .docusaurus and the webpack cache warm, a 2 GB cap can pass, so a build that worked yesterday can fail after a git clean.

  6. Commit and push when ready - GitHub Pages updates automatically

Directory Structure​

Documentation is organized into logical sections:

website/docs/
├── index.md # Homepage
├── getting-started/ # Quick start guides
├── platforms/ # Platform documentation
│ └── cloud-init/ # Cloud-init subsection
├── services/ # Service documentation
│ ├── ai/ # AI & ML services
│ ├── identity/ # Authentik
│ ├── databases/ # PostgreSQL, MySQL, etc.
│ └── ... # Other categories
├── networking/ # Network configuration
├── provision-host/ # Provision host docs
├── rules/ # Standards and conventions
└── reference/ # Reference materials

Adding a New Document​

  1. Create the markdown file in the appropriate directory:

    touch website/docs/services/databases/newdb.md
  2. Add frontmatter (optional but recommended):

    ---
    sidebar_position: 5
    title: NewDB Setup
    ---
  3. Write content using the template below

  4. Preview locally with npm start

  5. Commit and push to deploy

Document Template​

---
sidebar_position: 1
---

# Service Name

Brief description of what this service does and why it's included.

## Overview

- **Purpose**: What problem does it solve?
- **Port**: Internal port number
- **Namespace**: Kubernetes namespace (usually `default`)

## Quick Start

```bash
# How to access or test the service
kubectl port-forward svc/service-name 8080:80

Configuration​

Explain key configuration options.

Troubleshooting​

Common issues and solutions.


## Markdown Features

Docusaurus supports rich formatting with MDX:

### Admonitions (Callout Boxes)

```markdown
:::note[Optional Title]
This is a note callout.
:::

:::warning
This is a warning without a custom title.
:::

:::tip[Pro Tip]
Helpful tips go here.
:::

:::danger[Critical]
Important warnings about destructive operations.
:::

:::info
Informational callout.
:::

Code Blocks with Syntax Highlighting​

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: example
```

```bash
kubectl apply -f manifest.yaml
```

```python
def hello():
print("Hello, World!")
```

Tabs​

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="rancher" label="Rancher Desktop" default>
Instructions for Rancher Desktop users.
</TabItem>
<TabItem value="aks" label="Azure AKS">
Instructions for Azure AKS users.
</TabItem>
<TabItem value="microk8s" label="MicroK8s">
Instructions for MicroK8s users.
</TabItem>
</Tabs>

Tables​

| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Value 1 | Value 2 | Value 3 |
[Link to another doc](../../services/ai/litellm)
[External link](https://example.com)

Mermaid Diagrams​

```mermaid
graph TD
A[User] --> B[Ingress]
B --> C[Service]
C --> D[Pod]
```

Technical Details​

GitHub Pages Deployment​

The .github/workflows/docs.yml workflow:

  • Triggers on push to main when website/ changes
  • Installs Node.js and npm dependencies
  • Runs npm run build
  • Deploys to GitHub Pages

Configuration Files​

FilePurpose
website/docusaurus.config.tsSite configuration, theme, plugins
website/sidebars.tsSidebar navigation structure
website/package.jsonDependencies and scripts
website/docs/**/_category_.jsonSection labels and ordering
.github/workflows/docs.ymlGitHub Pages deployment

Best Practices​

Content Guidelines​

  1. Be concise - Get to the point quickly
  2. Use examples - Show, don't just tell
  3. Include troubleshooting - Anticipate common problems
  4. Link related docs - Help users navigate
  5. Keep current - Update when code changes

Structure Guidelines​

  1. Start with overview - What is this? Why use it?
  2. Quick start first - Let users try it immediately
  3. Details after - Deep dive for those who need it
  4. Troubleshooting last - Problem solving at the end

Technical Writing Tips​

  • Use active voice: "Run the command" not "The command should be run"
  • Use present tense: "This creates" not "This will create"
  • Be specific: "Port 5432" not "the default port"
  • Use consistent terminology throughout

Troubleshooting​

Local Preview Not Working​

# Check if dependencies are installed
cd website
npm install

# Clear cache and restart
npm run clear
npm start

Build Errors​

# Run build to see detailed errors
npm run build

# Common fixes:
# - Check for broken internal links
# - Verify frontmatter syntax
# - Check for unclosed code blocks

A broken internal link, a broken anchor or a broken markdown link fails the build (onBrokenLinks, onBrokenAnchors, onBrokenMarkdownLinks are all throw in docusaurus.config.ts). They were warnings until 2026-08-27, which meant neither the local build nor Actions caught them and they accumulated silently. If you need to land a link a checker cannot follow, fix the link rather than lowering the setting.

GitHub Pages Not Updating​

  1. Check GitHub Actions tab for failed workflows
  2. Verify changes are in website/ directory
  3. Ensure push is to main branch
  4. Check the workflow file for correct paths
  1. Check _category_.json in the directory
  2. Verify sidebars.ts includes the new section
  3. Ensure file has valid frontmatter