Repository navigation
fix(compose): pull the images in install.sh, so a cached :latest cannot run - #664
Conversation
…ot run `docker compose up -d` pulls an image only when no local image matches the reference, so a :latest the machine already has -- pulled once, weeks ago -- is never re-resolved against the registry. install.sh had no pull step, so a re-run of the README's one-liner silently brought the stack up on whatever was cached. In the reported case that image predated packages/supervisor existing, and the supervisor crash-looped on ERR_MODULE_NOT_FOUND with nothing in the install output hinting the image was stale. Pull explicitly before `up -d`, from the project directory so the references pulled are the ones .env interpolates, and before the control plane's key generator, which is code from the harness image itself. A failed pull is fatal: running the images this machine happens to hold is the bug, and on a first install there is nothing to fall back to. SH_SKIP_PULL is the way past it for an offline host or a locally built SH_HARNESS_IMAGE. Fixes rossoctl#349 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: cwiklik <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Fixes #349 cleanly: pull_images runs $COMPOSE pull from the project directory (so .env-interpolated SH_HARNESS_IMAGE/SH_SANDBOX_IMAGE are what get pulled), before both the key generator and up -d, fail-closed with SH_SKIP_PULL as the documented escape hatch. Tests pin ordering, the docker-compose fallback, the failure path and the skip path; docs updated.
Author: cwiklik (MEMBER — maintainer)
Areas reviewed: Shell, Docs, Tests
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing
One nit inline.
| # The generator is code from the harness image, so it has to run on the PULLED one (#349): a stale | ||
| # image may ship a different genkeys.ts, or -- as in the issue -- not the package at all. | ||
| genkeys_at="$(log_line_of '^docker run .*genkeys\.ts')" | ||
| [[ -n "$genkeys_at" && "$(log_line_of '^docker compose pull ')" -lt "$genkeys_at" ]] || |
There was a problem hiding this comment.
nit: this ordering check is vacuous when the pull is missing — log_line_of returns empty and bash [[ "" -lt N ]] treats the empty operand as 0, so it passes. Mirror the guard used for pull_at/up_at above:
pull_at="$(log_line_of '^docker compose pull ')"
[[ -n "$pull_at" && -n "$genkeys_at" && "$pull_at" -lt "$genkeys_at" ]] ||Takes upstream's 11 commits after 071b213: gh vendored into the sandbox images (rossoctl#661), the sandbox image pulled on every run in both VM paths (rossoctl#665) and in compose (rossoctl#664), a cached login matched by endpoint (rossoctl#667), a kind-ci fix (rossoctl#663). No conflicts. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Rong Chang <[email protected]>
Summary
docker compose up -dpulls an image only when no local image matches the reference, so a:latestthe machine already has — pulled once, weeks ago — is never re-resolved against the registry.install.shhad no pull step, so a re-run of the README'scurl … | shone-liner silently brought the stack up on whatever was cached, with every container reportingStarted.In the reported case the cached image predated
packages/supervisorexisting, so the supervisor crash-looped onERR_MODULE_NOT_FOUND: Cannot find package 'tsx'and/turnreset the connection. Nothing in the install output hinted the image was stale.This takes fix (a) from the issue:
install.shpulls, every run.What changed
A
pull_imagesstep inmain, betweenensure_control_plane_profileandensure_mu1_secrets. Three properties, each pinned by a test:.envinterpolates (SH_HARNESS_IMAGE,SH_SANDBOX_IMAGE), not the file's defaultsup -dupresolves the cached image firstensure_mu1_secretsrunsgenkeys.tsinside the harness image. A stale image may ship a different generator, or — as in this issue — not the package at allA failed pull is fatal, not a warning: running whatever images the machine happens to hold is the bug, and on a first install there is nothing to fall back to. The refusal names the override.
SH_SKIP_PULL=1skips the pull entirely (not attempted, so an offline host waits for no timeout) and starts the stack on the local images — for an offline host, or anSH_HARNESS_IMAGEbuilt from a checkout that no registry serves.The pull goes through
$COMPOSE, so a machine without the v2 plugin pulls withdocker-composetoo.Verification
Against the issue's acceptance criteria:
install.shpulls before starting the stack, on a fresh machine and on a re-runtests/install.test.shasserts the pull happens, and that it happens beforeupmainwithout a manualdocker compose pulldeploy/compose/tests/install.test.shinstall.shinstall.sh did not pull before starting the stack, so a stale cached :latest runs (#349)|| true)install succeeded with a failing pullpull_imagesmoved afterensure_mu1_secretsthe key generator ran before the pull, so it ran in a possibly stale image (#349)install.test.shunder/bin/bash3.2.57 (#440)compose.test.sh,images.test.shmake test-deploydeploy/microvm/tests/build-snapshot.test.shfails — pre-existing on macOS (needs microVM build tooling), untouched by this diff, passes in CI on ubuntushellcheck -x -S warning,sh -n,bash -ncheck-doc-links.py(212 files, 0 broken)Daemon-free cross-check of what the pull covers:
docker compose config --imagesresolvesghcr.io/rossoctl/moca:latest,ghcr.io/rossoctl/moca-remote-worker:latestanddocker.io/redis:7-alpine— the harness image (the key generator's) is in the set with or without thecontrol-planeprofile. A live pull could not be exercised here (no Docker daemon on this machine); the mocked suite covers the argv, ordering, failure and skip paths.Docs
deploy/compose/README.md: the pull as step 3 of "Try it" (with whyup -dalone isn't enough),SH_SKIP_PULLin theSH_HARNESS_IMAGErow, the pull in "Upgrading", and the new assertions in "Tests".docs/reference/configuration.md:SH_SKIP_PULLunder the compose installer's inputs.Related: #342 (compose trial), #345. The sibling report for the VM path is #414 (
setup-vm.shnever pulls either) — not touched here.Fixes #349
Assisted-By: Claude Code