1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pixelfed_ynh.git synced 2024-09-03 20:06:04 +02:00

use postgresql for backup and restore

This commit is contained in:
Jean-Baptiste Holcroft 2019-03-31 15:29:21 +02:00
parent 41577b9bc7
commit 0e139f5e42
3 changed files with 10 additions and 8 deletions

View file

@ -56,11 +56,11 @@ ynh_print_info "Backing up php-fpm configuration..."
ynh_backup "/etc/php/7.2/fpm/pool.d/$app.conf" ynh_backup "/etc/php/7.2/fpm/pool.d/$app.conf"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE PostgreSQL DATABASE
#================================================= #=================================================
ynh_print_info "Backing up the MySQL database..." ynh_print_info "Backing up the PostgreSQL database..."
ynh_mysql_dump_db "$db_name" > db.sql ynh_psql_dump_db "$db_name" > db.sql
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP

View file

@ -67,6 +67,7 @@ db_name=$(ynh_sanitize_dbid $app)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_string_random) db_pwd=$(ynh_string_random)
ynh_app_setting_set $app db_name $db_name ynh_app_setting_set $app db_name $db_name
ynh_app_setting_set $app db_pwd $db_pwd
# Initialize database and store postgres password for upgrade # Initialize database and store postgres password for upgrade
ynh_psql_setup_db $db_user $db_name $db_pwd ynh_psql_setup_db $db_user $db_name $db_pwd

View file

@ -32,6 +32,7 @@ domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
db_name=$(ynh_app_setting_get $app db_name) db_name=$(ynh_app_setting_get $app db_name)
db_pwd=$(ynh_app_setting_get $app db_pwd)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
@ -90,13 +91,13 @@ ynh_print_info "Reinstalling dependencies..."
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE PostgreSQL DATABASE
#================================================= #=================================================
ynh_print_info "Restoring the MySQL database..." ynh_print_info "Restoring the PostgreSQL database..."
db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_psql_test_if_first_run
ynh_mysql_setup_db $db_name $db_name $db_pwd ynh_psql_create_db "$db_name" "$db_name" "$db_pwd"
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql ynh_psql_execute_file_as_root ./db.sql "$db_name"
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD