fix: persist Homebrew across workspace restarts, fix brew upgrade EXDEV error - #186
Merged
Conversation
…EV error Homebrew (/home/linuxbrew/.linuxbrew) lived on the container's ephemeral image/root filesystem in all three templates, not on any persisted volume. Two consequences: 1. brew upgrade/brew install could fail outright with a cross-filesystem link error (EXDEV). Homebrew's default cache ($HOME/.cache/Homebrew) resolves to /home/coder/.cache/Homebrew -- a different, volume-mounted filesystem than the Cellar at /home/linuxbrew/.linuxbrew. Renaming a downloaded bottle across that boundary throws EXDEV. 2. Even when an upgrade succeeded, it didn't stick. docker_container.workspace is destroyed and recreated fresh from the image on every workspace stop/start, so anything installed/upgraded on the container's own root filesystem was silently lost on the next restart -- only the bind-mounted /home/coder and the dind-cache volume survived. Fix both, in all three templates: - Relocate HOMEBREW_CACHE to /home/linuxbrew/.cache/Homebrew via a Dockerfile ENV, so cache and Cellar are guaranteed to be on the same filesystem. - Add a new per-workspace docker_volume mounted at /home/linuxbrew, matching the existing dind-cache pattern (unconditional, not gated by start_count, so it survives stop/start). Docker auto-populates a fresh named volume from the image's existing directory contents on first mount, so no manual seed-copy step is needed -- just an ownership fix mirroring the existing /home/coder chown. Bumps VERSION to v0.5 to match the image already rebuilt and pushed on amd64 with this Dockerfile change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
coder-<owner>-<workspace>-linuxbrew) mounted at/home/linuxbrewin all three templates (freeform,drupal-core,drupal-contrib), sobrew install/brew upgradedone inside a workspace survivescoder stop/coder start. Previously/home/linuxbrewlived on the container's ephemeral root filesystem and any manual Homebrew changes were silently lost.HOMEBREW_CACHEto/home/linuxbrew/.cache/Homebrewinimage/Dockerfile(was defaulting to$HOME/.cache/Homebrew, a different filesystem than the Cellar), fixing a cross-device link (EXDEV) error when hardlinking a downloaded bottle into the Cellar.sudo chown -R coder:coder /home/linuxbrewto each template's startup script, next to the existing/home/coderchown.VERSIONtov0.5since this requires an image rebuild.linuxbrew_volume_createdtest to all threetests/validate.tftest.hclfiles.CLAUDE.md's Volume Strategy section.Test plan
terraform fmt -recursive -check -diff— cleanterraform validatefor all three templates — cleanterraform testfor all three templates — 7/7/12 passedmake build-and-push, must run on an amd64 host) before pushing templates, since the Dockerfile changedbrew upgrade+coder stop/coder startcycle🤖 Generated with Claude Code