Verified Commit cbc2241a authored by Thomas Citharel's avatar Thomas Citharel 🏃🏻
Browse files

Add FAQ section for PG/PostGIS upgrades


Signed-off-by: Thomas Citharel's avatarThomas Citharel <tcit@tcit.fr>
parent 1e5e73a5
Pipeline #439510 passed with stage
in 26 seconds
......@@ -67,3 +67,30 @@ If you have the following error:
ERROR: [Errno 2] No such file or directory: 'install'
```
It means that you installed the `yarn` from Debian/Ubuntu directly, which provides the `cmdtest` package, which is completely unrelated. Follow the instructions on the [Source install guide](./install/source.md#yarn) to install the proper tool.
## How to upgrade PostgreSQL ?
We use the PostGIS extension to hold the geospatial data. Migrating to a new major PostgreSQL version (with `pg_upgradecluster`) is not supported when there's also a PostGIS upgrade.
For instance migrating from Debian Buster (10) to Bullseye (11) upgrades PostgreSQL from 11 to 13, but also Postgis from 2.5 to 3.1, so you won't be able to perform a simple upgrade.
In this case, it's better to:
* Dump the database (with `pg_dump`) from the old PostgreSQL cluster.
* Stop the old cluster.
* Create and start the new one (if not already done when upgrading the system).
* Create the database, database user back (according to the credentials in your mobilizon configuration).
* Add the extensions back to the database `CREATE EXTENSION extension` (where extension is `postgis`, `pg_trgm` and `unaccent`).
* Import the dump to your new cluster (with `pg_restore`).
!!! warning
If you have other databases that don't use Postgis on the same server, you need to `DROP` the mobilizon database (or any other database that uses Postgis and that you have already dumped), then perform the `pg_upgradecluster` command to migrate these simple databases to the new cluster.
If everything works fine after the upgrade and after making sure you are running on the new cluster, you may drop the old cluster and remove the `postgresql-11` dependencies.
A few links related to this:
* Full tutorial (for 9.6 to 11 upgrade, don't forget to adapt) https://rigacci.org/wiki/doku.php/doc/appunti/linux/sa/postgresql_upgrade
* Debian documentation https://wiki.debian.org/DebianGis/UpdatingPostGIS
* https://www.bostongis.com/blog/index.php?/archives/268-Using-pg_upgrade-to-upgrade-PostGIS-without-installing-an-older-version-of-PostGIS.html
In french 🇫🇷
* https://wiki.fiat-tux.fr/books/administration-syst%C3%A8mes/page/migration-d%E2%80%99une-version-majeure-de-postgresql-%C3%A0-une-autre
* https://oslandia.com/2020/11/05/mettre-a-jour-vos-vieux-clusters-postgis/
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment