Menu Close

Page 2 of 61

Restoring Gitlab from its own backups is a pain, but it's possible!

Gitlab helpfully lets you know it’s making backups of the database each time it does an upgrade, but trying to find information on where those files are stored by default on the web is an exercise in futility. Most links lead to Gitlab themselves and they sure as hell aren’t telling you.

Well I hope to help someone else (and possibly myself in the future) by listing a few useful ones here.

Step 1: Needed files

To restore from a boot / OS failure, or after a fresh install, you’ll need the following files:

  • /etc/gitlab/gitlab.rb
  • /etc/gitlab/gitlab-secrets.json
  • the entire /var/opt/gitlab/git-data folder
  • the file you want from /var/opt/gitlab/backups
  • install the exact same version of gitlab you were previously running before the failure

So hopefully you were able to rescue those files as they contain your settings, secrets, the db backup and the repositories themselves.

Step 2: Install Gitlab

Having gathered all of these things, you’ll need to first install the relevant version of Gitlab. I needed the version before current so the command in Xubuntu (using apt) is:

sudo apt install gitlab-ce=12.5.3-ce.0

12.5.3 is the version the restore process told me I needed. The -ce.0 part is important if you’re using gitlab-ce.

If you’ve already installed a prior version before coming here, you can look at the output of that command for clues on how to get it to continue despite you already having a database.

Step 3: Restore the database

Now copy the backup files from where you have them into /var/opt/gitlab/backups:

sudo cp -R <source folder goes here> /var/opt/gitlab/backups/

Now that you have the right version installed, you can restore the backup. Make sure you set the permissions on /var/opt/gitlab/backups so the user git can access it.

# Allow the git user to access the backups
sudo chown -R git:git /var/opt/gitlab/backups

# List the backups to see what we can restore!
sudo ls -alF /var/opt/gitlab/backups

You should get a listing of the different backups that were made. Usually you’ll want to pick the most recent one, which will be listed last.

Next you type in the command to actually restore the backup database. My backup file was 1576180022_2019_12_12_12.5.3_gitlab_backup.tar

We need to take the _gitlab_backup.tar part off of the end and use that as our file to restore:

sudo gitlab-backup restore BACKUP=1576180022_2019_12_12_12.5.3

If you have any problems, the fix is usually in the error output. You may run into an issue if you have the wrong version installed. Go back to Step 2: Installing Gitlab and fetch the version it tells you to.

Step 4: Restore the repositories

After the db is restored, you may still need to copy the repositories over too. Those are located in the /var/opt/gitlab/git-data folder.

sudo cp -R <source folder goes here> /var/opt/gitlab/git-data/

# Allow Gitlab to access the files
sudo chown git:git /var/opt/gitlab/git-data/

I’ve had some luck simply copying them over but sometimes that doesn’t work. So you may need to import those repositories manually. That fix is outside the scope of this short how-to, but keep at it and you’ll get things back up and running in no time!

Vlog Thursday – Christmas!

Today I’m talking about that little bit of fun we had as kids approaching Christmas. Posting on Vimeo this time because there’s a bit of a “strike” this week happening on YouTube.

Vlog Thursday – Goals!

Today’s vlog is about my HRT progress, finishing old projects, and learning new things!

Vlog Thursday – a good SAD

Talking about my short time on Estradot, and Seasonal Affective Disorder

Vlog Thursday – “transactional” friendship

Are you having problems understanding basic human decency? Do you go on Twitter to complain about made up things like how, “people treat friendships as transactional these days”?

Don’t go on reddit to post that AITA article, because I have the answer! Just watch this video!

Honestly, I don’t get why this is so hard.

People have a set amount of energy to go about their day.

Some people have a history of ALWAYS being the one to support others. Sometimes with no help for their own issues.

Some of these people even have friends who don’t ask them how they’re doing or anything and just assault them with a barrage of all the bad things happening in the world without even asking if it’s okay.

That can take a lot out of you. That takes a very real toll on the person who does all the listening. Sometimes it IS INDEED TOO MUCH.

So when people say emotional labour in an interpersonal context:

  1. That IS INDEED A VALID USE OF THE TERM, GO LOOK IT UP
  2. That is a very real and valid concern and you shouldn’t dismiss it

People use up their emotional energy throughout the day and sometimes trying to help someone else out when you are low on spoons yourself is no help at all, worse yet you put yourself into a bad spot!

Please, please, please respect people and understand that sometimes being supportive and respectful to your friends includes having to tell them when it’s not a good time to vent.

Thank-you for coming to my TED talk.

© 2020 Welcome to My World. All rights reserved.

Theme by Anders Norén.