/ Tools

Gitlab

API

Checkout all repositories at once. Requires your key to be set up in your account.

curl -sL 'https://gitlab.your.domain/api/v4/projects?per_page=100&private_token=XXXXXXXXXXXX' | jq '.[].ssh_url_to_repo' | xargs -l git clone

Migration

From manual installation to docker instance for exemple

Backup old instance

sudo gitlab-rake gitlab:backup:create

Get it from /opt/gitlab/backups/

Restore on new dockerized instance

Write down a docker-compose.yml file with something like the official example. Be careful to pick the same version as your existing installation, otherwise the procedure will fail. You can update Gitlab later on by replacing fixed version by latest.

Start it

docker-compose up -d

Copy downloaded backup where your dockerized Gitlab will use it

sudo cp gitlab_backup.tar ./gitlab/backups/migration_gitlab_backup.tar

Check container name

docker ps

Connect to docker, replacing gitlab_app_1 with your container name

sudo docker exec -ti  gitlab_app_1 bash

Make sure backup is owned by git

chown -R git:git /var/opt/gitlab/backups/

Stop services before restoration

gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl status

Restore

gitlab-rake gitlab:backup:restore BACKUP=migration

Restart

gitlab-ctl start sidekiq
gitlab-ctl start unicorn
gitlab-ctl restart
gitlab-rake gitlab:check SANITIZE=true
Gitlab
Share this