fix(workloads): address code-review rework items across keepers and docs
- Fail fast in armonia/Dockerfile.dashboard when DASHBOARD_REPO_URL is empty - Add armonia/.env-example documenting required build, image, and runtime env vars - Standardize restart: unless-stopped in gitea and snappymail compose files - Align jellyfin/docker-compose.yml with proxy-net, myresolver, SERVICE_NAME, and HTTPS_REDIRECT_MIDDLEWARE defaults - Update root README.md to reflect deployments.yaml and the 5 keeper workloads
This commit is contained in:
1 parent
ede7ebdb28
commit
d7832a3bc0
6 files changed
+66
-55
No files matched your search
@@ -1,58 +1,32 @@
|
||||
# 🌐 Unified Traefik Deployments
|
||||
# 🌐 Canopy Workloads
|
||||
|
||||
This repository contains a unified, decoupled, and portable suite of self-hosted application stacks designed to run behind a **Traefik Reverse Proxy** in a containerized homelab environment.
|
||||
This repository contains the decoupled, portable application stacks managed by the Canopy homelab platform behind a **Traefik Reverse Proxy** and the `nixos-core` `appctl` / `gitops_dispatcher` control plane.
|
||||
|
||||
---
|
||||
|
||||
## 🏗️ Architectural Concept
|
||||
|
||||
Unlike core infrastructure systems, these applications run independently in their own directories. They integrate with the host's edge router dynamically via a shared external Docker network (`proxy-net`) and Traefik routing labels.
|
||||
Each workload lives in its own top-level directory with a declarative `app.yaml` manifest (`schemaVersion: "1.0"`) and a `docker-compose.yml` baseline. Workloads attach to the shared external Docker network (`proxy-net`) and expose Traefik routing labels parameterized via runtime environment variables.
|
||||
|
||||
### 🌟 Host-Agnostic & Portable Design
|
||||
All service definitions inside this repository are **standard, vanilla Docker Compose configurations**. While configured to read credentials from the environment, they can be deployed on **any Linux distribution** running Docker.
|
||||
The root [`deployments.yaml`](deployments.yaml) serves as the authoritative workload admission registry, mapping each workload identity and its legacy webhook aliases to `~/Workloads/<app>`.
|
||||
|
||||
---
|
||||
|
||||
## 🔑 Environment Variable Injection
|
||||
|
||||
To prevent secret leakage and configuration duplication, services do not hardcode environment variables or depend on static, plaintext `.env` files in git. Instead, they expect configuration keys (e.g., `PROXY_NETWORK`, `MONGO_ROOT_PASSWORD`, `JELLYFIN_DOMAIN`) to be injected into the shell environment at runtime.
|
||||
To prevent secret leakage and hardcoded host configuration, compose baselines do not embed personal domains, UIDs, or host-specific paths. Runtime values (`SERVICE_DOMAIN`, `PROXY_NETWORK`, `CERT_RESOLVER`, secrets, and app-specific overrides) are injected at execution time by the host control plane (`sops-nix` rendered environment + `appctl`) or a local `.env` file for standalone portability:
|
||||
|
||||
You can manage and inject these variables using several strategies depending on your host OS:
|
||||
|
||||
### 1. Environment Managers (e.g., Mozilla SOPS / sops-nix)
|
||||
* **Our Native Setup**: On NixOS, secrets are securely managed using `sops-nix`. At boot, SOPS decrypts the keys and renders a complete `.env` template to a secure RAM-backed filesystem (`/run/secrets/rendered/traefik-deployments.env`).
|
||||
* **The CLI Wrapper**: We use the local `appctl` CLI tool to automatically source this decrypted file and export its values before running the docker compose commands.
|
||||
|
||||
### 2. Standard Plaintext `.env` Files (Portable Fallback)
|
||||
For standard Linux environments (Ubuntu, Debian, Arch, etc.), you can create a single unified `.env` file at the root of this repository and pass it during launch:
|
||||
```bash
|
||||
docker compose --env-file ../.env up -d
|
||||
docker compose --env-file .env up -d
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ CLI Wrapper (`appctl`)
|
||||
|
||||
To simplify service management across the homelab, a lightweight Bash utility named `appctl` is located at the root of this repository.
|
||||
|
||||
### Commands
|
||||
* **`appctl list` / `status`**: Lists all unified services and their active runtime states.
|
||||
* **`appctl up <service>`**: Sources secrets, injects configurations, and spins up the container stack.
|
||||
* **`appctl down <service>`**: Stops and cleans up the container resources.
|
||||
* **`appctl restart <service>`**: Restarts the selected service.
|
||||
* **`appctl logs <service>`**: Streams real-time logs from the selected service.
|
||||
* **`appctl config <service>`**: Prints the active environment variables injected for a service.
|
||||
|
||||
---
|
||||
|
||||
## 📁 Repository Structure
|
||||
|
||||
* **`excalidraw/`**: Collaborative whiteboarding tool.
|
||||
* **`jellyfin/`**: Media server for movies, shows, and music.
|
||||
* **`learning/`**: Local learning hub dashboard connected to a Turso/SQLite database and docker socket proxy.
|
||||
* **`mermaid/`**: Live diagramming editor.
|
||||
* **`minecraft/`**: Minecraft Java Edition server.
|
||||
* **`mongo-docker/`**: MongoDB instance with replica sets initialized.
|
||||
* **`pgsql/`**: PostgreSQL database container.
|
||||
* **`ollama/`**: Local Large Language Model API server.
|
||||
* **`appctl`**: Custom Bash management CLI.
|
||||
* **`deployments.yaml`**: Authoritative workload admission registry (`schemaVersion: "1.0"`).
|
||||
* **`gitea/`**: Self-hosted Git service and code repository.
|
||||
* **`gitea_runner/`**: Standalone Gitea Actions CI/CD runner (`act_runner`).
|
||||
* **`snappymail/`**: Lightweight webmail client.
|
||||
* **`jellyfin/`**: Media server and streaming hub.
|
||||
* **`armonia/`**: Armonía del Ser API and operator dashboard.
|
||||
@@ -0,0 +1,36 @@
|
||||
# --- Required Build & Image Resolution ---
|
||||
# Upstream Git repository URL for building armonia-dashboard (required for compose_build)
|
||||
DASHBOARD_REPO_URL=https://git.example.com/org/armonia-dashboard.git
|
||||
DASHBOARD_REF=main
|
||||
# Pre-built container image reference for armonia-api
|
||||
ARMONIA_API_IMAGE=armonia-api:latest
|
||||
|
||||
# --- Runtime & Database ---
|
||||
ENVIRONMENT=production
|
||||
APP_ENV=production
|
||||
AUTH_PROVIDER=proxy_headers
|
||||
DATABASE_URL=file:/data/armonia.db
|
||||
DATABASE_AUTH_TOKEN=
|
||||
|
||||
# --- Domain & Proxy Configuration (injected by host runtime / appctl) ---
|
||||
SERVICE_DOMAIN=armonia.example.com
|
||||
PROXY_NETWORK=proxy-net
|
||||
HTTP_ENTRYPOINT=web
|
||||
HTTPS_ENTRYPOINT=websecure
|
||||
CERT_RESOLVER=myresolver
|
||||
AUTH_MIDDLEWARE=authelia-auth@docker
|
||||
HTTPS_REDIRECT_MIDDLEWARE=https-redirect@docker
|
||||
|
||||
# --- User/Group IDs ---
|
||||
PUID=1000
|
||||
PGID=1000
|
||||
|
||||
# --- Application Settings ---
|
||||
THERAPIST_NAME=
|
||||
BUSINESS_NAME=Armonía del Ser
|
||||
WHATSAPP_PHONE=
|
||||
SPEI_CLABE=
|
||||
SPEI_BANK=
|
||||
SPEI_BENEFICIARY=
|
||||
GCAL_CALENDAR_ID=primary
|
||||
GOOGLE_SERVICE_ACCOUNT_JSON=
|
||||
@@ -16,7 +16,8 @@ ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN git clone --depth 1 --branch "${DASHBOARD_REF}" "${DASHBOARD_REPO_URL}" . && \
|
||||
RUN test -n "${DASHBOARD_REPO_URL}" || { echo "ERROR: DASHBOARD_REPO_URL build arg is required" >&2; exit 1; } && \
|
||||
git clone --depth 1 --branch "${DASHBOARD_REF}" "${DASHBOARD_REPO_URL}" . && \
|
||||
pnpm install --frozen-lockfile && \
|
||||
pnpm run build
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ services:
|
||||
gitea:
|
||||
image: gitea/gitea:${GITEA_VERSION:-latest}
|
||||
container_name: ${CONTAINER_NAME:-gitea}
|
||||
restart: always
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- USER_UID=${USER_UID:-1000}
|
||||
- USER_GID=${USER_GID:-1000}
|
||||
|
||||
+14
-14
@@ -11,30 +11,30 @@ services:
|
||||
- ./media:/media:ro
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- proxy
|
||||
- proxy-net
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
# HTTPS Router
|
||||
- "traefik.http.routers.${SERVICE_NAME}.rule=Host(`${SERVICE_DOMAIN}`)"
|
||||
- "traefik.http.routers.${SERVICE_NAME}.entrypoints=${HTTPS_ENTRYPOINT:-websecure}"
|
||||
- "traefik.http.routers.${SERVICE_NAME}.tls=true"
|
||||
- "traefik.http.routers.${SERVICE_NAME}.tls.certresolver=${CERT_RESOLVER:-letsencrypt}"
|
||||
- "traefik.http.routers.${SERVICE_NAME}.middlewares=${SERVICE_NAME}-ratelimit@docker"
|
||||
- "traefik.http.routers.${SERVICE_NAME}.service=${SERVICE_NAME}-svc"
|
||||
- "traefik.http.routers.${SERVICE_NAME:-jellyfin}.rule=Host(`${SERVICE_DOMAIN}`)"
|
||||
- "traefik.http.routers.${SERVICE_NAME:-jellyfin}.entrypoints=${HTTPS_ENTRYPOINT:-websecure}"
|
||||
- "traefik.http.routers.${SERVICE_NAME:-jellyfin}.tls=true"
|
||||
- "traefik.http.routers.${SERVICE_NAME:-jellyfin}.tls.certresolver=${CERT_RESOLVER:-myresolver}"
|
||||
- "traefik.http.routers.${SERVICE_NAME:-jellyfin}.middlewares=${SERVICE_NAME:-jellyfin}-ratelimit@docker"
|
||||
- "traefik.http.routers.${SERVICE_NAME:-jellyfin}.service=${SERVICE_NAME:-jellyfin}-svc"
|
||||
|
||||
# Rate Limit Middleware
|
||||
- "traefik.http.middlewares.${SERVICE_NAME}-ratelimit.ratelimit.average=${RATE_LIMIT_AVG:-100}"
|
||||
- "traefik.http.middlewares.${SERVICE_NAME}-ratelimit.ratelimit.burst=${RATE_LIMIT_BURST:-50}"
|
||||
- "traefik.http.middlewares.${SERVICE_NAME:-jellyfin}-ratelimit.ratelimit.average=${RATE_LIMIT_AVG:-100}"
|
||||
- "traefik.http.middlewares.${SERVICE_NAME:-jellyfin}-ratelimit.ratelimit.burst=${RATE_LIMIT_BURST:-50}"
|
||||
|
||||
# HTTP to HTTPS Redirect
|
||||
- "traefik.http.routers.${SERVICE_NAME}-red.rule=Host(`${SERVICE_DOMAIN}`)"
|
||||
- "traefik.http.routers.${SERVICE_NAME}-red.entrypoints=${HTTP_ENTRYPOINT:-web}"
|
||||
- "traefik.http.routers.${SERVICE_NAME}-red.middlewares=https-redirect@docker"
|
||||
- "traefik.http.routers.${SERVICE_NAME:-jellyfin}-red.rule=Host(`${SERVICE_DOMAIN}`)"
|
||||
- "traefik.http.routers.${SERVICE_NAME:-jellyfin}-red.entrypoints=${HTTP_ENTRYPOINT:-web}"
|
||||
- "traefik.http.routers.${SERVICE_NAME:-jellyfin}-red.middlewares=${HTTPS_REDIRECT_MIDDLEWARE:-https-redirect@docker}"
|
||||
|
||||
# Service definition
|
||||
- "traefik.http.services.${SERVICE_NAME}-svc.loadbalancer.server.port=8096"
|
||||
- "traefik.http.services.${SERVICE_NAME:-jellyfin}-svc.loadbalancer.server.port=8096"
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
proxy-net:
|
||||
name: ${PROXY_NETWORK:-proxy-net}
|
||||
external: true
|
||||
@@ -2,7 +2,7 @@ services:
|
||||
snappymail:
|
||||
image: ghcr.io/the-djmaze/snappymail:${SNAPPYMAIL_VERSION:-latest}
|
||||
container_name: ${CONTAINER_NAME:-snappymail}
|
||||
restart: always
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./data:/var/lib/snappymail/_data_
|
||||
networks:
|
||||
|
||||
Reference in new issue
Block a user