From b5a716ac39524e0753651da1c43e3f0d0b9bc0e9 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 14 Dec 2021 14:54:32 +0100 Subject: [PATCH] fix --- scripts/install | 8 +++----- scripts/restore | 19 ++++++++++--------- scripts/upgrade | 43 ++++++++++++++++++++----------------------- 3 files changed, 33 insertions(+), 37 deletions(-) diff --git a/scripts/install b/scripts/install index 61fc041..ada2358 100644 --- a/scripts/install +++ b/scripts/install @@ -99,9 +99,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path mkdir -p $final_path pushd $final_path - -PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyterhub-ldapauthenticator pyzmq jupyterlab-language-pack-fr-FR --three - + PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyterhub-ldapauthenticator pyzmq jupyterlab-language-pack-fr-FR --three popd #================================================= @@ -109,7 +107,7 @@ popd #================================================= ynh_script_progression --message="Configuring NGINX web server..." --weight=1 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -150,7 +148,7 @@ chown -R $admin: $final_path/.venv/ # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --description="$app daemon" --log="$app" +yunohost service add $app --description="JupyterLab: Python console environment" --log="$app" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/restore b/scripts/restore index 719b8cd..052147c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -44,23 +44,24 @@ test ! -d $final_path || ynh_die --message="There is already a directory: $final #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= +ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=5 - -ynh_restore_file --origin_path="$final_path" - #================================================= # RECREATE THE DEDICATED USER #================================================= ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" + +#================================================= +# RESTORE THE APP MAIN DIR +#================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=5 + +ynh_restore_file --origin_path="$final_path" #================================================= # RESTORE USER RIGHTS @@ -98,7 +99,7 @@ systemctl enable $app.service --quiet # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --description="$app daemon" --log="$app" +yunohost service add $app --description="JupyterLab: Python console environment" --log="$app" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 5633efb..aefb691 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,6 +31,22 @@ enable_terminal=$(ynh_app_setting_get --app=$app --key=enable_terminal) upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=48 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + ynh_clean_check_starting + + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -52,22 +68,6 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=48 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting - - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -82,7 +82,7 @@ ynh_systemd_action --service_name=$app --action="stop" #================================================= ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -118,11 +118,8 @@ then mkdir -p $final_path pushd $final_path - - PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyterhub-ldapauthenticator pyzmq - - ynh_exec_warn_less python3 -m pipenv run jupyterhub upgrade-db - + PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyterhub-ldapauthenticator pyzmq jupyterlab-language-pack-fr-FR + ynh_exec_warn_less python3 -m pipenv run jupyterhub upgrade-db popd fi @@ -164,7 +161,7 @@ chown -R $admin: $final_path/.venv/ # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --description="$app daemon" --log="$app" +yunohost service add $app --description="JupyterLab: Python console environment" --log="$app" #================================================= # START SYSTEMD SERVICE