From 8ad48a49db827aa067b183af82342bd3faec9851 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Fri, 30 Oct 2026 09:33:34 -0500 Subject: [PATCH] docs(appctl): document source-built workload policy and build flag semantics - Document --build, --no-cache, and automatic --pull behavior for appctl up and update - Add Source-Built Workload Policy note detailing compose_build action sequences - Mark item completed in todo.txt Closes #11 Refs #11 --- docs/appctl.md | 22 ++++++++++++++++------ todo.txt | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docs/appctl.md b/docs/appctl.md index cbf6472..73fce4e 100644 --- a/docs/appctl.md +++ b/docs/appctl.md @@ -101,11 +101,13 @@ appctl info docs --ssl ### Lifecycle Management -#### `appctl up ` +#### `appctl up [--build] [--no-cache]` Starts the specified service stack in detached mode (`--remove-orphans`). * For a workload in `~/Sites`: starts containers and triggers `appctl sync`. * For `core`: starts the entire Core Compose stack using `/run/secrets/homeserver.env`. * For an individual Core service (e.g., `appctl up traefik`): starts that specific container. +* When `--build` is passed: invokes `docker compose build --pull` prior to deployment. The `--pull` flag guarantees base images in Dockerfile `FROM` lines are refreshed from remote registries. +* When `--no-cache` is passed: `--build` is implied (`build: True`) and `docker compose build --pull --no-cache` is executed, forcing a clean rebuild without cached layers. #### `appctl down ` Stops and removes containers defined in the target's Compose file (or stops the targeted Core container). @@ -116,14 +118,22 @@ Restarts the target stack or individual container: * `appctl restart core`: Restarts all Core Compose services. * `appctl restart traefik`: Restarts only the Traefik container. -#### `appctl update ` -Performs a sequential update workflow for a Sites workload stack: +#### `appctl update [--branch ] [--build] [--no-cache]` +Performs a sequential, revision-consistent update workflow for a Sites workload stack: 1. Verifies that the local Git working tree is clean (aborts if uncommitted changes exist). -2. Runs `git pull --ff-only` to fast-forward the current branch. -3. Runs `docker compose pull` to fetch updated container images. -4. Runs `docker compose up -d --remove-orphans` to recreate containers. +2. Runs `git pull --ff-only [origin ]` to fast-forward the current branch. +3. Re-validates `app.yaml`, expected branch declaration, and Compose security rules against the newly pulled working tree. +4. Executes declared actions in `app.yaml` (`actions: [git_pull, compose_pull, compose_build, compose_up, compose_restart]`): + * `compose_pull`: Runs `docker compose pull` to fetch updated container images. + * `compose_build`: Runs `docker compose build --pull` (and `--no-cache` if requested). + * `compose_up`: Runs `docker compose up -d --remove-orphans` to recreate containers. + * When `--build` is passed via CLI, `compose_build` is automatically executed prior to `compose_up`, even if omitted from manifest actions. + * When `--no-cache` is passed, build is implied and executes with `--no-cache`. 5. Runs `appctl sync` to update the Homepage dashboard. +> [!NOTE] +> **Source-Built Workload Policy**: For workloads built directly from local source Dockerfiles rather than pre-built registry images, declare `compose_build` in `app.yaml` `deployment.actions` (`actions: [git_pull, compose_build, compose_up]`). Both manual `appctl update` and automated GitOps dispatcher runs will execute `docker compose build --pull` before recreating containers, ensuring reproducible builds with current upstream base layers. + > [!NOTE] > Core platform updates are managed via version-controlled NixOS generations (`git pull` followed by `nixos-rebuild switch`), not through `appctl update core` (as Core is mounted read-only for `homelab-appctl.service`). diff --git a/todo.txt b/todo.txt index a24cc22..cc6659f 100644 --- a/todo.txt +++ b/todo.txt @@ -42,5 +42,5 @@ x 2026-10-23 (A) Declare global Git safe.directory for /home/operator/Sites/* in x 2026-10-30 (B) Enforce fail-closed check on daemon socket availability and remove silent Bash fallback in scripts/appctl +cli @security x 2026-10-30 (B) Restore live container status inspection in workload.list and format STATUS column in scripts/appctl_cli.py +cli @ux (B) Bootstrap operator admin token provisioning helper and documentation in docs/appctl.md and docs/secrets-and-state.md +docs @auth -(B) Wire --build/--no-cache and pass --pull during compose_build in scripts/appctl_router.py and scripts/appctl_cli.py +build @p4 +x 2026-10-30 (B) Wire --build/--no-cache and pass --pull during compose_build in scripts/appctl_router.py and scripts/appctl_cli.py +build @p4 (C) Deprecate P6 on-server AI authoring compiler in favor of external Homelab MCP Gateway in ROADMAP.md and ADR 0002 +docs @roadmap