gitlab stuff
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Wolfgang Hottgenroth 2025-01-15 15:56:18 +01:00
parent ef4aee107a
commit 418dff5545
Signed by: wn
GPG Key ID: 18FDFA577A8871AD
3 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,61 @@
---
title: "Gitlab Backup and Restore"
---
## Backup
Find the backup directory:
```
grep backup_path /etc/gitlab/gitlab.rb
```
Issue backup:
```
sudo gitlab-backup create
```
Transfer backup using scp to destination machine.
Backup configuration and secrets:
```
sudp cp /etc/gitlab/gitlab-secrets.json /backuppath/
sudo cp /etc/gitlab/gitlab.rb /backuppath/
```
## Restore
See also here: [https://docs.gitlab.com/ee/administration/backup_restore/restore_gitlab.html](https://docs.gitlab.com/ee/administration/backup_restore/restore_gitlab.html)
*DO NOT OVERWRITE THE CONFIGURATION ON THE DESTINATION MACHINE. COMPARE IT AND CONSIDER AND EVALUATE EACH DIFFERENCE*
Stop processes of GitLab connecting to the database:
```
gitlab-ctl stop puma
gitlab-ctl stop sidekiq
# check
gitlab-ctl status
```
Do not stop the whole system since the restore tool has to connect to the database which would also stop in that case.
Issue restore. Run this command in a screen session. It is running quite long and requires manual intervention in between.
```
sudo gitlab-backup restore BACKUP=...
```
Use the datecode and the version tag of the backup created above.
Remember secrets and configuration. Do not overwrite configuration, see above.
Reconfigure the instance:
```
sudo gitlab-ctl reconfigure
```
Start the instance:
```
sudo gitlab-ctl start
```

View File

@ -0,0 +1,23 @@
---
title: "Gitlab Change BaseURL in Database"
---
## Change URL
After a migration changing the base url in the configuration is not enough. It must also be changed in the database.
* Adjust the variable `external_url` in the file `/etc/gitlab/gitlab.rb` and run `gitlab-ctl reconfigure`
* Adjust the canonical URL in the database:
```
gitlab-rails console
ApplicationSetting.current.update!(home_page_url: 'https://neue-url.example.com')
ApplicationSetting.current.update!(after_sign_out_path: 'https://neue-url.example.com')
```
* Clear the internal cache:
```
gitlab-rake cache:clear
```

View File

@ -0,0 +1,24 @@
---
title: "Gitlab Upgrades"
---
## Upgrade of a GitLab instance
When upgrading a Gitlab instance, strictly follow the defined upgrade path. Consider to snapshot the filesystem if possible after each step.
Additional, after each step wait until all background migrations are completed before performing the next upgrade step.
* [Upgrade Paths](https://docs.gitlab.com/ee/update/index.html#upgrade-paths)
* [Upgrading to a specific version](https://docs.gitlab.com/ee/update/package/#upgrade-to-a-specific-version-using-the-official-repositories)
To find the versions of a specific package in the Debian apt cache use
```
apt-cache madison gitlab-ce
```
To upgrade to a specific version use
```
apt install gitlab-ce=<version>
```
**Definitely observe the version specific upgrade instructions, especially background migrations!**