1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/libretranslate_ynh.git synced 2024-09-03 19:36:00 +02:00

Merge pull request #15 from YunoHost-Apps/testing

Testing
This commit is contained in:
Éric Gaspar 2023-08-03 15:07:25 +02:00 committed by GitHub
commit 1b48db3594
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 57 additions and 42 deletions

View file

@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Free and Open Source Machine Translation API, entirely self-hosted. Unlike other APIs, it doesn't rely on proprietary providers such as Google or Azure to perform translations. Instead, its translation engine is powered by the open source Argos Translate library. Free and Open Source Machine Translation API, entirely self-hosted. Unlike other APIs, it doesn't rely on proprietary providers such as Google or Azure to perform translations. Instead, its translation engine is powered by the open source Argos Translate library.
**Shipped version:** 1.3.11~ynh1 **Shipped version:** 1.3.11~ynh2
**Demo:** https://libretranslate.com/ **Demo:** https://libretranslate.com/

View file

@ -19,7 +19,7 @@ Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
Free and Open Source Machine Translation API, entirely self-hosted. Unlike other APIs, it doesn't rely on proprietary providers such as Google or Azure to perform translations. Instead, its translation engine is powered by the open source Argos Translate library. Free and Open Source Machine Translation API, entirely self-hosted. Unlike other APIs, it doesn't rely on proprietary providers such as Google or Azure to perform translations. Instead, its translation engine is powered by the open source Argos Translate library.
**Version incluse :** 1.3.11~ynh1 **Version incluse :** 1.3.11~ynh2
**Démo :** https://libretranslate.com/ **Démo :** https://libretranslate.com/

View file

@ -6,10 +6,15 @@ After=network.target
[Service] [Service]
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit
SyslogIdentifier=__APP__
Restart=always Restart=always
Type=simple Type=simple
WorkingDirectory=__INSTALL_DIR__ 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 # Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these # Depending on specificities of your service/app, you may need to tweak these

View file

@ -5,7 +5,7 @@ name = "LibreTranslate"
description.en = "Open Source Machine Translation API" description.en = "Open Source Machine Translation API"
description.fr = "API de traduction automatique Open Source" description.fr = "API de traduction automatique Open Source"
version = "1.3.11~ynh1" version = "1.3.11~ynh2"
maintainers = [""] maintainers = [""]
@ -17,7 +17,7 @@ admindoc = "https://libretranslate.com/docs/"
code = "https://github.com/LibreTranslate/LibreTranslate" code = "https://github.com/LibreTranslate/LibreTranslate"
[integration] [integration]
yunohost = ">= 11.1.19" yunohost = ">= 11.2"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
ldap = false ldap = false

View file

@ -27,19 +27,11 @@ ynh_backup --src_path="$install_dir"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_backup --src_path="/etc/systemd/system/${app}.service"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -21,15 +21,12 @@ chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# SPECIFIC SETUP # 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 ynh_script_progression --message="Installing LibreTranslate..." --weight=2
pushd $install_dir pushd $install_dir
mkdir -p .venv python3 -m venv $install_dir/venv
PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install libretranslate==$libretranslate_version 2>&1 source $install_dir/venv/bin/activate
ynh_exec_warn_less pip install libretranslate==$libretranslate_version toml
popd popd
#================================================= #=================================================

View file

@ -10,6 +10,25 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE LOGROTATE
#=================================================
ynh_script_progression --message="Configuring logrotate to manage application logfiles" --weight=1
# Use logrotate to manage application logfile(s)
ynh_use_logrotate --specific_user=$app
touch /var/log/$app/$app.log
chown -R $app:www-data /var/log/$app/
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
@ -17,36 +36,37 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="$install_dir"
chmod 750 "$install_dir" chown -R $app: "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# RESTORE SYSTEM CONFIGURATIONS # RESTORE SYSTEMD
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_restore_file --origin_path="/etc/systemd/system/${app}.service"
systemctl enable "${app}.service" --quiet
#================================================= #=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=5 # INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_exec_warn_less python3 -m pip install pipenv ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
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="Machine Translation API" --log="/var/log/$app/$app.log" yunohost service add $app --description="Machine Translation API" --log="/var/log/$app/$app.log"
ynh_restore_file --origin_path="/etc/logrotate.d/$app" #=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name="${app}" --action="start"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -38,11 +38,12 @@ chown -R $app:www-data "$install_dir"
#================================================= #=================================================
ynh_script_progression --message="Installing LibreTranslate..." --weight=2 ynh_script_progression --message="Installing LibreTranslate..." --weight=2
ynh_exec_warn_less python3 -m pip install pipenv ynh_secure_remove $install_dir/.venv
pushd $install_dir pushd $install_dir
mkdir -p .venv python3 -m venv $install_dir/venv
PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install libretranslate==$libretranslate_version 2>&1 source $install_dir/venv/bin/activate
ynh_exec_warn_less pip install libretranslate==$libretranslate_version toml
popd popd
#================================================= #=================================================