Hi,
I am trying to upgrade the GitLab version from 12.10 to 15.8 latest one directly, For this, I am trying to dump users’ data, How can we dump user data from database.
You can’t do that upgrade directly. Several migrations (of repository data and user data) have happened between those versions.
If you don’t mean an upgrade but a replacement with import of every project and (manual) creation of all users, that should be possible (but depending on how many users and projects you have, might be quite a lot of work), but then you need to tell us if you have an omnibus installation or have installed from source. I guess you can use /opt/gitlab/embedded/bin/pg_dump
, but the path might be different, and you’ll have to set stuff up.
When I try to import gitlab groups from old to new then I get an SSL error exception. In my old GitLab, we enable SSL. So for this reason I cannot import groups or projects in the new GitLab. Could you suggest to me how I can resolve this.
It’s still not clear what you’re actually doing. Be specific about what you:
- have
- do
- expect
- actually experience
But SSL doesn’t play a role on the level where groups/projects reside. i.e. the group/project doesn’t know it was/is on a server where SSL was/is enabled. So I can’t imagine that causing a problem when importing.
FYI…
Gitlab 12.10 ( Existing Live Server ) & Gitlab 15.8 ( Newly created Test server ) both versions are not EE.
Note : Both versions ( 12.10 & 15.8 ) are installed in different servers thru omnibus installation.
Problem :
It’s tough to update the version from 12.10 to 15.8 version on the live server itself based on the no of steps and time.
Solution :
We thought to use Test Server with the options, below :
One option :
We tried to copy users and groups of a specific repo ( Of the 12.10 version Server ) to the 15.8 version Server
Ref Url: Group import/export API | GitLab
Export was successful using the command :
curl --request POST --header “PRIVATE-TOKEN: REDACTED” “https://gitlab.test.com/api/v4/groups/4/export” -k
group=4
token=REDACTED
curl --request GET --header “PRIVATE-TOKEN: ${token}” --output download_group_${group}.tar.gz “https://gitlab.test.com/api/v4/groups/${group}/export/download” -k
But getting errors at Import.
curl --request POST --header “PRIVATE-TOKEN: REDACTED” --form “name=testgrp” --form “path=testgrp” --form “file=@/tmp/download_group_4.tar.gz” “https://gitlab.test.com/api/v4/groups/import” --cert /tmp/mycert.pem
Other Option :
We are trying to see if we can copy users and groups from DB of a specific Repo ( related to the 12.10 version Server ) to the 15.8 version Server after creating the same repo in the new server. Not exactly sure about it.
Please suggest the best solution for us.
I upgraded once from 12.9.x to 14.x going through 80 upgrades at the time doing all point releases between these versions (all 12.9.x, all 12.10.x, all 13.0.x, all 13.1.x) as I was unsure of the upgrade path. Now that the upgrade path is clear, it shouldn’t take a huge amount of time to do it. So you can do your production server like I did. Those 80 upgrades took me 2-3 days. Gitlab was still usable during this time albeit the 5-10 mins break in access when the upgrade was taking place.
Obviously you have to wait for all background migrations to complete before you start the next upgrade on the upgrade path. You can test this on your test server, but you would need to install the same version as your production server, restore a backup to it along with gitlab.rb and gitlab-secrets.json, and then you’ll be good to go to test the upgrade procedure to ensure it works.
As for the method you are wanting to attempt, I don’t have experience of so cannot help with that, but I believe bulk import/export was deprecated in later versions. Although I could be wrong, but I believe that’s what it says in the documentation and version release notes.
First of all: Make sure you have a usable backup!
I also think a couple of days of doing the upgrades one-by-one (what @iwalker means by
is (probably - I haven’t asked him, but based on other threads here he knows) that you don’t have to go through all the point releases but only all the minor versions, it will probably be faster than finding and going through all the hoops you encounter on the other path.
And before every upgrade you should wait for background migrations to finish before you continue.
Note: Technically, you don’t even have to go through all the minor versions, the documentation contains an upgrade path that lists the versions you have to go through. But as it sounds like this is a production server that people depend on, I would probably configure the server for what the documentation calls “zero downtime” (they don’t actually give zero downtime, just a major reduction) and then you have to go through every minor version.
On the method you’re trying: You should be more careful with what you’re posting, your token should probably not be here, it’s not worth much without knowledge of the url of your server, but a (former) employee of the company probably knows that and might see this post (and use your name to correlate the information).
You should also be more careful with formatting, it’s hard to read your commands, and figure out what is what.
It’s pretty worthless to us that you say you get errors on import when you don’t show those errors.
I’ve never done export+import of groups, so I have no idea how to use that for anything - but as I have recommended a different approach above it might not matter that much.
Thanks for the note about tokens, I have edited the post and replaced the token value with REDACTED
.
Formatting tips can be found in https://forum.gitlab.com/t/community-first-steps-code-config-log-block-formatting-in-topics-and-replies/
When I try to import gitlab groups from old to new then I get an SSL error exception. In my old GitLab, we enable SSL. So for this reason I cannot import groups or projects in the new GitLab. Could you suggest to me how I can resolve this.
Please show the exact error message you are seeing on the terminal/UI when running the import commands. This will help make better suggestions on how to proceed (i.e. when it is a self-signed certificate on the new server, let Lets Encrypt obtain a new TLS certificate for the domain first).
We tried to copy users and groups of a specific repo
What is the expected state, and which numbers are we talking about for
- Users
- Groups
- Project repositories
If the environment is too huge, or if there are many customizations, a possible alternative would be a stretched migration plan to not block production longer than needed.
- Monthly maintenance window from 12.x to 13.x
- Monthly maintenance window for 13.x to 14.x
- Monthly maintenance window from 14.x to 15.x
We want to move the repos from the existing Production Server ( 12.10 ) to New Production Server ( 15.8 ) as we plan also to change OS to Amazon Linux from CentOS.
Testing Steps :
As of now Test Server is installed with Amazon Linux 2 OS and the Latest gitlab version (15.8 ).
To make it simple we want to move the users after the manual creation of the project and cloning the repo data,
w.r.t Url: https://docs.gitlab.com/ee/api/group_import_export.html
Reason: To avoid the manual creation of users for each and every repository.
Based on the comment :
Please show the exact error message you are seeing on the terminal/UI when running the import commands. This will help make better suggestions on how to proceed (i.e. when it is a self-signed certificate on the new server, let Lets Encrypt obtain a new TLS certificate for the domain first
Error Details:
From Existing Gitlab command line:
Command: curl --request POST --header "PRIVATE-TOKEN: {Token}" --form "name=testgrp" --form "path=testgrp" --form "file=@/tmp/download_group_4.tar.gz" "https://gitlab.production.com/api/v4/groups/import" --cert /tmp/mycert.pem
Error: curl: (58) unable to set private key file: '/tmp/mycert.pem' type PEM
From New gitlab Console:
Path: New gitlab ---> groups --> import group --> Tried with Host-Ip/Domain-Name, Access Token Below is the output.
IP Based: 192.xx.xx.xx with Access Token
Specified URL cannot be used: "Requests to the local network are not allowed"
Domain Based: gitlab.production.com with Access Token
Unable to connect to server: SSL_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate)
`````
The formatting is still bad. Try to do better!
This time it is hard to read because you’ve formatted a lot of the plain text as code, and it’s not even done to all your text, but also to the quote of @dnsmichi .
The error you’re getting is from curl
, not GitLab, it doesn’t even execute the import. I have no experience in using curl with client certs as you’re doing, but you didn’t specify a client cert to the export, so you might not need it at all?
I have no experience with either Amazon Linux or CentOS, but if it is possible: decouple that switch from the upgrade, you seem to have enough challenges as it is.
When you have a production server running a new version of GitLab you can switch to another distro with the usual backup+restore method (the two servers have to run the same version for that to be a possibility.