Skip to content

Keep renders, the render cache and assistant pictures across rebuilds - #10

Merged
davior merged 1 commit into
mainfrom
claude/determined-ride-g3mjr4
Oct 22, 2026
Merged

davior merged 1 commit into
mainfrom
claude/determined-ride-g3mjr4

Conversation

@davior

@davior davior commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Problem

docker-compose.yml already mounts all of ./data at /app/data, but the app wasn't writing there.

With no DATA_DIR set, config.py derives the data directory from its own location: Path(__file__).resolve().parents[2] / "data". That works for a local checkout (backend/app/config.py → repo root). In the image, though, the file sits at /app/app/config.py, so parents[2] is / and everything is written to /data, outside the volume.

Only the database survived a rebuild, because DATABASE_URL is set explicitly. Everything else under the data directory was lost every time:

Fix

  • backend/Dockerfile: ENV DATA_DIR=/app/data, so the image is correct even when run without compose.
  • docker-compose.yml: DATA_DIR=/app/data beside DATABASE_URL, with a comment on why it is load-bearing.
  • CLAUDE.md: the deploy note now says all of data/ is mounted, not just data/db/.

GAM isn't affected: its compose already sets MEDIA_DIR explicitly.

Testing

  • I reproduced the image layout (app/ copied under a root directory) and printed settings.resolved_data_dir. Without the variable it resolves to the parent of the root plus /data, which is /data in the image. With DATA_DIR=/app/data it resolves to /app/data.
  • docker-compose.yml still parses.
  • I couldn't build the image in this environment (no Docker daemon). CI's Docker build job will check that.
  • Existing renders recorded in the database whose files are already gone stay gone. This change only keeps new ones.

Generated by Claude Code

docker-compose mounts ./data at /app/data, but the app worked its data
directory out from where config.py sits, two levels up. In the image that
is /app/app/config.py, so it landed on /data: outside the volume. Only the
database survived a rebuild, because DATABASE_URL is set explicitly;
renders, the GAM file cache and pictures attached to the assistant were
lost every time.

DATA_DIR=/app/data is now set in the image and in the compose file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016K8ApooCKMPBVQiLjaWjcp
@davior
davior marked this pull request as ready for review October 22, 2026 00:54
@davior
davior merged commit 56ded8a into main Oct 22, 2026
3 checks passed
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.

2 participants