Skip to content

Stop promising project files live in APPX_DATA - #10

Merged
maxsoldev merged 2 commits into
mainfrom
fix-appx-data-holds-no-project-files
Oct 9, 2026
Merged

maxsoldev merged 2 commits into
mainfrom
fix-appx-data-holds-no-project-files

Conversation

@maxsoldev

Copy link
Copy Markdown
Collaborator

Part 3 of #7. Fixes the misleading bootstrap prompt that is the root cause of the other two halves, and removes the host artifacts that only existed for the old host-mode deploy.

The problem

Bootstrap tells the operator the data directory "stores the DB, TLS certs, and project files". The first two are true. Project files live in the builder-workspace Docker volume, under Docker's data-root — so an operator who mounts a volume at APPX_DATA for project growth gets none of it:

$ du -sh /mnt/appx-prod-volume/appx-data /var/lib/docker/volumes/builder-*/_data
720K    /mnt/appx-prod-volume/appx-data          # DB + TLS certs + empty projects/
120K    /var/lib/docker/volumes/builder-workspace/_data
303M    /var/lib/docker/volumes/builder-podman-storage/_data

main.go derived projectRoot from the data dir regardless of mode, so Manager.ProjectDir() returned a host path that cannot exist in container mode (WORKSPACE_DIR is /workspace inside the container).

Changes

Area Change
deploy/bootstrap.sh Prompt and the APPX_DATA comment now say DB + certs only, and name the volumes that actually grow
cmd/appx/main.go New hostProjectRoot() returns "" in container mode — appx no longer derives, creates, or requires $APPX_DATA/projects
internal/project/manager.go Empty ProjectRoot is preserved instead of resolved (filepath.Abs("") yields appx's cwd); ProjectDir returns "" so the API omits projectDir
deploy/system-setup.sh Drop the permanently-empty $DATA_DIR/projects and the shared projects group
deploy/verify-installation.sh Assert the host dir and group are absent; drop the setgid section
deploy/appx.service Correct the now-obsolete UMask justification (value left alone so an upgrade does not change existing file perms)
Docs CLAUDE.md, self-hosting.md, storage-and-isolation.md get sizing guidance that points at Docker's data-root

Co-located host mode (local dev, where $APPX_DATA/projects is bind-mounted into agent-server) is deliberately unchanged.

Why the projects group goes too

It existed so a host agent user and appx could share project directories through a setgid dir. That user is gone — the agent runs as an unprivileged uid inside the container — so the group guarded a directory that no longer exists. teardown.sh still removes it, so upgrades from a host-mode install clean up.

Testing

New tests:

  • TestHostProjectRoot_ContainerModeHasNoHostPath / ..._CoLocatedDerivesFromDataDir — pins the mode split.
  • TestManagerProjectDir_EmptyRootReportsNoPath — guards the filepath.Abs("") trap.
  • TestGetProject_OmitsProjectDirInContainerMode — asserts the API omits the field rather than reporting a bogus path.

Manual verification — container mode no longer creates a host projects dir:

$ APPX_DATA=$TMPDIR/appx-cmode APPX_AGENT_CONTAINER=true ... ./appx --http
project files live in the agent's workspace volume (no host path)
$ find $TMPDIR/appx-cmode
.../appx-cmode/.appx-internals/{appx.db,agent-server-token,initial_password}   # no projects/

Co-located host mode still reports and uses a real path:

$ curl -s -b cj http://127.0.0.1.sslip.io:8099/api/projects
[{"name":"testapp",...,"projectDir":".../appx-verify/projects/testapp"}]
$ curl -s -b cj -X POST .../api/shell -d '{"cwd":".../projects/testapp"}'
{"id":"1f8bb16a-..."}    # 201

task build, task test, task lint all pass; bash -n clean on the four changed deploy scripts.

Not in this PR

The other two halves of #7 — the broken project Terminal tab and --purge-data leaving project volumes behind — follow as separate PRs. The terminal fix builds on the hostProjectRoot plumbing here.

🤖 Generated with Claude Code

In container mode the agent owns /workspace *inside* the outer container,
backed by the builder-workspace Docker volume. APPX_DATA holds only the
SQLite DB and TLS certs, but bootstrap's prompt said it "stores the DB, TLS
certs, and project files" — so an operator mounting a volume there for
project growth got ~720K of DB and certs while 300M+ of real project data
stayed on the root disk.

Make the code and the docs agree with where the bytes actually are:

- bootstrap.sh: the prompt and the APPX_DATA comment now say the directory
  holds the DB and certs only, and name the two Docker volumes that do grow.
- main.go: hostProjectRoot() returns "" in container mode, so appx no longer
  derives, creates, or requires $APPX_DATA/projects. Co-located host mode
  (local dev, where the dir is bind-mounted into agent-server) is unchanged.
- project.Manager: an empty ProjectRoot is preserved rather than run through
  filepath.Abs("") (which yields appx's cwd), and ProjectDir reports "" so
  the API omits projectDir instead of returning a path on a filesystem appx
  cannot see.
- system-setup.sh: drop the permanently-empty $DATA_DIR/projects and the
  shared `projects` group. Both existed so a *host* agent user could share
  project dirs; that user is gone. teardown.sh still removes the group so
  upgrades clean it up.
- verify-installation.sh: assert the host projects dir and group are absent
  rather than asserting their permissions, and drop the setgid section.

The broken project terminal and --purge-data leaving projects behind are the
other two halves of #7 and are not addressed here.

Refs #7

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@maxsoldev
maxsoldev merged commit 3356077 into main Oct 9, 2026
1 check passed
@maxsoldev
maxsoldev deleted the fix-appx-data-holds-no-project-files branch October 9, 2026 09:53
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