diff --git a/scripts/backup b/scripts/backup index 4070095..6049480 100644 --- a/scripts/backup +++ b/scripts/backup @@ -36,7 +36,6 @@ final_path=$(ynh_app_setting_get $app final_path) domain=$(ynh_app_setting_get $app domain) db_name=$(ynh_app_setting_get $app psql_db) - #================================================= # STANDARD BACKUP STEPS #================================================= @@ -47,8 +46,8 @@ ynh_backup "$final_path" # Copy the data directory -ynh_backup "/home/yunohost.app/${app}" - +datadir="/home/yunohost.app/${app}/storage" +ynh_backup "$datadir" #================================================= # BACKUP THE NGINX CONFIGURATION @@ -71,7 +70,6 @@ ynh_backup "db.sql" ynh_backup "/etc/logrotate.d/$app" - #================================================= # BACKUP SYSTEMD #================================================= diff --git a/scripts/restore b/scripts/restore index affeb8f..4503f16 100644 --- a/scripts/restore +++ b/scripts/restore @@ -48,23 +48,23 @@ ynh_webpath_available "$domain" "$path_url" \ || ynh_die "Path not available: ${domain}${path_url}" test ! -d "$final_path" \ || ynh_die "There is already a directory: $final_path " - + +#================================================= +# STANDARD RESTORATION STEPS +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= + ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# FIND AND OPEN A PORT -#================================================= - -# Open this port -yunohost firewall allow Both "$port" 2>&1 -ynh_app_setting_set "$app" port "$port" - #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_restore_file "$final_path" -ynh_restore_file "/home/yunohost.app/${app}" + +datadir="/home/yunohost.app/${app}/storage" +ynh_restore_file "$datadir" #================================================= # RECREATE THE DEDICATED USER @@ -73,6 +73,9 @@ ynh_restore_file "/home/yunohost.app/${app}" # Create the dedicated user (if not existing) ynh_system_user_create "$app" +#================================================= +# RESTORE USER RIGHTS +#================================================= # Set right permissions for curl install datadir="/home/yunohost.app/${app}/storage" @@ -121,11 +124,16 @@ systemctl enable "$app.service" ynh_restore_file "/etc/logrotate.d/$app" #================================================= -# GENERIC FINALIZATION +# RESTORE THE LOGROTATE CONFIGURATION #================================================= -chown -R "$app" "$datadir" - (cd "$final_path" && yarn install --production --pure-lockfile) + +#================================================= +# GENERIC FINALIZATION +#================================================= +# RELOAD NGINX AND PeerTube +#================================================= + systemctl reload nginx service "$app" restart