Skip to content

chore: Upgrade local & dev postgres to 18#264

Merged
martyngigg merged 2 commits intomainfrom
upgrade-postgres-18
Mar 18, 2026
Merged

chore: Upgrade local & dev postgres to 18#264
martyngigg merged 2 commits intomainfrom
upgrade-postgres-18

Conversation

@martyngigg
Copy link
Contributor

@martyngigg martyngigg commented Mar 18, 2026

Summary

Matches version deployed in external database service after upgrade.

Change in mount path due to error message on first boot with original mount path:

Error: in 18+, these Docker images are configured to store database data in a
format which is compatible with "pg_ctlcluster" (specifically, using
major-version-specific directory names). This better reflects how
PostgreSQL itself works, and how upgrades are to be performed.

   See also https://github.com/docker-library/postgres/pull/1259

   Counter to that, there appears to be PostgreSQL data in:
     /var/lib/postgresql/data (unused mount/volume)

   This is usually the result of upgrading the Docker image without
   upgrading the underlying database using "pg_upgrade" (which requires both
   versions).

   The suggested container configuration for 18+ is to place a single mount
   at /var/lib/postgresql which will then place PostgreSQL data in a
   subdirectory, allowing usage of "pg_upgrade --link" without mount point
   boundary issues.

   See https://github.com/docker-library/postgres/issues/37 for a (long)
   discussion around this process, and suggestions for how to do so.

Summary by CodeRabbit

  • Chores
    • PostgreSQL database upgraded from version 16.9 to version 18 across all environments, bringing performance and security enhancements.
    • Database storage configuration optimised for improved resource utilisation.

Matches version deployed in external database service after
upgrade.
@martyngigg martyngigg added the technical debt Tasks to deliver a more robust solution to a quick fix required for speed of implementation label Mar 18, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 35fe89ce-fd59-476e-86d8-3db4f9781fa9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This pull request updates PostgreSQL from version 16.9 to 18 across infrastructure configurations. The Ansible role's default image variable is updated, and the Docker Compose configuration adjusts both the PostgreSQL image reference and modifies the database volume mount path.

Changes

Cohort / File(s) Summary
PostgreSQL Version Upgrade
infra/ansible/roles/postgres/defaults/main.yml, infra/local/docker-compose.yml
PostgreSQL image bumped from 16.9-bookworm to 18-bookworm across both Ansible and Docker Compose configurations. Docker Compose volume mount path changed from /var/lib/postgresql/data to /var/lib/postgresql.

Poem

🐰 A rabbit's cheer for databases grand,
From version sixteen to eighteen's land!
New postgres paths we've arranged with care,
Volume mounts shifted here and there!
Infrastructure hops to fresh frontiers fair! 🚀

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately describes the main change: upgrading PostgreSQL from version 16.9 to version 18 across local and development environments, which is confirmed by updates to both the Ansible configuration and Docker Compose file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

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

@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 `@infra/local/docker-compose.yml`:
- Line 108: Docker Compose mounts Postgres data to /var/lib/postgresql which
mismatches the Ansible role expecting /var/lib/postgresql/data; update the
docker-compose service volume entry (the string
"shared_database_data:/var/lib/postgresql") to
"shared_database_data:/var/lib/postgresql/data" so both environments use the
same data directory and avoid initialization discrepancies.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 05fef444-19b3-4c1b-819e-7de5f4c0dbe6

📥 Commits

Reviewing files that changed from the base of the PR and between 0700e4c and d15c8c8.

📒 Files selected for processing (2)
  • infra/ansible/roles/postgres/defaults/main.yml
  • infra/local/docker-compose.yml

@martyngigg martyngigg enabled auto-merge (squash) March 18, 2026 19:56
@martyngigg martyngigg merged commit 5b720d9 into main Mar 18, 2026
2 checks passed
@martyngigg martyngigg deleted the upgrade-postgres-18 branch March 18, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

technical debt Tasks to deliver a more robust solution to a quick fix required for speed of implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant