Compare View
Commits (4)
-
The official CentOS image uses a non-conventional default sync folder path (/home/vagrant/sync). See https://github.com/CentOS/sig-cloud-instance-build/pull/34 Search both /vagrant and ~/sync paths for the backup.
-
systemctl exits immediately, while the SysV script waits for gitlab to stop.
-
This avoids the restore process to ask for user confirmation during the backup restore.
-
This saves disk space and time spent copying the file, since the backup file can be quite large. Unfortunately, the restore process fails if the backup file is a symlink.
Showing
1 changed file
Show diff stats
provision.sh
@@ -134,17 +134,22 @@ systemctl enable gitlab | @@ -134,17 +134,22 @@ systemctl enable gitlab | ||
134 | systemctl start gitlab | 134 | systemctl start gitlab |
135 | 135 | ||
136 | ##### restore backup | 136 | ##### restore backup |
137 | +if [ -e /vagrant/*_backup.tar ]; then | ||
138 | + backup=$(echo /vagrant/*_backup.tar) | ||
139 | +elif [ -e /home/vagrant/sync/*_backup.tar ]; then | ||
140 | + backup=$(echo /home/vagrant/sync/*_backup.tar) | ||
141 | +fi | ||
137 | 142 | ||
138 | -backup=$(echo /vagrant/*_backup.tar) | ||
139 | if [[ -e $backup ]]; then | 143 | if [[ -e $backup ]]; then |
140 | printf "####################################################" | 144 | printf "####################################################" |
141 | printf "Restaurando backup" | 145 | printf "Restaurando backup" |
142 | - systemctl stop gitlab | ||
143 | - sleep 3 | 146 | + /etc/init.d/gitlab stop |
147 | + | ||
144 | printf "Movendo backup para diretório correto" | 148 | printf "Movendo backup para diretório correto" |
145 | - install -D -m 755 -o git -g git $backup /var/lib/gitlab/backups | 149 | + chown git.git $backup |
150 | + ln $backup /var/lib/gitlab/backups/ | ||
146 | cd /usr/lib/gitlab | 151 | cd /usr/lib/gitlab |
147 | - sudo -u yes | git bundle exec rake gitlab:backup:restore RAILS_ENV=production | 152 | + sudo -u git bundle exec rake gitlab:backup:restore RAILS_ENV=production force=yes |
148 | else | 153 | else |
149 | printf "Backup não encontrado" | 154 | printf "Backup não encontrado" |
150 | fi | 155 | fi |