Skip to content

fix: use named docker volume for local-db#4

Open
AlexMetsai wants to merge 3 commits into
mainfrom
bugfix/use_named_docker_volume
Open

fix: use named docker volume for local-db#4
AlexMetsai wants to merge 3 commits into
mainfrom
bugfix/use_named_docker_volume

Conversation

@AlexMetsai
Copy link
Copy Markdown
Contributor

closes #

Checklist

  • I have performed a self-review of my code
  • If it is a core feature and/or a bugfix, I have added thorough tests.
  • Does this PR introduce a breaking change? 🚨

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-data bind mount with a named Docker volume for local-db.
  • Update reset-db to remove the named Docker volume instead of deleting a local directory.
  • Clarify the local-db comment to reflect named-volume persistence.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/client-slack/justfile Outdated
--name nannos-local-db \
-p {{LOCAL_DB_PORT}}:5432 \
-v "$(pwd)/{{LOCAL_DB_DATA}}:/var/lib/postgresql" \
-v {{LOCAL_DB_VOLUME}}:/var/lib/postgresql \
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
-v {{LOCAL_DB_VOLUME}}:/var/lib/postgresql \
-v {{LOCAL_DB_VOLUME}}:/var/lib/postgresql/data \

Copilot uses AI. Check for mistakes.
Comment thread packages/client-slack/justfile Outdated
Comment on lines 63 to 64
docker volume rm {{LOCAL_DB_VOLUME}} 2>/dev/null || true
echo "✓ Database data cleared. Run 'just local-db' to start fresh."
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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