Skip to content

Fix Docker volume mount paths in README to prevent data loss on container recreate - #707

Open
hitesh-ctrl wants to merge 1 commit into
middlewarehq:mainfrom
hitesh-ctrl:fix/docker-volume-mount-paths
Open

hitesh-ctrl wants to merge 1 commit into
middlewarehq:mainfrom
hitesh-ctrl:fix/docker-volume-mount-paths

Conversation

@hitesh-ctrl

@hitesh-ctrl hitesh-ctrl commented Sep 6, 2026

Copy link
Copy Markdown

Summary

Fixes #693.

The docker run commands in the README mount the named volumes to paths that the running services never actually write to:

  • middleware_postgres_data is mounted at /var/lib/postgresql/data, but the production Dockerfile installs Postgres 15 via apt, which stores its data at /var/lib/postgresql/15/main (see the pg_hba.conf / postgresql.conf edits during build, which only make sense at that path).
  • middleware_keys is mounted at /app/keys, which doesn't exist anywhere in the image. The app's actual config directory (config.ini, integration secrets, etc.) is /app/backend/analytics_server/mhq/config.

Because neither path is real, Postgres and the app config write to the container's writable layer instead of the named volumes — which is why docker volume inspect / du on the volumes shows next to nothing. A docker restart preserves data because it's the same container layer, but docker rm + recreate wipes it, exactly matching the symptoms in #693.

The corrected paths already match what docker-compose.yml (used for local dev) mounts:

volumes:
  - dev_postgres_data:/var/lib/postgresql/15/main
  - dev_keys:/app/backend/analytics_server/mhq/config

Changes

  • README.md: corrected both docker run examples (initial install and the "fetch latest" troubleshooting step) to mount volumes at the paths the app actually uses.

Test plan

  • Verified via static analysis of the Dockerfile (Postgres 15 apt install paths, WORKDIR/COPY layout) and confirmed the corrected paths match the already-working docker-compose.yml dev setup.
  • Live repro (pull image, write data, docker rm + recreate, confirm persistence) was not completed due to slow network conditions in the environment used to prepare this PR — happy to run it if a maintainer wants confirmation, or a maintainer/reviewer can quickly confirm given local Docker access.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated Docker setup examples to use the current PostgreSQL data directory.
    • Updated Docker setup examples to mount the keys volume at its current application configuration path.

The docker run instructions mounted middleware_postgres_data to
/var/lib/postgresql/data and middleware_keys to /app/keys, but the
production image installs Postgres 15 via apt (which stores data at
/var/lib/postgresql/15/main) and keeps app config at
/app/backend/analytics_server/mhq/config. Neither README path is
actually used by the running services, so writes land in the
container's writable layer instead of the named volumes. Data
survives a plain `docker restart` (same layer) but is lost on
`docker rm` + recreate, matching the symptoms in middlewarehq#693. The correct
paths already match what docker-compose.yml uses for local dev.

Fixes middlewarehq#693

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Sep 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: f5da11a6-9308-4314-902c-ef180de9f964

📥 Commits

Reviewing files that changed from the base of the PR and between 844eb42 and b623502.

📒 Files selected for processing (1)
  • README.md

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

The README updates both Docker commands to mount PostgreSQL data and keys volumes at their new container paths.

Changes

Docker volume documentation

Layer / File(s) Summary
Update Docker volume mounts
README.md
The install and update commands mount PostgreSQL data at /var/lib/postgresql/15/main and keys at /app/backend/analytics_server/mhq/config.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to b6235

Docker installation and update instructions now direct persistent volumes to the application’s active database and configuration paths, preventing recreated containers from using incorrect mount locations. The change is ready to merge.

Poem

A rabbit checks the Docker trail
New volume paths now guard the mail
Postgres rests where data stays
Keys find home through nested ways
Two commands hop in sync
Clean mounts make the burrow blink

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: correcting Docker volume mount paths in the README to prevent data loss when containers are recreated.
Description check ✅ Passed The description explains the issue, links issue #693, identifies the affected paths, describes the proposed changes, and includes a test plan. It does not use every template heading or checklist item,…
Linked Issues check ✅ Passed The README changes address issue #693 by mounting PostgreSQL data and application configuration volumes at the paths used by the production image. Both documented docker run examples are updated to su…
Out of Scope Changes check ✅ Passed The changes are limited to the two relevant README docker run examples. No unrelated code or configuration changes are included.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

DB not persistent in new containers

2 participants