Repository navigation
Make --purge-data actually purge project data - #13
Merged
Merged
Conversation
teardown.sh --purge-data deleted $APPX_DATA, which in container mode holds only the SQLite DB and TLS certs. Every project's files and session transcripts live in the builder-workspace volume and the inner app images in builder-podman-storage, neither of which the script touched — so "purge all data" left all project data on disk, and a later bootstrap silently inherited the old workspace. Split the two kinds of state: - The outer container is a PROCESS, so it is now removed unconditionally. It runs with `--restart unless-stopped`, which means the Docker daemon kept it (and the agent inside it) alive and resurrected it on reboot even after the appx service was gone. Removing it is not destructive — its state is in the volumes, and appx's EnsureRunning recreates it on next start. - The volumes are DATA, so they are removed only under --purge-data, after the container that mounts them is gone (docker volume rm refuses while a container still references a volume). Container and volume names are overridable per deployment, so they are read from appx.env alongside APPX_DATA before that file is deleted; assuming the defaults would have silently skipped a renamed deployment's volumes and left all its project data behind. When docker is absent, the volume step warns on stderr rather than reporting a successful purge. The non-purge path now also states where project data actually is, since "kept data: /var/lib/appx" previously implied that directory was all of it. Refs #7 Co-Authored-By: Claude Opus 5 (1M context) <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.
Part 4 of #7. Independent of the other two — branches off
main.The problem
--purge-datadeleted$APPX_DATA, which in container mode holds only the SQLite DB and TLS certs. All project data lives in the named volumes, which the script never touched:So "purge all data" left every project behind, and a later bootstrap silently inherited the old workspace.
The fix
Split the two kinds of state:
The outer container is a process → removed unconditionally. It runs with
--restart unless-stopped, so the Docker daemon kept it (and the agent inside it) alive and resurrected it on reboot even after the appx service was gone. Removing it isn't destructive: its state is in the volumes, andEnsureRunningrecreates it on next start.The volumes are data → removed only under
--purge-data, and only after the container is gone (docker volume rmrefuses while a container still references a volume, so ordering is load-bearing).Container and volume names are overridable per deployment, so they're read from
appx.envalongsideAPPX_DATAbefore that file is deleted. Assuming the defaults would have silently skipped a renamed deployment's volumes — the worst possible failure for this command. When docker is absent the volume step warns on stderr rather than reporting a successful purge.The non-purge path now also says where project data actually is;
kept data: /var/lib/appxpreviously implied that directory was all of it.Testing
The script needs root, systemd, and real users, so I ran it inside a throwaway container — filesystem-isolated (its own
/etc/appx,/usr/local/bin, data dir) but driving the host's real Docker via the mounted socket, with onlysystemctl/userdel/groupdel/pkillstubbed. Every docker operation below is real, against volumes holding a realmyapp/README.md, named via env-file overrides rather than the defaults.--purge-data:Default (no flag):
Edge cases: idempotent re-run exits 0 (
no outer container named ...,no volume named ...); with the env file already deleted it falls back to the documented defaults; with docker absent it printsWARNING: docker not installed — project data in the named volumes was NOT purgedto stderr.bash -nclean.go build/task testunaffected (no Go changes).Note on what I did not change
I left the
projectsgroup in thegroupdelloop even though #10 stops creating it, so an upgrade from a host-mode install still cleans it up.🤖 Generated with Claude Code