Skip to content

fix: finish the clean-host quickstart: AppArmor probe pull, resumable downloads, pull retries, ClickHouse first boot, host-port preflight (ADR-001071) - #446

Merged
Kaikei-e merged 2 commits into
mainfrom
fix/quickstart-clean-host-followups
Dec 4, 2026

Conversation

@Kaikei-e

@Kaikei-e Kaikei-e commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Summary

ADR-001070 made ./quickstart.sh --gpu cuda|vulkan the one-command start for a fresh clone. Running it on a host reset to a clean state found seven more problems; this PR fixes them in the repo (ADR-001071).

  • AppArmor probe: scripts/probe-apparmor-postgres.sh ran postgres:17.11-alpine with --pull=never inside a 15 s timeout, so sudo ./scripts/install-apparmor-profile.sh always failed its last check on a clean host (No such image).
    • It now pulls a missing image outside the timeout.
    • The timed run keeps --pull=never, so the timeout still measures only a hung confined start.
    • A failed pull says it is not an AppArmor profile failure.
  • altctl stack declarations: compose.apparmor.yaml and compose.staging.apparmor.yaml were auto-registered as stacks, and tts had no semantics, so every altctl run printed three notices.
    • Both overlays are now listed under overlays:.
    • tts is declared.
    • A test pins zero auto-registered stacks for the repo's real config.
  • Model downloads: scripts/seed-llamacpp-models.sh made a single wget with no resume. One network drop waited out busybox's 900 s default and threw the partial file away.
    • The in-container logic moved to scripts/seed-llamacpp-models-inner.sh.
    • It now resumes with wget -c, has a 60 s stall timeout, and tries up to 5 times with doubling waits.
    • A file whose sha256 does not match is deleted and counts as one failed attempt; a complete partial file (HTTP 416 on resume) is verified and used.
  • Image pulls: one network is unreachable during a pull ended the whole quickstart. altctl up / restart and the quickstart's news-creator pull now retry up to 3 times, waiting 10 s and then 30 s; the last failure is still fatal. --timeout still bounds only the Ready-wait.
  • ClickHouse first boot: on an empty data directory, the upstream entrypoint runs a temporary init server because CLICKHOUSE_DB is set.
    • clickhouse/entrypoint-wrapper.sh connected to that temporary server and started migrations. The server was stopped mid-migration, the container exited and restarted, and compose reported the dependency as unhealthy.
    • The wrapper now starts the upstream entrypoint without CLICKHOUSE_DB and creates the database itself, as before.
    • Production data directories already exist, so nothing changes there.
  • CI: test-quickstart-entry.py and test-seed-reranker-model.py were not run by any lint target. They now run in the compose target, together with the new seed and ClickHouse wrapper tests, and the compose-audit path filters cover the scripts they test.
  • Host ports:
    • altctl up now checks every host port the services it will start publish, before pulling anything. Listeners are read from /proc/net/tcp{,6}, and ports held by the project's own containers are excluded. It lists every conflict and stops.
    • altctl init picks a free Plecto admin port (18080-18179) and writes it to .env when PLECTO_ADMIN_HOST_PORT is unset and 127.0.0.1:8080 is taken by another process; llama-server listens on 8080 by default.
    • The quickstart's final output shows the effective port.

Verification on a clean host

  • The host was reset to a clean state: no Alt containers, volumes, networks, images or build cache.
  • The repo was freshly cloned and this branch checked out.
  • sudo ./scripts/install-apparmor-profile.sh pulled the probe image and passed.
  • ./quickstart.sh --gpu vulkan completed all 8 steps in about 12.7 minutes.
    • 8080 was in use by another llama-server, and init selected PLECTO_ADMIN_HOST_PORT=18080.
    • No auto-registration notices were printed.
    • Both models downloaded on the first attempt.
    • ClickHouse became healthy with 0 restarts.
    • All 31 containers were healthy.
    • The README verify commands all returned 200: /, :18080/readyz, :9000/v1/health, :9250/health, :7700/health.
  • Real busybox wget (alpine:3.21) against Hugging Face:
    • A 60 MB file cut at 20 MB resumed with -c to a matching sha256.
    • Resuming a complete file returned HTTP/1.1 416 Range Not Satisfiable with exit 1 and left the file unchanged.

Test plan

  • RED commit first: every new or changed test fails against the base code.
  • ./scripts/lint/run.sh altctl, scripts, apparmor, harness, compose, repo
  • go test ./... in altctl and scripts/altharness
  • docdag validate --immutable-since origin/main, alt-harness adr-gate --base origin/main
  • Clean-host ./quickstart.sh --gpu vulkan run as above
  • Register, log in, add a feed, and get an article summary in the browser on the clean host

🤖 Generated with Claude Code

Kaikei-e and others added 2 commits December 4, 2026 23:56
… missing image outside its timeout, the repo's altctl config auto-registers no stack, model seeding resumes and retries, image pulls retry a bounded number of times, ClickHouse first boot skips the upstream init server, the quickstart tests run in the compose lint target, and altctl checks host ports before up with an auto-selected Plecto admin port (ADR-001071)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ppArmor overlays and tts in .altctl.yaml, resume and retry llama.cpp model downloads, retry image pulls in altctl and quickstart, start ClickHouse without the upstream init server so first boot no longer races it, run the quickstart tests in the compose lint target, and check host ports before altctl up with init auto-selecting a free Plecto admin port (ADR-001071)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Kaikei-e
Kaikei-e merged commit 2726c39 into main Dec 4, 2026
35 checks passed
@Kaikei-e
Kaikei-e deleted the fix/quickstart-clean-host-followups branch December 4, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant