How to Upgrade PostgreSQL for gitlab

I was using gitlab 12.3.5-ee and PostgreSQL 9.6.11 for database.
Since we need to upgrade to gitlab 13.0 or above. we also need to upgrade PostgreSQL.
Could you please guide how to upgrade PostgreSQL.

I asked something similar to support a few months ago, because I couldn’t the information either.

There is some information on:
https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server

The impotant command is:

gitlab-ctl pg-upgrade
2 Likes

Thanks @grove! @amit.saurabh32 - let us know if this answers what you need.

If you think this command should be added to the docs, you are both welcome to submit an MR! Let me know if I can help! :blush:

My Postgresql database is on AWS RDS, will this help on for that.

The gitlab-ctl pg-upgrade is only for embedded database. If you are using an external database, you’ll need to upgrade using the functionality in AWS for this. However, you will need to take into account the version of gitlab you are using.

I was using gitlab-ce 12.9.x which was on PostgreSQL 10, which got upgraded to PostgreSQL 11.7 when I went to 12.10.x. As you are on 12.3.x you’ll need to upgrade your gitlab until you’ll get to a stage when you can migrate from PostgreSQL 9.x to 10.x, and then from 10.x to 11.7 when it is supported in 12.10.x. There should be info available in the gitlab docs which cover the gitlab versions and which postgres versions are supported, etc. Since you’ll need to switch to a gitlab version that supports both 9.x and 10.x of postgres before attempting the upgrade of postgres.

The gitlab docs will explain how to do external postgres database upgrades and should also show which version of gitlab support the respective postgres versions and on which version it’s possible to upgrade.

this link will show which versions are available in terms of gitlab version and postgres versions possible to use.

this link shows the upgrade procedure for non-packaged postgres (eg: without pg-upgrade command as it’s separate and not the embedded version). For AWS there will most likely be their (Amazon) procedures to follow for upgrades.

1 Like