Urgent.News

What's breaking now, across thousands of outlets.

Tech

How to upgrade Postgres in Docker to 18, and be ready for 19: dump and restore or pg_upgrade --link

I moved a Postgres database on Dokploy from 16 to 18 with pg_upgrade . It went fine, with the database down for under a minute, but it stopped twice on the way. First, pg_upgrade stopped at its checks: old cluster does not use data checksums but the new one does . Then 18 started, and my app couldn't connect. Neither stop was bad luck. Both follow from how the 18 tooling works, and both wait in a…

The PostgreSQL 18 image moved the data directory (PGDATA) down one level to /var/lib/postgresql/18/docker, and the volume location to /var/lib/postgresql. This change allows pg_upgrade --link to perform a hard link within a single mount. However, a volume mounted at PGDATA itself, as done by Dokploy for version 18, blocks this functionality.

Rehearsing a dump and restore on a copy is advised before deciding on a path, timing it for comparison. A dump and restore method involves re-inserting every row and rebuilding indexes, while pg_upgrade --link is faster, taking 12.9 to 14.4 seconds for data sizes between 1.4 and 8.5 GB, based on End Point's 2015 test.

When upgrading from a 17 cluster made with default image settings to 18, data checksums are turned on in 18, causing pg_upgrade to refuse the mismatch. The fix for this issue varies depending on the path chosen for the upgrade.

Once the new server starts, a restored backup can only be accessed using the --link method. The article includes a step-by-step guide on how to check if the upgrade worked, potential errors, and fixes, as well as specific advice for Dokploy users regarding the mount that blocks an in-place upgrade to version 19.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Landing page builders don't make sense anymore

I build a product in this space, so read this with that in mind. I'll get to it at the end. For about fifteen years a landing page builder was the sensible way for a non-developer to put a page on the…

  • AI assistants can create landing pages in minutes, including design and content.
  • Hosting platforms like Vercel and Netlify are recommended over landing page builders.
  • Future of landing pages: AI handles design, content, hosting, and approval.

More from Monday 2 November →