diff --git a/scripts/backup b/scripts/backup index 010f6c5..4fd13d1 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,11 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_print_info --message="Declaring files to be backed up..." -### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs -### to be backuped and not an actual copy of any file. The actual backup that -### creates and fills the archive with the files happens in the core after this -### script is called. Hence ynh_backups calls take basically 0 seconds to run. - #================================================= # BACKUP THE APP MAIN DIR #================================================= @@ -39,19 +34,6 @@ ynh_backup --src_path="$data_dir" --is_big ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP THE PHP-FPM CONFIGURATION -#================================================= - -ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -#================================================= -# BACKUP FAIL2BAN CONFIGURATION -#================================================= - -ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" -ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" - #================================================= # SPECIFIC BACKUP #================================================= @@ -66,24 +48,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# BACKUP VARIOUS FILES -#================================================= - -ynh_backup --src_path="/etc/cron.d/$app" - -ynh_backup --src_path="/etc/$app/" - -#================================================= -# BACKUP THE MYSQL DATABASE -#================================================= -ynh_print_info --message="Backing up the MySQL database..." - -### (However, things like MySQL dumps *do* take some time to run, though the -### copy of the generated dump to the archive still happens later) - -ynh_mysql_dump_db --database="$db_name" > db.sql - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index f0964a6..122fceb 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -25,6 +25,9 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- ynh_change_url_nginx_config +ynh_script_progression --message="Updating env configuration file..." --weight=1 +ynh_add_config --template="default.env" --destination="$install_dir/default.env" + #================================================= # SPECIFIC MODIFICATIONS #================================================= diff --git a/scripts/install b/scripts/install index c92db28..2631eeb 100755 --- a/scripts/install +++ b/scripts/install @@ -30,7 +30,7 @@ pushd "$install_dir" ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --pure-lockfile ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install:python ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH:$install_dir/node_modules/.bin yarn run build:prod - # ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean popd pushd "$install_dir/sandbox/pyodide" diff --git a/scripts/restore b/scripts/restore index e60cb7a..57f7dd4 100755 --- a/scripts/restore +++ b/scripts/restore @@ -17,7 +17,7 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -# $install_dir will automatically be initialized with some decent +# $install_dir will automatically be initialized with some decent # permissions by default ... however, you may need to recursively reapply # ownership to all files such as after the ynh_setup_source step chown -R $app:www-data "$install_dir" @@ -32,13 +32,6 @@ 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_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql - #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= @@ -48,8 +41,6 @@ ynh_script_progression --message="Restoring system configurations related to $ap # 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" @@ -59,15 +50,6 @@ yunohost service add $app --description="A short description of the 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/" - #================================================= # GENERIC FINALIZATION #================================================= @@ -77,7 +59,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 diff --git a/scripts/upgrade b/scripts/upgrade index c029e62..e119b44 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -51,6 +51,21 @@ fi # ownership to all files such as after the ynh_setup_source step chown -R $app:www-data "$install_dir" +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + pushd "$install_dir" + ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --pure-lockfile + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install:python + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH:$install_dir/node_modules/.bin yarn run build:prod + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean + popd + + pushd "$install_dir/sandbox/pyodide" + ynh_exec_warn_less ynh_exec_as $app make setup + popd +fi + #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= @@ -58,8 +73,6 @@ ynh_script_progression --message="Upgrading system configurations related to $ap # This should be a literal copypaste of what happened in the install's "System configuration" section -ynh_add_fpm_config - ynh_add_nginx_config ynh_add_systemd_config @@ -68,8 +81,6 @@ yunohost service add $app --description="A short description of the app" --log=" ynh_use_logrotate --non-append -ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" - #================================================= # RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) #================================================= @@ -82,7 +93,7 @@ ynh_script_progression --message="Updating a configuration file..." --weight=1 ### The file will automatically be backed-up if it's found to be manually modified (because ### ynh_add_config keeps track of the file's checksum) -ynh_add_config --template="some_config_file" --destination="$install_dir/some_config_file" +ynh_add_config --template="default.env" --destination="$install_dir/default.env" # FIXME: this should be handled by the core in the future # You may need to use chmod 600 instead of 400,