From 15cfb34986fb34a1170a124ad0ee220b4c13dcfe Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Sun, 9 Jul 2023 22:21:01 +0200 Subject: [PATCH] Refactor to harmonize with other apps in catalog --- conf/systemd.service | 7 ++++++- manifest.toml | 2 +- scripts/install | 10 ++++------ scripts/restore | 2 -- scripts/upgrade | 7 +++---- tests.toml | 4 +++- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index a0c4a37..1edfeb7 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,10 +6,15 @@ After=network.target [Service] User=__APP__ Group=__APP__ + +StandardOutput=append:/var/log/__APP__/__APP__.log +StandardError=inherit +SyslogIdentifier=__APP__ + Restart=always Type=simple WorkingDirectory=__INSTALL_DIR__ -ExecStart=/usr/local/bin/pipenv run python3 __INSTALL_DIR__/.venv/bin/libretranslate --host 127.0.0.1 --port __PORT__ --load-only en,fr --frontend-language-target en +ExecStart=__INSTALL_DIR__/venv/bin/libretranslate --host 127.0.0.1 --port __PORT__ --load-only en,fr --frontend-language-target en # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these diff --git a/manifest.toml b/manifest.toml index c0083c1..f5df886 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "LibreTranslate" description.en = "Open Source Machine Translation API" description.fr = "API de traduction automatique Open Source" -version = "1.3.11~ynh1" +version = "1.3.11~ynh2" maintainers = [""] diff --git a/scripts/install b/scripts/install index e784878..9c6988f 100755 --- a/scripts/install +++ b/scripts/install @@ -21,17 +21,15 @@ chown -R $app:www-data "$install_dir" #================================================= # SPECIFIC SETUP #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=2 - -ynh_exec_warn_less python3 -m pip install pipenv - ynh_script_progression --message="Installing LibreTranslate..." --weight=2 pushd $install_dir - mkdir -p .venv - PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install libretranslate==$libretranslate_version 2>&1 + python3 -m venv $install_dir/venv + source $install_dir/venv/bin/activate + ynh_exec_warn_less pip install libretranslate==$libretranslate_version popd + #================================================= # SYSTEM CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index e279eed..d2b5d13 100755 --- a/scripts/restore +++ b/scripts/restore @@ -28,8 +28,6 @@ chown -R $app:www-data "$install_dir" #================================================= ynh_script_progression --message="Restoring system configurations related to $app..." --weight=5 -ynh_exec_warn_less python3 -m pip install pipenv - ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" diff --git a/scripts/upgrade b/scripts/upgrade index 9ef093e..17be02c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,11 +38,10 @@ chown -R $app:www-data "$install_dir" #================================================= ynh_script_progression --message="Installing LibreTranslate..." --weight=2 -ynh_exec_warn_less python3 -m pip install pipenv - pushd $install_dir - mkdir -p .venv - PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install libretranslate==$libretranslate_version 2>&1 + python3 -m venv $install_dir/venv + source $install_dir/venv/bin/activate + ynh_exec_warn_less pip install libretranslate==$libretranslate_version popd #================================================= diff --git a/tests.toml b/tests.toml index eb73b8d..5edd7d9 100644 --- a/tests.toml +++ b/tests.toml @@ -1,3 +1,5 @@ test_format = 1.0 -[default] \ No newline at end of file +[default] + +test_upgrade_from.0fda158.name = "1.3.11~ynh1" \ No newline at end of file