Upgrade a very old gitlab database

I have a very old gitlab database.
I install a new ubuntu lxc (20.04) and install current gitlab
When running gitlab-ctl reconfigure, I have this message in log file:
gitlab-ctl reconfigure
rake aborted!
Your current database version is too old to be migrated. You should upgrade to GitLab 11.11.0 before moving to this version.
So, I try to install version 11.11.0
apt-get install gitlab-ce=11.11.0-ce.0
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Version ‘11.11.0-ce.0’ for ‘gitlab-ce’ was not found
So, It seems that this version is not more available.
How to migrate my old database ?
thanks for your tips

11.11.2 should work too, it is listed in gitlab/gitlab-ce - Results in gitlab/gitlab-ce (Page 146)

As far as I can see on (one of) our GitLab server(s) that also run on Ubuntu 20.04, the oldest available GitLab there is 13.2.0, so @dnsmichi 's advice is probably worthless.

You don’t say what “very old” means (but as gitlab-ctl says you need to go to 11.11 first, I’m guessing it means 11.x (for x < 11)), but caring only about the database doesn’t help, you have to upgrade GitLab in full. Search the website for recommended upgrade paths.

As we also have a GitLab server running on Ubuntu 18.04, I have just verified that that contains GitLab versions back to 10.7.0, I guess that might be usable as an intermediary platform if you can’t get high enough in GitLab versions (i.e. above 13.2) on the old server. Actually it might be used in production until sometime next year when security support for that runs out.

There are two ways to go around this.

  1. Install Ubuntu 18.04 temporarily somewhere and install the 11.11.0 version and try the restore. Upgrade after this as far as you can go on Ubuntu 18.04. Then install the same version as what is on Ubuntu 18.04 on your Ubuntu 20.04 server. Take the backup from the 18.04 server, and restore it on the Ubuntu 20.04 server. As has been said, follow the upgrade path in the upgrade docs, else it will break.

  2. Download the deb packages manually and install 11.11.0 on Ubuntu 20.04, then restore your backup and then upgrade following the upgrade path. This may or may not work, especially if the earlier versions if Gitlab are searching for a particular dependency version that doesn’t exist in Ubuntu 20.04. IN which case step 1 would be preferred.

You can only restore a backup to the exact same version that the backup was taken. It cannot be restored to an earlier/later version of Gitlab. Therefore if the backup was taken on version 11.11.0 then it must be restored to this version. If it was earlier, then you will need to install an earlier version, and then upgrade.

Thanks, I was too tired yesterday. I missed that it is Ubuntu 20 which too new. @jmax disregard my recommendation above, sorry.

I see that the question says

I install a new ubuntu lxc (20.04)

LXC are containers, does GitLab run inside an LXC container, or is it installed on the Ubuntu host itself via Omnibus packages? Please share the installation steps for GitLab on this new host for better recommendations :slight_smile:

I think he prob meant LTS :slight_smile:

It’s quite possible that @iwalker is right.

I don’t know if you can use LXC to setup some more lightweight containers, but you can easily use LXC to setup a virtual server. Our GitLab servers actually run on Ubuntu in LXC virtual servers - with the Omnibus package.

1 Like

My database postgresql is on another server.
With a new 18.04 LTS based on lxc, I try theses steps
|1| cd /tmp
|2| apt-get install curl
|3| curl -LO https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh
|4| bash /tmp/script.deb.sh
|5| apt install gitlab-ce

root@ubuntu_gitlab18:/tmp# cat /etc/issue
Ubuntu 18.04.6 LTS \n \l

root@ubuntu_gitlab18:/tmp# dpkg -l | grep gitlab
ii gitlab-ce 14.10.2-ce.0 amd64 GitLab Community Edition (including NGINX, Postgres, Redis)

Too new :frowning:

No success with this link: https://packages.gitlab.com/app/gitlab/gitlab-ce/search?q=gitlab-ce-11&filter=all&filter=all&dist=ubuntu

You needed an underscore between ce and 11.

also, using the script you will always get the latest release when providing just gitlab-ce as the package name, to install a specific version:

apt-get install gitlab-ce=11.11.0-ce.0

or change the version number accordingly. This is what you will need to use to go through the upgrade path, using a upgrade command similar to above substituting each version on the upgrade path up until the latest. Also make sure all background migrations have completed before starting the next upgrade on the upgrade path. This is also explained in the upgrade docs.

@grove I might just have to try that. LXC was a predecessor to Docker in some ways, and similar to things I did with OpenVZ (although that required a specific kernel to be installed for it to work). Wasn’t referred to as containers back then like 14 years ago when I used that.

Thanks for the correct link.
Migration to ce 11.10 is now OK :slight_smile:

So, I try a migration from 11.10 to 14.10.2 and it fails:
StandardError: An error has occurred, this and all later migrations canceled:

PG::DuplicateTable: ERROR: relation “abuse_reports” already exists

dpkg -l | grep gitlab
ii gitlab-ce 14.10.2-ce.0 amd64 GitLab Community Edition (including NGINX, Postgres, Redis)

1 Like

You are not following the upgrade path, you cannot go direct from 11.10 to 14.10.2.

in fact in addition to that between 14.0.x and 14.9.x you should do 14.1.0, 14.2.0, 14.3.0, 14.4.0, 14.5.0 and so on to reduce the amount of problems. And again, on the link I posted, look at the background migrations section and make sure you check this before each upgrade to make sure they have finished before continuing.

Not only that postgresql will need to be also upgraded since you said that was separate and installed running somewhere else.

you will need to look at that document to ensure your postgresql version is supported before attempting the next upgrades.

I suggest before you continue any further and totally break your database and have to restore it, read all the Gitlab documentation related to upgrades. Also read up about doing postgresql database upgrades for the system that you have it installed on. Don’t attempt upgrades without reading what to do, you will only break it and if no backups, lose everything.

3 Likes

The “container” term is also newer than when I started working with that stuff.

I’ve used vserver (you had to be careful when searching for that, not to find the HA solution) more than OpenVZ, that also required a kernel patch.

Thanks for the correct link.
Migration to ce 11.10 is now OK