restore-gitlab.sh.j2 715 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
#!/bin/bash
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq

BAKFILE=`aws s3 ls {{ s3_bucket }} | grep gitlab_backup.tar | tail -1 | awk '{print $4}'`

aws s3 cp s3://{{ s3_bucket }}/${BAKFILE} /var/opt/gitlab/backups

chown git:git /var/opt/gitlab/backups/*.tar

11
KEYFILE=`aws s3 ls {{ s3_bucket }} | grep gitback-sshkeys | tail -1 | awk '{print $4}'`
12
13
14
15
16
17

aws s3 cp s3://{{ s3_bucket }}/${KEYFILE} /etc/ssh/
cd /etc/ssh; tar -xf ${KEYFILE}

BAKNAME=`echo ${BAKFILE/_gitlab_backup.tar/}`

18
gitlab-rake gitlab:backup:restore BACKUP=${BAKNAME} force=yes
19
20
21
22
23
24
25
26
27
28
29

gitlab-ctl start unicorn
gitlab-ctl start sidekiq

usermod -G gitadmin git

systemctl restart sshd.service

gitlab-ctl restart

gitlab-rake gitlab:check SANITIZE=true