mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-22 05:33:53 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5cacdb32a | ||
|
|
238b4d852c | ||
|
|
8d6e72eead | ||
|
|
a9037f97ac |
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,3 +1,18 @@
|
|||||||
|
## 3.10.5 2023-10-11 <dave at tiredofit dot ca>
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Add option to drop exsiting data from MongoDB restore
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Fix some capabilities of not being able to select mongodb manually to restore
|
||||||
|
|
||||||
|
|
||||||
|
## 3.10.4 2023-10-11 <thomas-negrault@github>
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Use authentication database for MongoDB restores
|
||||||
|
|
||||||
|
|
||||||
## 3.10.3 2023-10-11 <thomas-negrault@github>
|
## 3.10.3 2023-10-11 <thomas-negrault@github>
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${DB_HOST}" ] && [ -n "${parsed_host}" ]; then
|
if [ -z "${DB_HOST}" ] && [ -n "${parsed_host}" ]; then
|
||||||
print_debug "Parsed DBHostpho Variant: 3 - No Env, Parsed Filename"
|
print_debug "Parsed DBHost Variant: 3 - No Env, Parsed Filename"
|
||||||
q_dbhost_variant=3
|
q_dbhost_variant=3
|
||||||
q_dbhost_menu=$(cat <<EOF
|
q_dbhost_menu=$(cat <<EOF
|
||||||
|
|
||||||
@@ -335,7 +335,7 @@ EOF
|
|||||||
case "${q_dbtype_variant}" in
|
case "${q_dbtype_variant}" in
|
||||||
1 )
|
1 )
|
||||||
while true; do
|
while true; do
|
||||||
read -p "$(echo -e ${clg}** ${cdgy}Enter Value \(${cwh}M${cdgy}\) | \(${cwh}P${cdgy}\) : ${cwh}${coff}) " q_dbtype
|
read -p "$(echo -e ${clg}** ${cdgy}Enter Value \(${cwh}M${cdgy}\) \| \(${cwh}O${cdgy}\) \| \(${cwh}P${cdgy}\) : ${cwh}${coff}) " q_dbtype
|
||||||
case "${q_dbtype,,}" in
|
case "${q_dbtype,,}" in
|
||||||
m* )
|
m* )
|
||||||
r_dbtype=mysql
|
r_dbtype=mysql
|
||||||
@@ -358,7 +358,7 @@ EOF
|
|||||||
;;
|
;;
|
||||||
2 )
|
2 )
|
||||||
while true; do
|
while true; do
|
||||||
read -p "$(echo -e ${clg}** ${cdgy}Enter Value \(${cwh}E${cdgy}\) \| \(${cwh}M${cdgy}\) \| \(${cwh}P${cdgy}\) : ${cwh}${coff}) " q_dbtype
|
read -p "$(echo -e ${clg}** ${cdgy}Enter Value \(${cwh}E${cdgy}\) \| \(${cwh}M${cdgy}\) \| \(${cwh}O${cdgy}\) \| \(${cwh}P${cdgy}\) : ${cwh}${coff}) " q_dbtype
|
||||||
case "${q_dbtype,,}" in
|
case "${q_dbtype,,}" in
|
||||||
e* | "" )
|
e* | "" )
|
||||||
r_dbtype=${DB_TYPE}
|
r_dbtype=${DB_TYPE}
|
||||||
@@ -385,7 +385,7 @@ EOF
|
|||||||
;;
|
;;
|
||||||
3 )
|
3 )
|
||||||
while true; do
|
while true; do
|
||||||
read -p "$(echo -e ${clg}** ${cdgy}Enter Value \(${cwh}F${cdgy}\) \| \(${cwh}M${cdgy}\) \| \(${cwh}P${cdgy}\) : ${cwh}${coff}) " q_dbtype
|
read -p "$(echo -e ${clg}** ${cdgy}Enter Value \(${cwh}F${cdgy}\) \| \(${cwh}M${cdgy}\) \| \(${cwh}O${cdgy}\) \| \(${cwh}P${cdgy}\) : ${cwh}${coff}) " q_dbtype
|
||||||
case "${q_dbtype,,}" in
|
case "${q_dbtype,,}" in
|
||||||
f* | "" )
|
f* | "" )
|
||||||
r_dbtype=${p_dbtype}
|
r_dbtype=${p_dbtype}
|
||||||
@@ -413,7 +413,7 @@ EOF
|
|||||||
|
|
||||||
4 )
|
4 )
|
||||||
while true; do
|
while true; do
|
||||||
read -p "$(echo -e ${clg}** ${cdgy}Enter Value \(${cwh}E${cdgy}\) \| \(${cwh}F${cdgy}\) \| \(${cwh}M${cdgy}\) \| \(${cwh}P${cdgy}\) : ${cwh}${coff}) " q_dbtype
|
read -p "$(echo -e ${clg}** ${cdgy}Enter Value \(${cwh}E${cdgy}\) \| \(${cwh}F${cdgy}\) \| \(${cwh}M${cdgy}\) \| \(${cwh}O${cdgy}\) \| \(${cwh}P${cdgy}\) : ${cwh}${coff}) " q_dbtype
|
||||||
case "${q_dbtype,,}" in
|
case "${q_dbtype,,}" in
|
||||||
e* | "" )
|
e* | "" )
|
||||||
r_dbtype=${DB_TYPE}
|
r_dbtype=${DB_TYPE}
|
||||||
@@ -427,6 +427,10 @@ EOF
|
|||||||
r_dbtype=mysql
|
r_dbtype=mysql
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
o* )
|
||||||
|
r_dbtype=mongo
|
||||||
|
break
|
||||||
|
;;
|
||||||
p* )
|
p* )
|
||||||
r_dbtype=postgresql
|
r_dbtype=postgresql
|
||||||
break
|
break
|
||||||
@@ -915,6 +919,30 @@ case "${r_dbtype}" in
|
|||||||
exit_code=$?
|
exit_code=$?
|
||||||
;;
|
;;
|
||||||
mongo )
|
mongo )
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
Do you wish to drop any existing data before restoring?
|
||||||
|
Y ) Yes
|
||||||
|
N ) No
|
||||||
|
Q ) Quit
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo -e "${coff}"
|
||||||
|
read -p "$(echo -e ${clg}** ${cdgy}Enter Value \(${cwh}Y${cdgy}\) \| \(${cwh}N${cdgy}\) \| \(${cwh}Q${cdgy}\) : ${cwh}${coff})" q_menu_mongo_dropdb
|
||||||
|
case "${q_menu_mongo_dropdb,,}" in
|
||||||
|
"y" | "yes" | * )
|
||||||
|
mongo_dropdb="--drop"
|
||||||
|
;;
|
||||||
|
"n" | "update" )
|
||||||
|
unset mongo_dropdb
|
||||||
|
;;
|
||||||
|
"q" | "exit" )
|
||||||
|
print_info "Quitting Script"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
print_info "Restoring '${r_filename}' into '${r_dbhost}'/'${r_dbname}'"
|
print_info "Restoring '${r_filename}' into '${r_dbhost}'/'${r_dbname}'"
|
||||||
if [ "${ENABLE_COMPRESSION,,}" != "none" ] && [ "${ENABLE_COMPRESSION,,}" != "false" ] ; then
|
if [ "${ENABLE_COMPRESSION,,}" != "none" ] && [ "${ENABLE_COMPRESSION,,}" != "false" ] ; then
|
||||||
mongo_compression="--gzip"
|
mongo_compression="--gzip"
|
||||||
@@ -925,7 +953,11 @@ case "${r_dbtype}" in
|
|||||||
if [ -n "${r_dbpass}" ] ; then
|
if [ -n "${r_dbpass}" ] ; then
|
||||||
mongo_pass="-p=${r_dbpass}"
|
mongo_pass="-p=${r_dbpass}"
|
||||||
fi
|
fi
|
||||||
mongorestore ${mongo_compression} -d=${r_dbname} -h=${r_dbhost} --port=${r_dbport} ${mongo_user} ${mongo_pass} --archive=${r_filename}
|
if [ -n "${DB_AUTH}" ] ; then
|
||||||
|
mongo_auth_database="--authenticationDatabase=${DB_AUTH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mongorestore ${mongo_compression} -d=${r_dbname} -h=${r_dbhost} --port=${r_dbport} ${mongo_dropdb} ${mongo_user} ${mongo_pass} --archive=${r_filename} ${mongo_auth_database}
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
@@ -939,4 +971,4 @@ if [ "${exit_code}" = 0 ] ; then
|
|||||||
print_info "Restore complete!"
|
print_info "Restore complete!"
|
||||||
else
|
else
|
||||||
print_error "Restore reported errors"
|
print_error "Restore reported errors"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user