Recently tried to upgrade my GitLab instance. I’m not actually sure what version I was previously running but it was probably from 2020. I’m using the Apt repository and the gitlab-ce packages on Debian Bookworm.
Recipe: gitlab::database_migrations
* ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
* rails_migration[gitlab-rails] action run[2023-07-15T11:50:17+01:00] WARN: gitlab-rails does not have a log_group or default logdir mode defined. Setting to 0700.
* bash_hide_env[migrate gitlab-rails database] action run
[execute] rake aborted!
ActiveRecord::ConnectionNotEstablished: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
I tried deleting runtime.conf and having reconfigure recreate it, but it continues to create a file with the bad ‘wal_keep_segments’ parameter. PostgreSQL version seems to be 13:
# not using docker
gitlab-ctl pg-upgrade -V 13
# using docker at your compose location
docker compose exec -it <service-name> gitlab-ctl pg-upgrade -V 13
Maybe you need to move or remove a folder called data-13 but command response will guide you.
From 2020 you are maybe using gitlab v13 and you may need to upgrade to postgresql 12, upgrade gitlab until postgresql 13 compatible version and then upgrade to postgresql 13.
Thanks for the idea @hardenerdev. When I try this unfortunately I get the error message:
$ sudo gitlab-ctl pg-upgrade -V 13
/opt/gitlab/embedded/service/omnibus-ctl/lib/gitlab_ctl/util.rb:50:in `parse_json_file': Attributes not found in /opt/gitlab/embedded/nodes/my.gitlab.server.net.json, has reconfigure been run yet? (GitlabCtl::Errors::NodeError)
I can’t run reconfigure due to the error mentioned above…
@amoe I’ve been having the same problem. Here’s what I did to resolve: reinstall to the latest version of Gitlab that supports the Postgresql version (in my case, it was the latest version of Gitlab 15), then run gitlab-ctl reconfigure, then run the pg-upgrade command that @hardenerdev provided.