From 576681cc11f6fdadd817ebf1ba863744c29d6534 Mon Sep 17 00:00:00 2001 From: David Garcia Date: Thu, 11 Jun 2020 20:21:53 +0200 Subject: [PATCH] Modified db utils scripts --- README.md | 4 ++-- thethe_frontend | 2 +- utils/backup_thethe_db.sh | 6 ++++-- utils/restore_thethe_db.sh | 4 +++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 70868ce..b2408f1 100644 --- a/README.md +++ b/README.md @@ -84,13 +84,13 @@ Inside **utils** folder: Make a backup ```bash -backup_thethe_db.sh +backup_thethe_db.sh ``` Restore from a backup ```bash -restore_thethe_db.sh +restore_thethe_db.sh ``` backup filename is **db.dump.gz** diff --git a/thethe_frontend b/thethe_frontend index e91a212..08ae7dd 160000 --- a/thethe_frontend +++ b/thethe_frontend @@ -1 +1 @@ -Subproject commit e91a212819ccd1e870e5bb73600ac41a9803cf55 +Subproject commit 08ae7ddf5c411c48e34aa8c8b3da5ac8ee04a8ef diff --git a/utils/backup_thethe_db.sh b/utils/backup_thethe_db.sh index a98cf99..4e3fcaf 100755 --- a/utils/backup_thethe_db.sh +++ b/utils/backup_thethe_db.sh @@ -1,7 +1,9 @@ #!/bin/bash # https://jeromejaglale.com/doc/programming/mongodb_docker_mongodump_mongorestore +set -e +echo "usage: ./backup_thethe_db.sh " echo "Doing database backup..." -docker exec thethe_mongo sh -c 'mongodump --username root --password root --authenticationDatabase admin --archive' > db.dump -gzip -c db.dump > db.dump.gz +docker exec thethe_mongo sh -c "mongodump --username $1 --password $2 --authenticationDatabase admin --archive" >db.dump +gzip -c db.dump >db.dump.gz rm db.dump diff --git a/utils/restore_thethe_db.sh b/utils/restore_thethe_db.sh index 4e6c683..a559f36 100755 --- a/utils/restore_thethe_db.sh +++ b/utils/restore_thethe_db.sh @@ -1,7 +1,9 @@ #!/bin/bash # https://jeromejaglale.com/doc/programming/mongodb_docker_mongodump_mongorestore +set -e +echo "usage: ./restore_thethe_db.sh " echo "Restoring database from backup..." gzip -kd db.dump.gz -docker exec -i thethe_mongo sh -c 'mongorestore --drop --username root --password root --authenticationDatabase admin --archive' < db.dump +docker exec -i thethe_mongo sh -c "mongorestore --drop --username $1 --password $2 --authenticationDatabase admin --archive"