mirror of
https://github.com/sameersbn/docker-gitlab.git
synced 2026-01-18 13:58:25 +00:00
rake: accept BACKUP parameter while running the restore rake task, closes #220
This commit is contained in:
parent
d203dbc317
commit
283bba3d2d
@ -1,5 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
**latest**
|
||||
- accept `BACKUP` parameter while running the restore rake task, closes #220
|
||||
|
||||
**7.5.2**
|
||||
- gitlab: upgrade to CE v.7.5.2
|
||||
|
||||
|
||||
@ -811,6 +811,13 @@ docker run --name=gitlab -it --rm [OPTIONS] \
|
||||
|
||||
The restore operation will list all available backups in reverse chronological order. Select the backup you want to restore and gitlab will do its job.
|
||||
|
||||
To avoid user interaction in the restore operation, you can specify the timestamp of the specific backup using the `BACKUP` argument to the rake task.
|
||||
|
||||
```bash
|
||||
docker run --name=gitlab -it --rm [OPTIONS] \
|
||||
sameersbn/gitlab:7.5.2 app:rake gitlab:backup:restore BACKUP=1417624827
|
||||
```
|
||||
|
||||
## Automated Backups
|
||||
|
||||
The image can be configured to automatically take backups on a daily, weekly or monthly basis. Adding `-e 'GITLAB_BACKUPS=daily'` to the docker run command will enable daily backups. Adding `-e 'GITLAB_BACKUPS=weekly'` or `-e 'GITLAB_BACKUPS=monthly'` will enable weekly or monthly backups.
|
||||
|
||||
39
assets/init
39
assets/init
@ -763,24 +763,35 @@ appRake () {
|
||||
echo "Running gitlab rake task..."
|
||||
|
||||
if [ "$1" == "gitlab:backup:restore" ]; then
|
||||
# user needs to select the backup to restore
|
||||
nBackups=$(ls ${GITLAB_BACKUP_DIR}/*_gitlab_backup.tar | wc -l)
|
||||
if [ $nBackups -eq 0 ]; then
|
||||
echo "No backup present. Cannot continue restore process.".
|
||||
return 1
|
||||
fi
|
||||
|
||||
for b in `ls ${GITLAB_BACKUP_DIR} | sort -r`
|
||||
# check if the BACKUP argument is specified
|
||||
for a in $@
|
||||
do
|
||||
echo " ├ $b"
|
||||
if [[ $a == BACKUP=* ]]; then
|
||||
timestamp=${a:7}
|
||||
break
|
||||
fi
|
||||
done
|
||||
read -p "Select a backup to restore: " file
|
||||
|
||||
if [ ! -f "${GITLAB_BACKUP_DIR}/${file}" ]; then
|
||||
echo "Specified backup does not exist. Aborting..."
|
||||
return 1
|
||||
if [ -z ${timestamp} ]; then
|
||||
# user needs to select the backup to restore
|
||||
nBackups=$(ls ${GITLAB_BACKUP_DIR}/*_gitlab_backup.tar | wc -l)
|
||||
if [ $nBackups -eq 0 ]; then
|
||||
echo "No backup present. Cannot continue restore process.".
|
||||
return 1
|
||||
fi
|
||||
|
||||
for b in `ls ${GITLAB_BACKUP_DIR} | sort -r`
|
||||
do
|
||||
echo " ├ $b"
|
||||
done
|
||||
read -p "Select a backup to restore: " file
|
||||
|
||||
if [ ! -f "${GITLAB_BACKUP_DIR}/${file}" ]; then
|
||||
echo "Specified backup does not exist. Aborting..."
|
||||
return 1
|
||||
fi
|
||||
timestamp=$(echo $file | cut -d'_' -f1)
|
||||
fi
|
||||
timestamp=$(echo $file | cut -d'_' -f1)
|
||||
sudo -u git -H bundle exec rake gitlab:backup:restore BACKUP=$timestamp RAILS_ENV=production
|
||||
else
|
||||
[ "$1" == "gitlab:import:repos" ] && appSanitize
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user