본문 바로가기

DevOps/Git

[Gitlab]Install / Backup / Restore Gitlab

Purpose

Install, backup, restore Gitlab

물리 서버에서 운영하던 gitlab을 가상 서버로 이전하기 위해 해당 내용을 사용하였다.

gitlab restore시 동일한 version에서만 실행되니 이 부분을 주의하여 작업해야 한다.


1. Install gitlab

Gitlab version: 13.2.0

If you want to restore gitlab on other server you have to match gitlab version

yum install -y curl policycoreutils-python openssh-server perl

## add repo 
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

## install gitlab
## EXTERNAL_URL is option
EXTERNAL_URL="https://gitlab.dewble.com" yum install -y gitlab-ce-13.2.0-ce.0.el7

The version can be checked with command below

yum --showduplicates list gitlab-ce 

2. Backup

set backup config

vim /etc/gitlab/gitlab.rb

### Backup Settings
###! Docs: https://docs.gitlab.com/omnibus/settings/backups.html

gitlab_rails['manage_backup_path'] = true
gitlab_rails['backup_path'] = "/data/gitlab/backups"

Backup command

gitlab-rake gitlab:backup:create

3. restore

File transfer

Transfer file from the original to the destination

# Required files
/etc/gitlab/gitlab-secrets.json
/etc/gitlab/gitlab.rb
gitlab_backup.tar

Stop process

gitlab-ctl stop unicorn
gitlab-ctl stop puma
gitlab-ctl stop sidekiq

# Verify
gitlab-ctl status

Restroe gitlab

## without gitlab-tar
gitlab-backup restore BACKUP=1620209195_2021_05_05_13.2.0

Restart gitlab

gitlab-ctl reconfigure
gitlab-ctl restart

## command a few seconds later after restart
# check config
gitlab-rake gitlab:check SANITIZE=true
# check secrets
gitlab-rake gitlab:doctor:secrets

'DevOps > Git' 카테고리의 다른 글

[Github Actions]Github Actions의 주요 구성 요소  (0) 2022.12.13
[Git]What is GitOps?  (0) 2022.05.02