简体   繁体   中英

How to make backup of gitlab without running?

I've used gitlab omnibus installation version but my PC had broken so couldn't boot my PC now. So I couldn't run gitlab and have to make the backup from this condition. From Gitlab documentation, there is a description how to make a backup on gitlab running state but there isn't any description way to make a backup on not-running state. ( https://docs.gitlab.com/ee/raketasks/backup_restore.html )

The repository is already backuped and what I really want to make a backup is about gitlab support functions (eg issue, merge request and etc) How could do this?

If possible, you would need to backup the data mounted by your GitLab omnibus image, and copy that data on a working PC, in order to run GitLab there.

Once you have a running GitLab on a new workstation, you can make a backup there.

This is my self-answer.

There was no way to backup without running gitlab because all of database data is related on progresql.

So I've installed another gitlab in docker on my PC and attached all of things to it.(config, repositories, database data)

Below is What I did

  1. install gitlab on docker (MUST install specific version matched with original version) https://docs.gitlab.com/omnibus/docker/

  2. modify docker run script to connect your original data to gitlab in docker.

    eg)

    sudo docker run --detach \\ --hostname gitlab.example.com \\ --publish 443:443 --publish 80:80 --publish 22:22 \\ --name gitlab \\ --restart always \\ --volume [USER_DIR]/gitlab/config:/etc/gitlab \\ --volume [USER_DIR]/gitlab/logs:/var/log/gitlab \\ --volume [USER_DIR]/gitlab/data:/var/opt/gitlab \\ gitlab/gitlab-ce:latest

  3. run gitlab in docker

  4. run backup in docker through omnibus package installed backup method https://docs.gitlab.com/ee/raketasks/backup_restore.html#restore-for-omnibus-installations

    eg)

    docker exec -t gitlab-rake gitlab:backup:create

  5. After done backup, find your backup file which specified in your

    eg) [USER_DIR]/etc/gitlab/gitlab.rb

I don't agree with all of your conclusions even if it holds as a solution. It all depends on your setup, and if you have all data on the same machine it is a setup with room for improvements.

My own setup provide both external PostgreSQL 9.x and Redis 5.x servers. The benefit with external servers and docker make it possible to backup / restore using only external servers and root access to a docker volume on a docker host. This solution involves less steps since DBs are external.

I have done this a number of times and it works, but should only be used if you know what you're doing. Some parts is same as you discovered, like reinstall the same version etc.

I just wanted to point out that more than one solution exist for this problem. However, one thing that would be more beneficial is if the Gitlab team focused on PostgreSQL 11.x compatibility as opposed to only 10.x compatibility. I have already tested 11.x successfully in a build from sources, but waiting for a release by the Gitlab Team.

I am happy you made it work!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM