tianon / docker-postgres-upgrade

a PoC for using "pg_upgrade" inside Docker -- learn from it, adapt it for your needs; don't expect it to work as-is!
https://hub.docker.com/r/tianon/postgres-upgrade/
MIT License
1.09k stars 116 forks source link

Postgis support #104

Open jperelli opened 2 months ago

jperelli commented 2 months ago

There's an error when trying to upgrade and postgis is installed, I've found the following workaround

docker run -ti --rm -v ./.volumes/db:/var/lib/postgresql --entrypoint="" tianon/postgres-upgrade:14-to-16 bash
root@7acd0925d768:/var/lib/postgresql# apt update && apt install postgresql-14-postgis-3 postgresql-16-postgis-3
[...]
root@7acd0925d768:/var/lib/postgresql# docker-upgrade pg_upgrade

But I was thinking if there's something that can be added as an option when running the image, maybe the entrypoint could have extra packages names as an argument and install them before running, for example

docker run -ti --rm -v ./.volumes/db:/var/lib/postgresql tianon/postgres-upgrade:14-to-16 --packages=postgresql-14-postgis-3,postgresql-16-postgis-3

and that just runs apt update && apt install postgresql-14-postgis-3 postgresql-16-postgis-3 before the upgrade

tianon commented 2 months ago

See https://github.com/tianon/docker-postgres-upgrade/discussions/51