Merge pull request #1300 from SkynetLabs/ivo/fix_db_restore

Make sure db restore works reliably and overwrites backup collections.
This commit is contained in:
Karol Wypchło 2021-10-21 02:19:35 +01:00 committed by GitHub
commit 9dad4ee4bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
# First of all, let's pamper awscli because Python is so special:
pip3 install --upgrade awscli
BACKUP=$1 BACKUP=$1
if [[ $BACKUP == "" ]]; then if [[ $BACKUP == "" ]]; then
echo "No backup name given. It should look like '2020-01-29'." echo "No backup name given. It should look like '2020-01-29'."
@ -97,7 +100,7 @@ rm mongo.tgz
# The name of the backup is not `mongo` due to the way we're creating it, # The name of the backup is not `mongo` due to the way we're creating it,
# it's $BACKUP. # it's $BACKUP.
docker exec mongo \ docker exec mongo \
mongorestore \ mongorestore --drop \
mongodb://$SKYNET_DB_USER:$SKYNET_DB_PASS@$SKYNET_DB_HOST:$SKYNET_DB_PORT \ mongodb://$SKYNET_DB_USER:$SKYNET_DB_PASS@$SKYNET_DB_HOST:$SKYNET_DB_PORT \
/data/db/backups/to_restore/$BACKUP /data/db/backups/to_restore/$BACKUP
# Clean up: # Clean up: