From 08937000c79e677b7b5498081f6f640012bfa00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 2 Jan 2024 14:54:24 +0100 Subject: [PATCH] v2 --- manifest.toml | 2 +- scripts/install | 28 ++++++++++++++-------------- scripts/restore | 2 +- scripts/upgrade | 26 +++++++++++++------------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/manifest.toml b/manifest.toml index 1cfd415..ec13810 100644 --- a/manifest.toml +++ b/manifest.toml @@ -55,4 +55,4 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "python3-venv" + packages = "python3-venv, python3, python3-pip" diff --git a/scripts/install b/scripts/install index 531183b..1980dca 100755 --- a/scripts/install +++ b/scripts/install @@ -20,21 +20,9 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= -# INSTALL PYTHON DEPENDENCIES +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Installing python dependencies..." --weight=1 - -pushd $install_dir - python3 -m venv venv - venv/bin/pip install --upgrade pip - venv/bin/pip install -r requirements.txt # should only be flask for now, but just in case - venv/bin/pip install requests -popd - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 ynh_add_nginx_config @@ -42,6 +30,18 @@ ynh_add_systemd_config yunohost service add $app --description="Bypass paywall" --log="/var/log/$app/$app.log" +#================================================= +# INSTALL PYTHON DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing python dependencies..." --weight=1 + +pushd $install_dir + ynh_exec_as $app python3 -m venv $final_path/venv + ynh_exec_as $app "$install_dir/venv/bin/pip" install --upgrade pip + ynh_exec_as $app "$install_dir/venv/bin/pip" install -r requirements.txt + ynh_exec_as $app "$install_dir/venv/bin/pip" install requests +popd + #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/restore b/scripts/restore index 28aee4c..ec987b6 100755 --- a/scripts/restore +++ b/scripts/restore @@ -22,7 +22,7 @@ chown -R $app:www-data "$install_dir" #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" diff --git a/scripts/upgrade b/scripts/upgrade index 2d3d1b6..f52ec0b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,22 +38,10 @@ fi chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# INSTALL PYTHON DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing python dependencies..." --weight=1 - -pushd $install_dir - python3 -m venv venv - venv/bin/pip install --upgrade pip - venv/bin/pip install -r requirements.txt # should only be flask for now, but just in case - venv/bin/pip install requests -popd - #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config @@ -66,6 +54,18 @@ ynh_use_logrotate --non-append yunohost service add $app --description="Bypass paywall" --log="/var/log/$app/$app.log" +#================================================= +# INSTALL PYTHON DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing python dependencies..." --weight=1 + +pushd $install_dir + ynh_exec_as $app python3 -m venv $final_path/venv + ynh_exec_as $app "$install_dir/venv/bin/pip" install --upgrade pip + ynh_exec_as $app "$install_dir/venv/bin/pip" install -r requirements.txt + ynh_exec_as $app "$install_dir/venv/bin/pip" install requests +popd + #================================================= # START SYSTEMD SERVICE #=================================================