Setup Gitlab

Initial Gitlab setup

Run the proviced ansible script using the ‘initial’ tag.

ansible-playbook -v -i inventories --ask-vault-pass setup-gitlab.yml --tags initial

After the setup is finished: Get your initial root password from /etc/gitlab/initial_root_password

Reconfigure Gitlab

Full reconfigure

Run the proviced ansible script using the ‘reconfigure’ tag. This will also connect your instance to the Plantmicrobe Keycloak instance.

ansible-playbook -v -i inventories --ask-vault-pass setup-gitlab.yml --tags reconfigure

UFW only

To just update UFW rules and/or IP addresses, run ansible using the firewall tag

ansible-playbook -v -i inventories --ask-vault-pass setup-gitlab.yml --tags firewall

Upgrade Gitlab

Do not upgrade with ansible

Usually upgrades tend to require some manual steps and configuration, which is not covered by this playbook.

But make sure to update the gitlab_version in group_vars, for future re-configurations etc

Check the docs for a summary on how to upgrade gitlab (based on the official documentation):

Upgrade Gitlab

This a summary of the official Gitlab upgrade instructions. See here for further details: https://docs.gitlab.com/update/

Prepare Instance

Check you upgrade path. Do not jump to next version, but use intermediate steps: https://docs.gitlab.com/update/upgrade_paths/

Check configuration

sudo gitlab-rake gitlab:check

Verify all migrations are finished

sudo gitlab-rake gitlab:background_migrations:status

Confirm that encrypted database values can be decrypted

sudo gitlab-rake gitlab:doctor:secrets

Pause CI/CD jobs in Admin UI: https://gitlab.plantmicrobe.rdm.lab.lrz.de/admin/jobs

Block new jobs by adding this to /etc/gitlab/gitlab.rb

nginx['custom_gitlab_server_config'] = "location = /api/v4/jobs/request {\n deny all;\n return 503;\n}\n"

Reconfigure

sudo gitlab-ctl reconfigure

Upgrade to next version

Search for the latest minor version (e.g. the Z for x.y.Z) respective to the next version in your upgrade path: https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/

Set it up using apt:

sudo apt update && sudo apt install gitlab-ce=<version>-ce.0

Repeat this for every version in your upgrade path before you continue

When you reach your final version in your path, and you want to stage backups from another instance, perform this command with the exact version you want to stage

Restore Instance

After the upgrade is finished, restore all stopped services

Allow new jobs by removing this from /etc/gitlab/gitlab.rb

nginx['custom_gitlab_server_config'] = "location = /api/v4/jobs/request {\n deny all;\n return 503;\n}\n"

Reconfigure

sudo gitlab-ctl reconfigure

(optional) Sometimes a restart is needed

sudo gitlab-ctl restart