The current version of GitLab-CE is 15.11.9.
Is there any problem if I run sudo gitlab-ctl pg-upgrade?
The current PostgreSQL version is displayed as “PostgreSQL (main)12.14”.
I am looking for a way to address the following error message
gitlab preinstall: Your version of PostgreSQL is no longer supported. Please upgrade your PostgreSQL version to 13.
gitlab preinstall: Check https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server for details.
gitlab preinstall: Please upgrade your PostgreSQL version to 13.
Retry the upgrade after upgrading your PostgreSQL version.
Error: %pre(gitlab-ce-16.0.0-ce.0.el7.x86_64) scriptlet failed, exit status 1
No it isn’t. The current version is 16.1.1.
15.11.9 is not even the latest in the 15.11 series - that would be 15.11.10.
I think you mean that the version you’re currently running is 15.11.9.
There shouldn’t be.
It’s well documented that GitLab version 16 requires at least PostgreSQL version 13 (there are plenty of positive reports of using PostgreSQL 14).
I assume you encounter that error when trying to upgrade GitLab, (I can’t see any other reasonable ways to do so, and that’s why I have that guess on what your first sentence means).
Then upgrade PostgreSQL using the command that you seem to know (as you mentioned it above). You basically have no other choice, but as before any other major change, you should make sure you have a working backup, and knowledge of how to restore it.
However, I still get an error when upgrading to 16.0.6. I will try to implement the PostgreSQL upgrade.
Am I correct that I should run the following command?
$ date;sudo yum install gitlab-ce-16.0.6-ce.0.el7.x86_64;date
(Omit)
Resolving dependencies
→ Running transaction check
—> Package gitlab-ce.x86_64 0:15.11.10-ce.0.el7 will be updated
—> Package gitlab-ce.x86_64 0:16.0.6-ce.0.el7 will be an update
→ Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
Updating:
gitlab-ce x86_64 16.0.6-ce.0.el7 gitlab_gitlab-ce 1.2 G
Transaction Summary
Upgrade 1 Package
Total download size: 1.2 G
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for gitlab_gitlab-ce
gitlab-ce-16.0.6-ce.0.el7.x86_64.rpm | 1.2 GB 00:20
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
gitlab preinstall:
gitlab preinstall: Your version of PostgreSQL is no longer supported. Please upgrade your PostgreSQL version to 13.
gitlab preinstall: Check Database settings | GitLab for details.
gitlab preinstall:
gitlab preinstall: Upgrade failed. Retry the upgrade after upgrading your PostgreSQL version.
error: %pre(gitlab-ce-16.0.6-ce.0.el7.x86_64) scriptlet failed, exit status 1
Error in PREIN scriptlet in rpm package gitlab-ce-16.0.6-ce.0.el7.x86_64
Verifying : gitlab-ce-16.0.6-ce.0.el7.x86_64 1/2
gitlab-ce-15.11.10-ce.0.el7.x86_64 was supposed to be removed but is not!
Verifying : gitlab-ce-15.11.10-ce.0.el7.x86_64 2/2
Normally postgres upgrades should happen automatically when they are required in Gitlab. Do you happen to have a file that exists like below:
/etc/gitlab/disable-postgresql-upgrade
if that file exists in /etc/gitlab then perhaps you need to remove it. That should only stop automatic postgres upgrades though. Manual ones should still work when you use the command that @grove confirmed is the correct one to use.
Thank you all. Appreciated.
I could not find the following file.
/etc/gitlab/disable-postgresql-upgrade
$ ls /etc/gitlab/
gitlab-secrets.json gitlab.rb skip-auto-migrations skip-auto-reconfigure trusted-certs
However, I was able to upgrade PostgreSQL using the commands I was given. Thanks everyone. I will try again later to upgrade GitLab.
(It took about two minutes in our environment.)
$ sudo gitlab-ctl pg-upgrade
Checking for an omnibus managed postgresql: OK
Checking if postgresql['version'] is set: OK
Checking if we already upgraded: NOT OK
Checking for a newer version of PostgreSQL to install
Upgrading PostgreSQL to 13.11
(Omit)
Toggling services: OK
==== Upgrade has completed ====
Please verify everything is working and run the following if so
sudo rm -rf /var/opt/gitlab/postgresql/data.12
sudo rm -f /var/opt/gitlab/postgresql-version.old
Also @iwalker
Neither its using patroni or geo. Its also not having any postgresql version pinned in gitlab.rb. But when I upgrade my Gitlab server from 15.9.7 to 15.11.13 the postgresql version doesn’t go from 12.12 to 13 automatically. Its just going to 12.14. What could be the reason for this? I also have another instance with similar configuration but there the postgresql version moves to 13.11. Im not sure why this is happening. Could you please help? Thanks.
There were two environments, one where postgresql was automatically upgraded with the Gitlab upgrade, and the other where postgresql was upgraded by executing a command. I looked into the differences between the environments, but I too could not figure out why.
That’s right. In the test environment, PostgreSQL was upgraded along with the GitLab upgrade.
Then we did a GitLab upgrade in the production environment.
At that time, an error occurred depending on the PostgreSQL version.
I did not know the cause, but I upgraded PostgreSQL separately.
Hi @iwalker,
I have seen the document for the PostgreSQL versions shipped with Omnibus Gitlab. But on one of the instance where the PostgreSQL version was on 12.12 in Gitlab 15.9.7 it moved to 13.11 when I upgraded to Gitlab 15.11.13. I was confused as to why is this happening.