π Edge Gateway
-Traefik v3: Reverse Proxy & SSL (DNS-01 Challenges). Routes subdomains for all core and user-deployed services.
-diff --git a/AGENTS.md b/AGENTS.md index e3d6e66..ac448c8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -136,9 +136,6 @@ unless the architecture itself has intentionally changed. Use the repository's current architecture and operational documentation as the source of truth for ownership, protocols, and system behavior. -Historical material under `docs/legacy/` is archival and must not be treated as -current system behavior. - Record significant architectural decisions in the appropriate ADR or Brain documentation rather than expanding this file into an architecture manual. diff --git a/docs/legacy/adr-001-remove-localhost-routers.md b/docs/legacy/adr-001-remove-localhost-routers.md deleted file mode 100644 index d87731d..0000000 --- a/docs/legacy/adr-001-remove-localhost-routers.md +++ /dev/null @@ -1,36 +0,0 @@ -# ADR 001: Removal of Localhost Routers for Development Freedom - -* **Status**: Accepted & Implemented -* **Date**: 2026-05-17 -* **Decider**: User & Gemini CLI - -## Context -Initially, we implemented `*.localhost` routers in Traefik to allow local access to services (e.g., `jellyfin.localhost`) without traversing the public internet. The goal was to provide a "fast lane" for local management. - -However, two major technical hurdles were encountered: -1. **SSL/TLS Restrictions**: Public Certificate Authorities (like Let's Encrypt) cannot issue certificates for the `.localhost` TLD. This resulted in "Insecure" warnings in browsers and the need to manage a local CA (like `mkcert`) or accept self-signed certificates. -2. **SSO (Cookie) Limitations**: Browsers enforce strict domain matching for cookies. Our Authelia instance is configured for `arch-services.mywire.org`. Browsers refuse to send these session cookies to `*.localhost` domains. This caused an infinite redirect loop or authentication errors when accessing services locally. -3. **Namespace Pollution**: Using `*.localhost` in Traefik intercepts traffic that might be needed for other developer workflows (e.g., running undeployed apps, Vite dev servers, or testing environments that default to `localhost`). - -## Decision -We decided to **deprecate and remove all `*.localhost` routers** from the Traefik configuration across all services. - -Instead of dedicated local hostnames, we will use the **Public Domain + Local IP** strategy for local access. - -## Consequences - -### Positive -* **Seamless SSO**: Authelia SSO works perfectly because the browser sees the public domain (`*.arch-services.mywire.org`) and sends the correct cookies. -* **Valid SSL**: Traefik serves the real Let's Encrypt wildcard certificate, providing "Green Lock" security in browsers without manual certificate management. -* **Clean Namespace**: The `.localhost` TLD is now entirely free for other developer-specific tools and testing. -* **Local Speed**: When configured correctly via `/etc/hosts`, traffic never leaves the local machine, maintaining the speed benefits of the previous implementation. - -### Negative / Required Actions -* **Manual Configuration**: Users must manually update their machine's `/etc/hosts` file to point the public subdomains to `127.0.0.1`. -* **SSO Requirement**: Local access now requires the same Authelia authentication as public access (unless explicitly bypassed in the public router, which is not recommended for security). - -## Implementation Detail -To access services locally with this architecture, add the following to your `/etc/hosts`: -```text -127.0.0.1 traefik.arch-services.mywire.org auth.arch-services.mywire.org jellyfin.arch-services.mywire.org gitea.arch-services.mywire.org excalidraw.arch-services.mywire.org homepage.arch-services.mywire.org mermaid.arch-services.mywire.org ollama.arch-services.mywire.org learning.arch-services.mywire.org logs.arch-services.mywire.org portainer.arch-services.mywire.org -``` diff --git a/docs/legacy/adr-002-migrate-dynu-discovery-to-nixos.md b/docs/legacy/adr-002-migrate-dynu-discovery-to-nixos.md deleted file mode 100644 index 0853351..0000000 --- a/docs/legacy/adr-002-migrate-dynu-discovery-to-nixos.md +++ /dev/null @@ -1,32 +0,0 @@ -# ADR 002: Migrate Dynu DDNS IP Discovery to Host NixOS Configuration - -* **Status**: Accepted & Implemented -* **Date**: 2026-06-24 -* **Decider**: User & Antigravity - -## Context -Previously, we managed dynamic DNS IP synchronization using custom bash scripts (`ip-monitor.sh`) and systemd unit configurations in the `homeserver` scripts directory. The service checked the WAN IP and pushed updates to Dynu every 5 minutes. - -However, this design introduced several structural problems: -1. **Imperative Secrets Leakage**: Credentials were stored in a cleartext out-of-band environment file (`/etc/conf.d/dynu-environment`). This required manual setup on target hosts and broke the declarative reproducibility goal. -2. **Redundant Logic**: The desktop machine (`desktop`) and server machine shared the same router (external public IP), but operated separate, duplicated cron/timer implementations. -3. **Inefficient Polling**: Checking the external IP and calling the Dynu APIs every 5 minutes from multiple endpoints generated unnecessary network traffic and risked API bans. - -## Decision -We decided to **deprecate and remove all native Dynu IP updater scripts and systemd definitions** from the `homeserver` codebase. - -Instead, the Dynu IP monitoring and DDNS update lifecycle is now managed directly by the host operating system's configuration repository ([nixos-config](https://github.com/kiskaadee/nixos-config)). - -## Consequences - -### Positive -* **Single Source of Truth**: All WAN IP discovery, validation, and update logic is handled declaratively in the [nixos-config](https://github.com/kiskaadee/nixos-config) repository. -* **Cryptographic Secrets**: Credentials are encrypted inside Git using `sops-nix` and `age`, allowing safe storage in public dotfiles repositories. -* **Smart Change Detection**: A lightweight background Python script (`monitor.py`) checks the public IP every 30 minutes, keeping a local historical log (`ip_history.jsonl`) and triggering updates via `ddclient` *only* when a WAN IP rotation actually occurs. -* **Clean Repository**: Removed bloat and deprecated files from this service-level repo. - -### Negative / Required Actions -* None. The deployment process is simplified as secrets and services are now handled automatically during the system-wide NixOS activation phase. - -## References -* This decision was implemented in the [nixos-config commits](https://github.com/kiskaadee/nixos-config/commits/main/) under hash `c7acc2b0a3bb262dfd5577989d8d7f0218f2721e` (and subsequent hardening adjustments). diff --git a/docs/legacy/architecture.html b/docs/legacy/architecture.html deleted file mode 100644 index 0498b32..0000000 --- a/docs/legacy/architecture.html +++ /dev/null @@ -1,106 +0,0 @@ - - -
- - -Model: Hardened Hub v2.0
-The homeserver follows a Layered Architecture designed for security, observability, and modularity. It is split into two logical tiers: the Control Plane (Infrastructure) and the Data Plane (Applications).
- -The foundation of the system running directly on the host hardware or virtualized OS.
-The management tier that handles routing, identity, and system maintenance.
- -Traefik v3: Reverse Proxy & SSL (DNS-01 Challenges). Routes subdomains for all core and user-deployed services.
-Authelia: SSO & 2FA provider. Forward Auth integration with Traefik.
-Protects the Docker socket from container-escape vulnerabilities.
-Portainer (Management), Watchtower (Updates), and Diun (Notifications).
-Consumer-facing services isolated from the core infrastructure.
-Traffic flow is segmented to minimize the blast radius of a potential breach.
-proxy-net: Shared internal network for Traefik and all exposed applications.socket-net: Isolated network for Docker management tools.Current hardening measures enforced across the Hub:
-This script-based DDNS implementation has been deprecated and removed from the homeserver repository. The Dynamic DNS update service and IP monitor are now handled declaratively by the host's NixOS configuration repository. See the nixos-config repository commit c7acc2b0a3b for implementation details.
-Design and architecture of the DDNS synchronization mechanism.
-Maintain accurate DNS A records despite dynamic public IPs and unreliable providers.
-Runs periodically via systemd instead of a long-lived daemon.
-Uses DNS (primary) and HTTP (fallback) for IP discovery.
-Strict pipeline ensures no RFC1918 or private IPs are ever synced.
-State updates use atomic file moves to prevent corruption.
-Hardened Private Cloud Architecture & Operations
-Deep dive into the layered model, networking, and security posture.
-How to use the hub, add new apps, and manage updates.
-Solutions for common connectivity, SSL, and authentication issues.
-Current status and future planned features.
-Technical details on the DDNS synchronization mechanism.
-Current system maturity and future priorities for the core infrastructure.
-COMPLETE Stable external access, identity management, and core security.
-IN PROGRESS Expand utility and improve system monitoring.
-Common issues and resolutions for the Hardened Hub.
-docker compose -f infra/core/docker-compose.yml psThe application is down or not on proxy-net.
If you see "Connection not private", Traefik may be failing the ACME challenge.
- -On the Dynu free tier (4-record limit), failed challenges can leave stale TXT records that block new attempts with a 503: Quota Exception.
Fix: Run the automated purge script to clear stale records and restart the challenge:
-./scripts/purge-dynu.sh
- # Check Traefik ACME logs
-docker compose -f infra/core/docker-compose.yml logs -f traefik
-
-# Run automated SSL diagnostic
-./scripts/check-ssl.sh
- Sync server time: sudo ntpdate pool.ntp.org and clear cookies.
If disk is full, run cleanup:
-docker system prune -a --volumes
- A guide for interacting with the Hardened Hub and exposing external services.
-Critical core services and protected user applications are shielded by Authelia.
-https://portainer.arch-services.mywire.org).https://auth.arch-services.mywire.org).Deploy the control plane stacks and homepage directly using the host scripts:
-# Start the Control Plane + Homepage Portal
-./up.sh
-
-# Stop all Core services
-./down.sh
- User applications are fully decoupled from the core repository and managed in their own directories (e.g., /home/kiskaadee/deployments/my-app). We use Traefik labels to expose them under the *.arch-services.mywire.org wildcard domain.
Depending on your security and access needs, you can configure your stack for one of two scenarios:
- -Use this for applications that have their own built-in authentication (e.g., Jellyfin, Gitea) or public-facing projects (e.g., public web demos, portfolios).
-Use this for administrative tools, private databases, or custom internal apps that do not have native authentication and need to be secured behind Authelia.
-This configuration exposes your service directly to the internet. Authelia is bypassed, allowing anyone (or the app's own login manager) to handle access.
- -services:
- my-public-app:
- image: my-app-image:latest
- container_name: my-public-app
- networks:
- - proxy-net
- labels:
- - "traefik.enable=true"
-
- # 1. Main HTTPS Route Rule
- - "traefik.http.routers.public-app.rule=Host(`demo.arch-services.mywire.org`)"
- - "traefik.http.routers.public-app.entrypoints=websecure"
- - "traefik.http.routers.public-app.tls=true"
- - "traefik.http.routers.public-app.service=public-app-svc"
-
- # 2. HTTP to HTTPS Redirection Route
- - "traefik.http.routers.public-app-red.rule=Host(`demo.arch-services.mywire.org`)"
- - "traefik.http.routers.public-app-red.entrypoints=web"
- - "traefik.http.routers.public-app-red.middlewares=https-redirect@docker"
-
- # 3. Port Mapping (Target port inside the container)
- - "traefik.http.services.public-app-svc.loadbalancer.server.port=8080"
-
-networks:
- proxy-net:
- external: true
-
- This configuration intercepts all incoming requests and redirects unauthenticated users to the Authelia portal first. Once logged in, users are returned to the service.
- -services:
- my-secure-app:
- image: my-app-image:latest
- container_name: my-secure-app
- networks:
- - proxy-net
- labels:
- - "traefik.enable=true"
-
- # 1. Main HTTPS Route Rule
- - "traefik.http.routers.secure-app.rule=Host(`admin.arch-services.mywire.org`)"
- - "traefik.http.routers.secure-app.entrypoints=websecure"
- - "traefik.http.routers.secure-app.tls=true"
- - "traefik.http.routers.secure-app.service=secure-app-svc"
-
- # 2. SSO Authentication Middleware (Crucial Line)
- - "traefik.http.routers.secure-app.middlewares=authelia-auth@docker"
-
- # 3. HTTP to HTTPS Redirection Route
- - "traefik.http.routers.secure-app-red.rule=Host(`admin.arch-services.mywire.org`)"
- - "traefik.http.routers.secure-app-red.entrypoints=web"
- - "traefik.http.routers.secure-app-red.middlewares=https-redirect@docker"
-
- # 4. Port Mapping (Target port inside the container)
- - "traefik.http.services.secure-app-svc.loadbalancer.server.port=3000"
-
-networks:
- proxy-net:
- external: true
-
- To list your new service on the central dashboard, update homepage/config/services.yaml inside the core repository:
- User Applications:
- - My Application:
- icon: custom-app-icon
- href: https://my-app.arch-services.mywire.org
- description: Custom exposed app description
- server: my-docker
- container: my-app # Must match container_name exactly
-