Add an update for awscli. Restore the backtracking paths.
This commit is contained in:
parent
b6a165cb28
commit
96a85e3ec4
|
@ -1,5 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
# First of all, let's pamper awscli because Python is so special:
|
||||
pip3 install --upgrade awscli
|
||||
|
||||
BACKUP=$1
|
||||
if [[ $BACKUP == "" ]]; then
|
||||
echo "No backup name given. It should look like '2020-01-29'."
|
||||
|
@ -89,10 +92,10 @@ cd $csd/..
|
|||
# Get the backup from S3:
|
||||
aws s3 cp $S3_BACKUP_PATH/$BACKUP/mongo.tgz mongo.tgz
|
||||
# Prepare a clean `to_restore` dir:
|
||||
rm -rf docker/data/mongo/db/backups/to_restore
|
||||
mkdir -p docker/data/mongo/db/backups/to_restore
|
||||
rm -rf $csd/../docker/data/mongo/db/backups/to_restore
|
||||
mkdir -p $csd/../docker/data/mongo/db/backups/to_restore
|
||||
# Decompress the backup:
|
||||
tar -xzf mongo.tgz -C docker/data/mongo/db/backups/to_restore
|
||||
tar -xzf mongo.tgz -C $csd/../docker/data/mongo/db/backups/to_restore
|
||||
rm mongo.tgz
|
||||
# Restore the backup:
|
||||
# The name of the backup is not `mongo` due to the way we're creating it,
|
||||
|
@ -102,5 +105,4 @@ docker exec mongo \
|
|||
mongodb://$SKYNET_DB_USER:$SKYNET_DB_PASS@$SKYNET_DB_HOST:$SKYNET_DB_PORT \
|
||||
/data/db/backups/to_restore/$BACKUP
|
||||
# Clean up:
|
||||
rm -rf docker/data/mongo/db/backups/to_restore
|
||||
cd -
|
||||
rm -rf $csd/../docker/data/mongo/db/backups/to_restore
|
||||
|
|
Reference in New Issue