Set database password on koel restore

This commit is contained in:
Bob Mottram 2017-06-25 20:44:00 +01:00
parent 50c64e26ba
commit 86d1c1a7d3
1 changed files with 19 additions and 8 deletions

View File

@ -323,7 +323,7 @@ function backup_local_koel {
source_directory=/var/www/${KOEL_DOMAIN_NAME}/htdocs source_directory=/var/www/${KOEL_DOMAIN_NAME}/htdocs
if [ -d $source_directory ]; then if [ -d $source_directory ]; then
systemctl stop koal systemctl stop koel
dest_directory=koel dest_directory=koel
function_check suspend_site function_check suspend_site
@ -338,7 +338,7 @@ function backup_local_koel {
function_check restart_site function_check restart_site
restart_site restart_site
systemctl start koal systemctl start koel
fi fi
} }
@ -349,7 +349,7 @@ function restore_local_koel {
KOEL_DOMAIN_NAME=$(get_completion_param "koel domain") KOEL_DOMAIN_NAME=$(get_completion_param "koel domain")
if [ $KOEL_DOMAIN_NAME ]; then if [ $KOEL_DOMAIN_NAME ]; then
echo $"Restoring koel" echo $"Restoring koel"
systemctl stop koal systemctl stop koel
temp_restore_dir=/root/tempkoel temp_restore_dir=/root/tempkoel
koel_dir=/var/www/${KOEL_DOMAIN_NAME}/htdocs koel_dir=/var/www/${KOEL_DOMAIN_NAME}/htdocs
@ -361,7 +361,13 @@ function restore_local_koel {
if [ -d $temp_restore_dir ]; then if [ -d $temp_restore_dir ]; then
rm -rf $temp_restore_dir rm -rf $temp_restore_dir
fi fi
systemctl start koal
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
cd /var/www/$KOEL_DOMAIN_NAME/htdocs
sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$MARIADB_PASSWORD|g" .env
MARIADB_PASSWORD=
systemctl start koel
fi fi
} }
@ -370,7 +376,7 @@ function backup_remote_koel {
KOEL_DOMAIN_NAME=$(get_completion_param "koel domain") KOEL_DOMAIN_NAME=$(get_completion_param "koel domain")
temp_backup_dir=/var/www/${KOEL_DOMAIN_NAME}/htdocs temp_backup_dir=/var/www/${KOEL_DOMAIN_NAME}/htdocs
if [ -d $temp_backup_dir ]; then if [ -d $temp_backup_dir ]; then
systemctl stop koal systemctl stop koel
function_check suspend_site function_check suspend_site
suspend_site ${KOEL_DOMAIN_NAME} suspend_site ${KOEL_DOMAIN_NAME}
@ -386,7 +392,7 @@ function backup_remote_koel {
function_check restart_site function_check restart_site
restart_site restart_site
systemctl start koal systemctl start koel
else else
echo $"koel domain specified but not found in ${temp_backup_dir}" echo $"koel domain specified but not found in ${temp_backup_dir}"
fi fi
@ -397,7 +403,7 @@ function restore_remote_koel {
if grep -q "koel domain" $COMPLETION_FILE; then if grep -q "koel domain" $COMPLETION_FILE; then
echo $"Restoring koel" echo $"Restoring koel"
systemctl stop koal systemctl stop koel
KOEL_DOMAIN_NAME=$(get_completion_param "koel domain") KOEL_DOMAIN_NAME=$(get_completion_param "koel domain")
@ -410,7 +416,12 @@ function restore_remote_koel {
rm -rf /root/tempkoel rm -rf /root/tempkoel
fi fi
systemctl start koal MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
cd /var/www/$KOEL_DOMAIN_NAME/htdocs
sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$MARIADB_PASSWORD|g" .env
MARIADB_PASSWORD=
systemctl start koel
echo $"Restore of koel complete" echo $"Restore of koel complete"
fi fi