From 2b82383aa3cddd848b91f628389da5e90ee23c63 Mon Sep 17 00:00:00 2001 From: lapineige Date: Mon, 26 Jun 2023 09:53:20 +0200 Subject: [PATCH] cleanup + restore --- scripts/restore | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/scripts/restore b/scripts/restore index 2bec09d..02ed2e1 100755 --- a/scripts/restore +++ b/scripts/restore @@ -32,41 +32,31 @@ ynh_restore_file --origin_path="$data_dir" --not_mandatory # (Same as for install dir) chown -R $app:www-data "$data_dir" -#================================================= -# RESTORE THE MYSQL DATABASE -#================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=1 +ynh_script_progression --message="Installing Peertube remote runner npm module..." --weight=1 -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +chown -R $app:www-data "$install_dir" + +#================================================= +# (RE)INSTALL NPM MODULE +#================================================= +ynh_script_progression --message="Installing Peertube remote runner npm module..." --weight=1 + +pushd "$install_dir" + ynh_use_nodejs + ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm install @peertube/peertube-runner +popd #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 -# This should be a symetric version of what happens in the install script - -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - -ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" -ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" -ynh_systemd_action --action=restart --service_name=fail2ban - -# Other various files... - -ynh_restore_file --origin_path="/etc/cron.d/$app" -ynh_restore_file --origin_path="/etc/$app/" +yunohost service add $app --description="Peertube remote runner" --log="/var/log/$app/$app.log" #================================================= # GENERIC FINALIZATION @@ -77,7 +67,6 @@ ynh_script_progression --message="Reloading NGINX web server and $app's service. # Typically you only have either $app or php-fpm but not both at the same time... ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload