MAIT-32: Migrate postgres from ankane/pgvector to pgvector/pgvector#38
MAIT-32: Migrate postgres from ankane/pgvector to pgvector/pgvector#38
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe changes update the PostgreSQL setup from ankane/pgvector:v0.5.1 to pgvector/pgvector:0.8.2-pg18-trixie and adjust the volume mount path to reflect the new image requirements. Migration documentation is added for users upgrading existing setups. Changes
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@README.md`:
- Around line 420-430: Replace the host-side variable expansion in the two
docker commands so ${POSTGRES_USER} is expanded inside the container: run the
container command via a shell with the $ escaped or quoted, e.g. wrap the
postgres commands with sh -c and use single quotes so the container performs
expansion (replace the original lines that call "docker compose exec postgres
pg_dumpall -U ${POSTGRES_USER} > pgdump_pg15.sql" and "docker compose exec -T
postgres psql -U ${POSTGRES_USER} < pgdump_pg15.sql" with invocations like
docker compose exec postgres sh -c 'pg_dumpall -U "$POSTGRES_USER"' >
pgdump_pg15.sql and docker compose exec -T postgres sh -c 'psql -U
"$POSTGRES_USER"' < pgdump_pg15.sql so the ${POSTGRES_USER} comes from the
container environment).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: eb1bcd36-c26f-43bc-b639-6299ca60f786
📒 Files selected for processing (2)
README.mdcompose.yaml
| docker compose exec postgres pg_dumpall -U ${POSTGRES_USER} > pgdump_pg15.sql | ||
|
|
||
| # 2. Stop all services and remove the old volume | ||
| docker compose down -v | ||
|
|
||
| # 3. Start the new postgres container | ||
| docker compose up postgres -d | ||
|
|
||
| # 4. Wait for it to be healthy, then restore | ||
| docker compose exec -T postgres psql -U ${POSTGRES_USER} < pgdump_pg15.sql | ||
|
|
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Commands in README that expand POSTGRES_USER on host:"
rg -n 'docker compose exec.*\$\{POSTGRES_USER\}' README.md
echo
echo "POSTGRES_USER declarations in env files (if present):"
fd -HI '^\.env(\.rag(\.example)?)?$' -x sh -c 'echo "--- {}"; rg -n "^POSTGRES_USER=" "{}" || true'
echo
echo "Current host-shell value:"
printf 'POSTGRES_USER=%s\n' "${POSTGRES_USER-<unset>}"Repository: WikiTeq/mAItion
Length of output: 425
Use container-side variable expansion for database migration commands.
Lines 420 and 429 expand ${POSTGRES_USER} on the host shell, but this variable is defined only in .env.rag for the container environment, not on the host. The commands will fail because the variable expands to empty string before reaching the container.
Apply the following fixes to defer variable expansion to the container:
Recommended changes
- docker compose exec postgres pg_dumpall -U ${POSTGRES_USER} > pgdump_pg15.sql
+ docker compose exec -T postgres sh -lc 'pg_dumpall -U "$POSTGRES_USER"' > pgdump_pg15.sql
...
- docker compose exec -T postgres psql -U ${POSTGRES_USER} < pgdump_pg15.sql
+ docker compose exec -T postgres sh -lc 'psql -U "$POSTGRES_USER" -d postgres' < pgdump_pg15.sql🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@README.md` around lines 420 - 430, Replace the host-side variable expansion
in the two docker commands so ${POSTGRES_USER} is expanded inside the container:
run the container command via a shell with the $ escaped or quoted, e.g. wrap
the postgres commands with sh -c and use single quotes so the container performs
expansion (replace the original lines that call "docker compose exec postgres
pg_dumpall -U ${POSTGRES_USER} > pgdump_pg15.sql" and "docker compose exec -T
postgres psql -U ${POSTGRES_USER} < pgdump_pg15.sql" with invocations like
docker compose exec postgres sh -c 'pg_dumpall -U "$POSTGRES_USER"' >
pgdump_pg15.sql and docker compose exec -T postgres sh -c 'psql -U
"$POSTGRES_USER"' < pgdump_pg15.sql so the ${POSTGRES_USER} comes from the
container environment).
Summary
ankane/pgvector:v0.5.1topgvector/pgvector:0.8.2-pg18-trixieincompose.yaml/var/lib/postgresql/datato/var/lib/postgresqlto accommodate newPGDATA=/var/lib/postgresql/18/dockerRelated
MAIT-32