Skip to content

MAIT-32: Migrate postgres from ankane/pgvector to pgvector/pgvector#38

Open
acikabubo wants to merge 1 commit intomainfrom
MAIT-32-migrate-pgvector-image
Open

MAIT-32: Migrate postgres from ankane/pgvector to pgvector/pgvector#38
acikabubo wants to merge 1 commit intomainfrom
MAIT-32-migrate-pgvector-image

Conversation

@acikabubo
Copy link
Copy Markdown
Contributor

Summary

  • Migrate ankane/pgvector:v0.5.1 to pgvector/pgvector:0.8.2-pg18-trixie in compose.yaml
  • Update volume mount path from /var/lib/postgresql/data to /var/lib/postgresql to accommodate new PGDATA=/var/lib/postgresql/18/docker
  • Add migration guide to README for existing data (dump and restore required due to PG 15 → 18 upgrade)

Related

MAIT-32

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Documentation

    • Added comprehensive upgrading guide with migration steps for transitioning to the latest PostgreSQL/pgvector container image.
  • Configuration

    • Updated PostgreSQL container image to a newer version with PostgreSQL 18 support.
    • Modified PostgreSQL data volume mount path location.

Walkthrough

The 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

Cohort / File(s) Summary
PostgreSQL Image and Configuration Update
README.md, compose.yaml
Updated pgvector Docker image from ankane/pgvector:v0.5.1 to pgvector/pgvector:0.8.2-pg18-trixie and changed the postgres volume mount point from /var/lib/postgresql/data to /var/lib/postgresql. Added migration documentation in README including dump/restore workflow for existing data and wipe-and-recreate option for fresh setups.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'MAIT-32: Migrate postgres from ankane/pgvector to pgvector/pgvector' directly and clearly describes the main change in the pull request—migrating the PostgreSQL image from one vendor to another.
Description check ✅ Passed The description is directly related to the changeset, providing clear context about the image migration, volume mount path changes, and PostgreSQL version upgrade with a migration guide.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between de28af5 and 7ecb126.

📒 Files selected for processing (2)
  • README.md
  • compose.yaml

Comment thread README.md
Comment on lines +420 to +430
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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

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.

1 participant