meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
git:gitlab [2020/03/02 08:08] niziak [gitlab] |
git:gitlab [2021/12/10 10:45] (current) niziak |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== gitlab ====== | + | ====== Gitlab ====== |
Download location: [[https://packages.gitlab.com/gitlab/gitlab-ce]] \\ | Download location: [[https://packages.gitlab.com/gitlab/gitlab-ce]] \\ | ||
Line 5: | Line 5: | ||
Configure Gitlab's web server: [[https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md]] \\ | Configure Gitlab's web server: [[https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md]] \\ | ||
- | <code bash> | ||
- | gitlab-ctl stop | ||
- | gitlab-ctl start | ||
- | </code> | ||
Get installed version info | Get installed version info | ||
Line 25: | Line 21: | ||
gitlab-rails console | gitlab-rails console | ||
</code> | </code> | ||
+ | |||
+ | Restart services without downtime | ||
+ | <code bash> | ||
+ | sudo gitlab-ctl hup unicorn | ||
+ | sudo gitlab-ctl hup puma | ||
+ | sudo gitlab-ctl restart sidekiq | ||
+ | sudo gitlab-ctl hup nginx | ||
+ | </code> | ||
+ | |||
+ | ===== Start / stop / enable / disable ===== | ||
+ | |||
+ | <code bash> | ||
+ | gitlab-ctl stop | ||
+ | gitlab-ctl start | ||
+ | |||
+ | systemctl disable gitlab-runsvdir.service | ||
+ | systemctl enable gitlab-runsvdir.service | ||
+ | </code> | ||
+ | |||
+ | |||
Line 79: | Line 95: | ||
</code> | </code> | ||
- | ===== Making backup ===== | ||
- | * block gitlab access (but leave maintenance web page) | ||
- | * gitlab-ctl deploy-page up | ||
- | * sudo gitlab-ctl stop unicorn | ||
- | * sudo gitlab-ctl stop sidekiq | ||
- | * Store configuration file manually (/etc/gitlab) | ||
- | * Trigger backup creation | ||
- | * ''gitlab-rake gitlab:backup:create'' | ||
- | |||
- | * Start gitlab | ||
- | * ''gitlab-ctl start'' | ||
- | * ''gitlab-ctl deploy-page down'' | ||
- | |||
- | Make backup without repository | ||
- | <code bash>gitlab-rake gitlab:backup:create SKIP=repositories,uploads</code> | ||
- | For possible rake tasks to skip see into file ''/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake''. | ||
- | For now it cane be: ''repositories,db,builds,uploads,artifacts,lfs'' | ||
- | |||
- | |||
- | ==== Automating backups ==== | ||
- | crontab -e | ||
- | <code bash>0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1</code> | ||
- | |||
- | ==== What is in backup ==== | ||
- | Backup file e.g.: ''1462327272_gitlab_backup.tar'' is simple tar archive with example content: | ||
- | <code> | ||
- | |-- artifacts.tar.gz | ||
- | |-- backup_information.yml | ||
- | |-- builds.tar.gz | ||
- | |-- db | ||
- | | `-- database.sql.gz | ||
- | |-- lfs.tar.gz | ||
- | |-- repositories | ||
- | | |-- group1 | ||
- | | | |-- http-server.bundle | ||
- | | | |-- kernel.bundle | ||
- | | |-- group2 | ||
- | | | |-- buildroot.bundle | ||
- | | | |-- linux-stable.bundle | ||
- | | | |-- u-boot.bundle | ||
- | | | `-- yocto.bundle | ||
- | | `-- user1 | ||
- | | |-- buildroot.bundle | ||
- | | |-- linux-stable.bundle | ||
- | | |-- linux.bundle | ||
- | | |-- uboot.bundle | ||
- | `-- uploads.tar.gz | ||
- | </code> | ||
- | Where .bundle filesa re simple tar archives of bare git repos. | ||
- | |||
- | ===== Restoring backup ===== | ||
- | * install exactly the same version from backup comes | ||
- | * to wrap ''initctl'' with ''systemctl'', use [[https://gist.github.com/zorael/8907216]] | ||
- | * install default gitlab package and make sure it is running | ||
- | * use /etc/gitlab from backup | ||
- | * run ''gitlab-ctl reconfigure'' | ||
- | * stop gitlab | ||
- | * ''sudo gitlab-ctl stop unicorn'' | ||
- | * ''sudo gitlab-ctl stop sidekiq'' | ||
- | * Restore backup | ||
- | * ''sudo gitlab-rake gitlab:backup:restore'' | ||
- | * OR ''sudo gitlab-rake gitlab:backup:restore BACKUP=1393513186'' | ||
- | * Start GitLab | ||
- | * ''sudo gitlab-ctl start'' | ||
- | * Check GitLab | ||
- | * ''sudo gitlab-rake gitlab:check SANITIZE=true'' | ||