简体   繁体   English

如何在不运行的情况下备份gitlab?

[英]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. 我使用了gitlab omnibus安装版本,但是我的电脑坏了,所以现在无法启动我的电脑。 So I couldn't run gitlab and have to make the backup from this condition. 因此,我无法运行gitlab,而不得不从这种情况下进行备份。 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. 从Gitlab文档中,可以找到如何在gitlab运行状态下进行备份的描述,但没有任何描述方式可以在未运行状态下进行备份。 ( https://docs.gitlab.com/ee/raketasks/backup_restore.html ) 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? 该存储库已经备份,我真正想要备份的是有关gitlab支持功能(例如问题,合并请求等)的方法,该怎么办?

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. 如果可能的话,您需要备份由GitLab多功能映像映像装载的数据,并将该数据复制到工作的PC上,以便在那里运行GitLab。

Once you have a running GitLab on a new workstation, you can make a backup there. 在新工作站上运行了GitLab之后,您可以在那里进行备份。

This is my self-answer. 这是我的回答。

There was no way to backup without running gitlab because all of database data is related on progresql. 如果不运行gitlab,则无法进行备份,因为所有数据库数据都与progresql相关。

So I've installed another gitlab in docker on my PC and attached all of things to it.(config, repositories, database data) 因此,我在PC上的docker中安装了另一个gitlab,并将所有内容附加到它上(配置,存储库,数据库数据)

Below is What I did 以下是我所做的

  1. install gitlab on docker (MUST install specific version matched with original version) https://docs.gitlab.com/omnibus/docker/ 在docker上安装gitlab(必须安装与原始版本匹配的特定版本) https://docs.gitlab.com/omnibus/docker/

  2. modify docker run script to connect your original data to gitlab in docker. 修改Docker运行脚本以将原始数据连接到Docker中的gitlab。

    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 sudo docker run --detach \\ --hostname gitlab.example.com \\ --publish 443:443 --publish 80:80 --publish 22:22 \\ --name gitlab \\-总是重新启动\\ --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:最新

  3. run gitlab in docker 在docker中运行gitlab

  4. run backup in docker through omnibus package installed backup method https://docs.gitlab.com/ee/raketasks/backup_restore.html#restore-for-omnibus-installations 通过omnibus软件包安装的备份方法在docker中运行docker的备份https://docs.gitlab.com/ee/raketasks/backup_restore.html#restore-for-omnibus-installations

    eg) 例如)

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

  5. After done backup, find your backup file which specified in your 备份完成后,找到在

    eg) [USER_DIR]/etc/gitlab/gitlab.rb 例如)[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. 我自己的设置提供了外部PostgreSQL 9.x和Redis 5.x服务器。 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. 外部服务器和Docker的好处使仅使用外部服务器和对Docker主机上的Docker卷的根访问权限即可进行备份/还原。 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. 但是,更有益的一件事是,如果Gitlab团队专注于PostgreSQL 11.x兼容性而不是10.x兼容性。 I have already tested 11.x successfully in a build from sources, but waiting for a release by the Gitlab Team. 我已经从源代码中成功地测试了11.x,但是正在等待Gitlab团队发布。

I am happy you made it work! 我很高兴您成功了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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