Error when restoring in order to upgrade

Hi all,

1st of all, I must admitt I am a totally noob in gitlab.
I made a lot of search and I have an issue.

My devs are using Gitlab on an old Ubuntu 14.04 server
Gitlab is 10.4.1

I want to migrate this one on a centos 7 server, enable https, sso, …

I maybe wanted to do it quickly, so I create my new server and install the latest gitlab-ce version.
I configure all I need and the new server works perfectly.
BUT, I saw (too late, of course) I couldn’t migrate from an older version.
No problem, the documentation explain how to downgrade, so I unistall the gitlab version and install the gitlab-ce-10.4.1-ce.0.el7

But I cannot restore the backup.

when I run the reconfigure I have this error :
Running handlers:
There was an error running gitlab-ctl reconfigure:

bash[migrate gitlab-rails database] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ‘1’
---- Begin output of “bash” “/tmp/chef-script20220624-5712-10wquzf” ----
STDOUT: rake aborted!
PG::ConnectionBad: 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”?
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:49:in block (3 levels) in <top (required)>' /opt/gitlab/embedded/bin/bundle:23:in load’
/opt/gitlab/embedded/bin/bundle:23:in `’
Tasks: TOP => gitlab:db:configure
(See full trace by running task with --trace)
STDERR:
---- End output of “bash” “/tmp/chef-script20220624-5712-10wquzf” ----
Ran “bash” “/tmp/chef-script20220624-5712-10wquzf” returned 1

and when I try to restore the database I have this :
Cleaning the database …
rake aborted!
PG::ConnectionBad: 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”?
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:27:in block (3 levels) in <top (required)>' /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:52:in block (3 levels) in <top (required)>’
/opt/gitlab/embedded/bin/bundle:23:in load' /opt/gitlab/embedded/bin/bundle:23:in
Tasks: TOP => gitlab:db:drop_tables
(See full trace by running task with --trace)

I think the issue is because of the postgres version, but it’s just a thought…

How can I solve this, keep my config and migrate db, then upgrade Gitlab.

If anyone can help me, would be great.

thank you

What were your restore steps? I’m guessing that you just installed Gitlab, and then put the backup file in /var/opt/gitlab/backups and then attempted to restore?

To do this successfully:

  1. Install Gitlab 10.4.1 on CentOS7.
  2. Copy gitlab.rb and gitlab-secrets.json from the old server into /etc/gitlab on the new one.
  3. Run: gitlab-ctl reconfigure to get a basic empty installation using your config files from point 2.
  4. Put your backup file in /var/opt/gitlab/backups.
  5. Follow restore procedure: Back up and restore GitLab | GitLab

The only difference at point 5 is that puma replaced I believe unicorn, so you would need to stop unicorn instead of puma for your old installation. Follow the restore steps from the link I provided.

1 Like

Thank you for your help, I will try to create a new server then install Gitlab 10.4.1 first.

I follow the procedure you linked, I copied the gitlab.rb and gitlab.secrets.json on the new one but I have the error I sent you.

Maybe my mistake is the point you mentionned, I will try to make a new backup from the old server stopping unicorn (I’ve just verified and you’re right, it is unicorn)

I will tell you the results

Thank you again

Either that or you are stopping Gitlab before you attempt the restore. You need to ensure postgresql is running, so maybe you stopped postgres. This is why in the restore docs it only tells you to stop unicorn/puma and sidekiq. If you stop all the services, then it won’t restore. Your error clearly shows postgres is not running.

Thank you a lot for your help
The issue was I did ot stop unicorn…

I had others issues while reconfig but just because symlinks were existing but the dest files did not exist.
I created them and it was OK.

Now I will upgrade Gitlab version, I hope it won’t take too long (either it’s just a test for now, in order to know how long it will take when I will do this in prod)
I saw this link : Upgrading GitLab | GitLab and the specific versions : Upgrading GitLab | GitLab

But if you have warning or specific instruction for me (upgrading steps from 10.4.1 to 15.1.0) because I think there will be a lot of changes, I would be listening

[EDIT] I passed the steps until v 13.0.14 where I’m stucked (for the moment)
I don’t have unicorn launched anymore, he wanted to launch puma but no service exist, it’s like it hasn’t been installed with the package…

I think I solved my issue.
Fortunately I backuped my gitlab.rb after my previous install in 15.1.0.
The guy who made the install of our gitlab server had probably deleted a lot of options so some features wasn’t installed.

I can go further now

2 Likes

Thank you @iwalker for your help, everything worked fine after your advice.

1 Like