Docs: https://wikitech.wikimedia.org/wiki/GitLab/Failover
Time: Tuesday, 26th September 2023, 12:15 UTC
Current gitlab-replica: gitlab2002
Current gitlab-replica-old: gitlab1003
This is being done to test the sre.gitlab.failover cookbook ahead of the Gitlab switchover later the same week (tracked in T345531).
Checklist:
Preparations before downtime:
- prepare change to set profile::gitlab::service_name: 'gitlab-replica.wikimedia.org' on gitlab1003, and profile::gitlab::service_name: gitlab-replica-old.wikimedia.org on gitlab2002
- Prepare change to point DNS entry for gitlab-replica.wikimedia.org to gitlab1003 gitlab-replica-old.wikimedia.org to gitlab2002
- Update home_page_url and apply gitlab-settings to gitlab1003 and gitlab2002
- announce downtime some days ahead on ops/releng list/broadcast message (maybe not needed for the replica switchover)
- lower TTL for gitlab DNS records to 300s (also PTR) (This was never changed back)
Scheduled downtime:
- Announce downtime in #wikimedia-gitlab
- Start gitlab failover cookbook with cookbook sre.gitlab.failover --switch-from gitlab2002 --switch-to gitlab1003 -t T334838
- _when prompted_ merge change to set profile::gitlab::service_name: 'gitlab-replica.wikimedia.org' on gitlab1003
- _when prompted_ Merge change to point DNS entry for gitlab-replica.wikimedia.org to gitlab1003 gitlab-replica-old.wikimedia.org to gitlab2002
- verify installation
- announce end of downtime
- Update https://wikitech.wikimedia.org/wiki/GitLab to reflect the new reality
Steps removed from original checklists (marked as complete for clarity)
- check gitlab1003 and gitlab1004 use the same ssh host keys for ssh-gitlab daemon
- pause all GitLab Runners (gitlab-settings ./runners active | tee active.txt && ./runners pause < active.txt)
- downtime gitlab1003 sudo cookbook sre.hosts.downtime -r "Running failover to gitlab1004- T329931" -M 120 'gitlab1004.wikimedia.org'
- stop puppet on gitlab1003 with sudo disable-puppet "Running failover to gitlab1004 - T329931"
- stop GitLab on gitlab1003 with gitlab-ctl stop nginx
- stop ssh-gitlab daemon on gitlab1003 with systemctl stop ssh-gitlab
- create full backup on gitlab1003 with /usr/bin/gitlab-backup create CRON=1 STRATEGY=copy GZIP_RSYNCABLE="true" GITLAB_BACKUP_MAX_CONCURRENCY="4" GITLAB_BACKUP_MAX_STORAGE_CONCURRENCY="1"
- sync backup, on gitlab1003 run /usr/bin/rsync -avp /srv/gitlab-backup/ rsync://gitlab1004.wikimedia.org/data-backup
- trigger restore on gitlab1004 run sudo systemctl start backup-restore.service (for logs, run journalctl -f -u backup-restore.service)
- enable puppet on gitlab1003 with sudo run-puppet-agent -e "Running failover to gitlab1004 - T329931"
- start ssh-gitlab daemon on gitlab1003 with systemctl start ssh-gitlab
- unpause all GitLab Runners (gitlab-settings ./runners unpause < active.txt)