You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

GitLab/Cheat Sheet

From Wikitech-static
Jump to navigation Jump to search

More or less loose collection of GitLab commands that might be helpful (or were helpful at some point)

GitLab

Restarts

Reboot GitLab instance:

cookbook sre.hosts.reboot-single gitlab1004.wikimedia.org

Restart GitLab service:

gitlab-ctl restart

Restart (git) SSH daemon:

systemctl restart ssh-gitlab

Check GitLab status:

gitlab-ctl status

Backup and Restore

Trigger a full backup:

systemctl start full-backup

Trigger a config backup:

systemctl start config-backup

Get logs of backup:

journalctl -u full-backup

Sync backup to replica (assuming gitlab1003 is the replica):

systemctl start rsync-data-backup-gitlab1003.wikimedia.org.service
systemctl start rsync-config-backup-gitlab1003.wikimedia.org.service

Trigger a restore on replica:

systemctl start backup-restore

Check status of restore:

systemctl status backup-restore.service

Check logs of restore:

journalctl -u backup-restore.service

gitlab-runner

Restarts

Gracefully reboot all GitLab Runner:

cookbook sre.gitlab.reboot-runner --reason "reason" --alias gitlab-runner reboot

Restart gitlab-runner service:

systemctl restart gitlab-runner

Register/Unregister:

Unregister Runner (note, this can also be done by setting profile::gitlab::runner::ensure to absent and run puppet):

gitlab-runner unregister --name `hostname -f`

Unregister Trusted Runner (different because running as non-root:

su -s /bin/bash gitlab-runner -c "gitlab-runner unregister --name `hostname -f`"

Register Runner (handled by puppet):

run-puppet-agent

Clean docker cache:

Cleanup old docker volumes in /var/lib/docker:

/usr/share/gitlab-runner/clear-docker-cache