fix: use named docker volume for local-db#4
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the packages/client-slack local Postgres workflow to persist data via a named Docker volume instead of a repo-local bind-mounted directory, and adjusts the reset command accordingly.
Changes:
- Replace
.local-db-databind mount with a named Docker volume forlocal-db. - Update
reset-dbto remove the named Docker volume instead of deleting a local directory. - Clarify the
local-dbcomment to reflect named-volume persistence.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| --name nannos-local-db \ | ||
| -p {{LOCAL_DB_PORT}}:5432 \ | ||
| -v "$(pwd)/{{LOCAL_DB_DATA}}:/var/lib/postgresql" \ | ||
| -v {{LOCAL_DB_VOLUME}}:/var/lib/postgresql \ |
There was a problem hiding this comment.
The Postgres Docker image stores its data in /var/lib/postgresql/data (and the repo’s docker-compose local dev setup mounts to that path). Mounting the named volume at /var/lib/postgresql is likely not persisting the actual cluster data (and can interfere with the image’s expected directory layout). Consider mounting the named volume to /var/lib/postgresql/data (and/or explicitly setting PGDATA to match).
| -v {{LOCAL_DB_VOLUME}}:/var/lib/postgresql \ | |
| -v {{LOCAL_DB_VOLUME}}:/var/lib/postgresql/data \ |
| docker volume rm {{LOCAL_DB_VOLUME}} 2>/dev/null || true | ||
| echo "✓ Database data cleared. Run 'just local-db' to start fresh." |
There was a problem hiding this comment.
reset-db suppresses all errors from docker volume rm and then always prints a success message. If the volume can’t be removed (e.g., it’s still in use by another container with the same volume name), this will silently leave data behind while claiming it was cleared. Consider detecting a failure and emitting a warning / non-zero exit (or at least only printing the success message when removal succeeds).
| docker volume rm {{LOCAL_DB_VOLUME}} 2>/dev/null || true | |
| echo "✓ Database data cleared. Run 'just local-db' to start fresh." | |
| if docker volume inspect {{LOCAL_DB_VOLUME}} >/dev/null 2>&1; then | |
| if docker volume rm {{LOCAL_DB_VOLUME}}; then | |
| echo "✓ Database data cleared. Run 'just local-db' to start fresh." | |
| else | |
| echo "Failed to remove Docker volume {{LOCAL_DB_VOLUME}}. Database data may still be present." >&2 | |
| exit 1 | |
| fi | |
| else | |
| echo "✓ Database data cleared. Run 'just local-db' to start fresh." | |
| fi |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
closes #
Checklist