Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to PostgreSQL 12.x #826

Open
Saijin-Naib opened this issue Feb 27, 2020 · 10 comments
Open

Upgrade to PostgreSQL 12.x #826

Saijin-Naib opened this issue Feb 27, 2020 · 10 comments

Comments

@Saijin-Naib
Copy link
Contributor

Similar to the move to Python3 and possibly to latest LTS (20.04), PostgreSQL 9.x is deprecated above 16.04 LTS and is replaced by PostgreSQL 10.x on 18.04.3 and 12.x on 20.04.

18.04.3:
https://packages.ubuntu.com/bionic/database/postgresql

20.04:
https://packages.ubuntu.com/focal/database/postgresql

@pierotofy pierotofy transferred this issue from OpenDroneMap/ODM Feb 27, 2020
@Saijin-Naib
Copy link
Contributor Author

Thanks again, Piero. I still don't understand what dependencies are for each component only 🤣

Of course, we might be able to avoid the whole PGSQL upgrade dance with OGC GeoPackage ;)
https://community.opendronemap.org/t/ogc-geopackage-for-data-storage-back-end/3650?u=saijin_naib

@ghost
Copy link

ghost commented Oct 11, 2022

@pierotofy I figured I would take a stab at this, since 9 is SUPER old... any reason we are using our own dockerfile vs using a base postgis image like postgis/postgis:14-3.3 and throwing in scripts in the init.db folders??

Switching to a base image should make it a lot easier to upgrade versions

@pierotofy
Copy link
Member

pierotofy commented Oct 12, 2022

We use our own (compiled from source) version of postgres/postgis, because they don't publish 9.x releases on docker hub anymore.

The problem with postgres/postgis, using docker, is that there's no easy way to perform a fully automated migration for dozens of thousands of users that are using WebODM via docker.

The (probably) correct way to perform the migration, is to create a new docker image which has the newer postgres/postgis version and perform the migration on startup. The procedure is messy, as postgres does not offer an automated way to do this. So it's going to be a bit tricky.

In the meanwhile, Postgres 9.x continues to work just fine (aside from being old, we haven't had a good reason to migrate).

We'd welcome help to do this, but note that simply updating to 12.x is not sufficient, the migration of existing data volumes from 9.x --> 12.x is also needed, and needs to be fully automated (work via ./webodm.sh update for all platforms).

@ghost
Copy link

ghost commented Oct 12, 2022

That makes sense. I will start working on the migration scripts first then

@ghost
Copy link

ghost commented Oct 13, 2022

https://www.cloudytuts.com/tutorials/docker/how-to-upgrade-postgresql-in-docker-and-kubernetes/

Seems pretty straight forward. So I'm thinking we add a upgrade_db option to webodm.sh. That will do a docker compose up to a new file docker-compose.upgrade_db.yml. This will stand up the new database. Then it will run the pg_dumpall on the old database. Then we will push the dump file into the new databse. Finally we will stop the old one. Since the base docker-compose would already have been "updated" it will work correctly going forward.

I am sure I'm missing some steps here. But that's where I will be starting

@smathermather
Copy link
Contributor

Sounds great. I've got a server with lots of projects in it and the ability to snapshot it at the VM level, so I'd be happy to be a victim volunteer for testing.

@pierotofy
Copy link
Member

pierotofy commented Oct 13, 2022

The issue with the proposed approach is that it's not automated; it requires user intervention. Please bear in mind that for us technical folks using the command line this is not a problem, but there are lots of people that have installed WebODM via the installers from https://opendronemap.org/webodm/download/, and this approach is going to break their installation and does not provide a path for them to upgrade.

@ghost
Copy link

ghost commented Oct 13, 2022 via email

@ghost
Copy link

ghost commented Oct 14, 2022

Ok so I'm moving over to the pull request I'm about to make. It's nowhere NEAR ready, but it's a start, and since I'm still very green with the codebase I will still need some hand holding! But running the commands by hand dumped and pushed the data from 9.6 to 14!

@NtskwK
Copy link
Contributor

NtskwK commented Sep 8, 2024

We use our own (compiled from source) version of postgres/postgis, because they don't publish 9.x releases on docker hub anymore.

The problem with postgres/postgis, using docker, is that there's no easy way to perform a fully automated migration for dozens of thousands of users that are using WebODM via docker.

The (probably) correct way to perform the migration, is to create a new docker image which has the newer postgres/postgis version and perform the migration on startup. The procedure is messy, as postgres does not offer an automated way to do this. So it's going to be a bit tricky.

In the meanwhile, Postgres 9.x continues to work just fine (aside from being old, we haven't had a good reason to migrate).

We'd welcome help to do this, but note that simply updating to 12.x is not sufficient, the migration of existing data volumes from 9.x --> 12.x is also needed, and needs to be fully automated (work via ./webodm.sh update for all platforms).

The version of PostgreSQL was been writen in $PGDATA/pg_hba.conf, we can use it to determine if we need to upgrade. Then, pg_upgrade can help us with data volume migration. There is a problem with live update functions. pg_upgrade can only be used when both database servers are stopped using. New servers can be stopped, but old cannot be stopped while webodm is running with it or webodm is running without database util new one has been launched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants