Repository navigation
Update server from browser - #37
Conversation
- Control builds reuse an identical AdvantageScope Lite build instead of pulling emsdk and compiling (~30 min): .cache/ascope-dist/<key>, else a release's ascope-dist.tar.gz (origin, then upstream) whose inputs match. Keyed on the inputs as they are on disk; CODERUNNER_ASCOPE_PREBUILT=0 always compiles. build-ascope-lite.ts matches v0.6.10 again so releases can be reused. - Install the Docker CLI and buildx as checksum-pinned static downloads instead of copying them out of docker:27.5.1-cli. - Fetch the PathPlanner dist on the oven/bun image instead of debian. - Render the version picker's dropdown in a portal so the card no longer clips it; it flips above near the window bottom and always scrolls. - Drop the "same code as what's running" message and empty details box. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Replace the running step text with one overall progress bar, with the elapsed timer on its left. Progress is estimated from the step states (weighted per release or branch) plus the running step's own signals (BuildKit stage counter, which image is downloading, health wait) and never moves backwards; the raw step text is the bar's tooltip. - Remove the Server checkout field from the Running now card. - Last update is one line: result (incl. "rolled back"), age, duration, admin. The ref is only named when it differs from what is running. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Progress row is now timer, percentage, then a shorter bar, without the fixed-width gap after the timer. - Last update uses real " · " separators in the text instead of CSS gaps, so it reads and copies correctly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This is a cool idea! Claude flagged a few issues: 1. A running update can be marked failed — 2. PathPlanner network errors now fail local builds — 3. The helper's 4. The helper runs from the mutable image name, not the running image — 5. AGENTS.md wasn't updated (also, we should probably change the cemo strings and tests to mathewdunne/CodeRunner and ghcr.io/mathewdunne) I can fix these and merge or you can fix them if you want, let me know. Cool idea though and I appreciate the PR |
|
I can fix them with claude tomorrow. Glad you like it |
…wdunne - reconcileLostJob: only "no such container" marks a job lost; other docker errors leave it running - helper forwards running UID/GID, docker group, and host data dir to compose, and runs from the running image ID instead of its tag - docker-pathplanner-dist: network errors only fail pinned builds - AGENTS.md: decisions 011–052, admin server updates paragraph - demo strings and tests use mathewdunne/CodeRunner and ghcr.io/mathewdunne Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I had claude implement your changes, let me know if anything else needs to be done. |
Compose resolves both images from CODERUNNER_IMAGE_NS, so a namespace passed on the command line instead of .env was lost when the helper ran `docker compose`, and a fork deployment would resolve upstream images. Forward the running control image's registry prefix with the other runtime settings; locally named images have none and leave .env in charge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks! Just made one small fix and then merged! You'll have to do the first update the old way, but then the updater should work. I appreciate the contribution! |
Summary
Adds an Admin → Update tab that updates a self-hosted, Compose-deployed
CodeRunner from the browser. An admin picks a published release or a branch
from one searchable list and confirms. A release pulls the prebuilt GHCR
images; a branch is built on the server. The server finishes with the same
docker compose up -dan operator would run, waits for the controlcontainer's healthcheck, and rolls back automatically if it fails.
The manual flow keeps working, and the GCE Deploy workflow is unchanged. The
design and its trade-offs are recorded in
docs/decisions/052-admin-server-updates.md.How it works
POST /admin/server-updatestarts aone-shot sibling container from the currently running control image,
with the host checkout and data dir mounted. It outlives the control
container it replaces, which is what makes the health wait and rollback
possible. Job state lives in
data/server-update.json, so the new controlprocess can report the result after the restart.
:latestmeans "what this server runs". The helper pulls…:vX.Y.Z(or builds
…:branch-<name>), re-tags those images as:latest, then runsdocker compose up -d. A hand-rundocker compose up -dtherefore alwaysredeploys the local images;
docker compose pullstill fetches the newestrelease. Nothing version-related is written to
.env.docker kill) is markedfailed instead of locking the tab.
own
com.docker.compose.*labels (project, config files, service), sostacks started with
-fwork.UI
coderunner.git.branchimage label), commit title, author and age, updateavailable or up to date, and the last update (result, when, how long, who).
sections, labelled Current and Latest. For the selection it shows the
release notes, the commits it adds, or the commits it removes for a
downgrade, plus a one-line plan. Active students and builds are shown only
when someone would be interrupted.
collapsible command log. A failed poll during the restart shows
"Reconnecting…", and a Reload prompt appears once the new version is up.
60 requests/hour; Check for updates forces a refresh.
GITHUB_TOKENisoptional.
Build changes
docker buildin the helper fell back to the legacy builder, which leavesTARGETARCHempty and fails this Dockerfile.not copied out of
docker:27.5.1-cli;oven/buninstead ofdebian.scripts/image.tsskips the emsdk compile(~30 min) when an identical build exists: a local copy in
.cache/, or arelease's
ascope-dist.tar.gzwhose inputs match exactly (submodulecommit, patches, both build scripts, the Dockerfile stage). Measured
locally: a control build took 3m22s, versus about 33 minutes cold.
CODERUNNER_ASCOPE_PREBUILT=0always compiles.submodule git files (reflogs,
FETCH_HEAD, tool folders).Compatibility
.envsettings.CODERUNNER_UPDATE_REPO_DIR(rarelyneeded) and
GITHUB_TOKENare optional.CODERUNNER_TAGin.envstill works. Compose runs that tag,and the updater keeps the line current. This covers GCE, whose
render-env.shwrites it.tab must be done with the existing CLI flow, which installs a control image
that has the updater.
checkout: plain
docker run, the GCE VM (compose files are copied, notcloned), and from-source dev. Demo mode shows sample data.
Security
requireAdmin. Starting an update is audited asserver.updateand records the admin's email.already implies. It gets the same SELinux
label=disableexemption as thecontrol service (decision 040).
Testing
bun run checkandbun run typecheckare clean.idle-and-admin("Cannot use a closed database" from a run-readinesstimer firing after its test closed the app), or a 5 s timeout in
imports. Both files pass on their own (3/3 runs each), and this branchdoesn't touch that code. It showed up while the machine was heavily loaded.
dockerand a throwawaygit repo: release update, unhealthy start with rollback, legacy
.envpin, failed pull, and a non-git checkout.
:latestplusdocker compose up -drecreates the container;bun run docker:build:controlreused upstream v0.6.10'sAdvantageScope with no emsdk layers pulled;
Known issues / follow-ups
withAppinapps/control/src/__tests__/helpers.tsfalls back to the realdockerwhen a test passes no fake. Some test then starts real workspace
containers that outlive the run and fill
/tmp. This predates this PR; thehelper should default to a fake runner.
be root-owned on the host.
node:16andnode:22for two small builder stages.🤖 Generated with Claude Code
I'm open to any changes and suggestions. Consider squashing and merging this pr because of the large number of commits (I had to test on an external server)