Live data from Hacker News

A PostgreSQL Docker container that automatically upgrades your database

github.com

41–50 of 93 posts

Re: A PostgreSQL Docker container that automatically upgrades your database

#41
post #40

This is a very confusing title and project at first glance. It took me a minute to figure out what you’re doing… But just to be clear — the point of this is to migrate an existing Postgres DB from the original version to a newer version? This is about the data volume itself, not automatically upgrading the Postgres binary when a new version is released? So, you’d basically pass a flag that says --migrate-db when star…

It's pretty much answered here: https://news.ycombinator.com/item?id=36747498

The upgrade-of-your-data happens automatically when the container starts, prior to starting the database server.

Re: A PostgreSQL Docker container that automatically upgrades your database

#42
post #40

This is a very confusing title and project at first glance. It took me a minute to figure out what you’re doing… But just to be clear — the point of this is to migrate an existing Postgres DB from the original version to a newer version? This is about the data volume itself, not automatically upgrading the Postgres binary when a new version is released? So, you’d basically pass a flag that says --migrate-db when star…

It's pretty much answered here: https://news.ycombinator.com/item?id=36747498 The upgrade-of-your-data happens automatically when the container starts, prior to starting the database server.

Right, but you’re not actually automatically migrating a Postgres 13 program to Postgres 15 in a running container. That was what I first thought when I read the title.

You’re using the work “upgrade” differently than how I normally think about it when talking about version changes. You’re talking about data-on-disk, not just the program version.

(I realize that when talking about Postgres, the two are linked, but that’s not the case for most programs)

Re: A PostgreSQL Docker container that automatically upgrades your database

#43
post #42

Earlier quoted context omitted.

It's pretty much answered here: https://news.ycombinator.com/item?id=36747498 The upgrade-of-your-data happens automatically when the container starts, prior to starting the database server.

Right, but you’re not actually automatically migrating a Postgres 13 program to Postgres 15 in a running container. That was what I first thought when I read the title. You’re using the work “upgrade” differently than how I normally think about it when talking about version changes. You’re talking about data-on-disk, not just the program version. (I realize that when talking about Postgres, the two are linked, but th…

Is there better wording that's concise?

I'm just going with what I thought of, but am happy to adjust things as makes sense. :)

Re: A PostgreSQL Docker container that automatically upgrades your database

#44

Neat :) I personally feel like upgrading a database should be an explicit admin process, and isn't something I want my db container entrypoint automagically handling.

Yeah, a lot of the time I'd agree with you. :) This container came about for the Redash project ( https://github.com/getredash/redash ), which had been stuck on PostgreSQL 9.5 (!) for years. Moving to a newer PostgreSQL version is easy enough for new installations, but deploying that kind of change to an existing userbase isn't so pretty. For people familiar with the command line, PostgreSQL, and Docker then its no b…

[deleted]

Re: A PostgreSQL Docker container that automatically upgrades your database

#45
That's great.

We have been maintaining a manual migration script for our docker users for the DB part, while the app part does migrations automatically already (Django), so making the db part more built-in makes a lot of sense.

Our case doesn't really need live/fully auto, just an easy mode for admins during upgrade cycles, and our scripts were pretty generic, so a project like this makes a lot of sense. There are a few modes we support - local / same-server, cross-node, etc - so am curious.

Re: A PostgreSQL Docker container that automatically upgrades your database

#46

This looks useful. I've had issues in the past with PostgreSQL as a backend for NextCloud (all running in docker) and blindly pulling the latest PostgreSQL and then wondering why it didn't work when the major version jumped. (It's easy enough to fix once you figure out why it's not running - just do a manual export from the previous version and import the data into the newer version). However, does this container aut…

> However, does this container automatically backup the data before upgrading ... Nope. This container is the official Docker Postgres 15.3-alpine3.18 image + the older versions of PostgreSQL compiled into it and some pg_upgrade scripting added to the docker entrypoint script to run the upgrade before starting PostgreSQL. It goes out of it's way to use the "--link" option when running pg_upgrade, to upgrade in-place…

I think following MariaDBs lead is a good idea, thru have an environment variable to enable automatic upgrades, and it creates a backup before every upgrade. Works like a charm.

Re: A PostgreSQL Docker container that automatically upgrades your database

#47
post #42

Earlier quoted context omitted.

Right, but you’re not actually automatically migrating a Postgres 13 program to Postgres 15 in a running container. That was what I first thought when I read the title. You’re using the work “upgrade” differently than how I normally think about it when talking about version changes. You’re talking about data-on-disk, not just the program version. (I realize that when talking about Postgres, the two are linked, but th…

Is there better wording that's concise? I'm just going with what I thought of, but am happy to adjust things as makes sense. :)

[deleted]

Re: A PostgreSQL Docker container that automatically upgrades your database

#48
post #40

This is a very confusing title and project at first glance. It took me a minute to figure out what you’re doing… But just to be clear — the point of this is to migrate an existing Postgres DB from the original version to a newer version? This is about the data volume itself, not automatically upgrading the Postgres binary when a new version is released? So, you’d basically pass a flag that says --migrate-db when star…

Postgres docs do use the word upgrade, for example:

> pg_upgrade (formerly called pg_migrator) allows data stored in PostgreSQL data files to be upgraded to a later PostgreSQL major version without the data dump/restore typically required for major version upgrades

https://www.postgresql.org/docs/current/pgupgrade.html

Re: A PostgreSQL Docker container that automatically upgrades your database

#49

Earlier quoted context omitted.

> However, does this container automatically backup the data before upgrading ... Nope. This container is the official Docker Postgres 15.3-alpine3.18 image + the older versions of PostgreSQL compiled into it and some pg_upgrade scripting added to the docker entrypoint script to run the upgrade before starting PostgreSQL. It goes out of it's way to use the "--link" option when running pg_upgrade, to upgrade in-place…

I think following MariaDBs lead is a good idea, thru have an environment variable to enable automatic upgrades, and it creates a backup before every upgrade. Works like a charm.

Any idea how well it works with multi-TB databases?

Copying TBs of data around seems like it would delay the start of the database by a lot.

Post reply on HN