From dd0fb51a84e010751952174f87d30b8eae91e5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 16 May 2023 19:48:41 +0200 Subject: [PATCH] cleaning --- doc/ADMIN.md | 17 +-------------- doc/ADMIN_fr.md | 21 +----------------- doc/DESCRIPTION.md | 6 ++--- doc/DESCRIPTION_fr.md | 5 ++--- manifest.toml | 2 +- scripts/install | 11 +++------- scripts/remove | 21 ++---------------- scripts/restore | 51 +++++++++++++++---------------------------- scripts/upgrade | 31 +++++++++----------------- 9 files changed, 39 insertions(+), 126 deletions(-) diff --git a/doc/ADMIN.md b/doc/ADMIN.md index d50d340..737e05a 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,18 +1,3 @@ -### YunoHost specific features -In addition to Wallabag core features, the following are made available with this package: - - * Integrate with YunoHost users and SSO - i.e. logout button - * Allow one user to be the administrator (set at the installation) - * Asynchronous import using *Redis* (need to be enabled in the *Internal Settings*). *RabbitMQ* import not supported (yet?). - ### Limitations -* Removing a Yunohost's user won't delete the related wallabag user, but only desactivate it. You need to manualy remove it from wallabag before. See: https://github.com/YunoHost-Apps/wallabag2_ynh/issues/39 -* Upgrade from the YunoHost [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) app requires a manual operation. That's why it's provided as a new package. For the migration process, please refer to the [Wallabag official documentation](https://doc.wallabag.org/en/user/import/wallabagv1.html). - -### (Beta) Testing branch -*Please be aware that the testing branch (or any PR branch)* might *contains some bugs and is not recommended if you need a stable app.* - -(Beta) Testers are welcome to try new upgrades (such as a new version), as listed in the [Pull Requests section](https://github.com/YunoHost-Apps/wallabag2_ynh/pulls). More testing will allow us to provide upgrades faster 🙂. In order to try the testing branch, use `sudo yunohost app upgrade wallabag2 -u https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing`. - -Warning : Doing a normal upgrade of the package with the web admin or `sudo yunohost app upgrade wallabag2` (without any URL specified) will revert you app to the master branch. *This may break you wallabag* if it goes to a previous version (if the newest is not retrocompatible). \ No newline at end of file +Removing a YunoHost's user won't delete the related wallabag user, but only desactivate it. You need to manualy remove it from wallabag before. See: https://github.com/YunoHost-Apps/wallabag2_ynh/issues/39 diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index d5b3f53..6dc2907 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,22 +1,3 @@ -### CaractĂ©ristiques spĂ©cifiques YunoHost - -En plus des fonctionnalitĂ©s principales de Wallabag, ce paquet propose Ă©galement : - - * Une intĂ©gration avec le systĂšme de gestion des utilisateurs et le SSO de YunoHost - e.g. un bouton de dĂ©connexion - * De permettre Ă  un utilisateur d'ĂȘtre administrateur (rĂ©glage lors de l'installation) - * Un import asynchrone utilisant Redis (À  activer dans les *ParamĂštres Internes*). L'import via RabbitMQ n'est pas (encore ?) supportĂ©. - ### Limitations -* Supprimer un utilisateur YunoHost ne supprimera pas l'utilisateur Wallabag liĂ©, il sera seulement dĂ©sactivĂ©. Vous devez le supprimer manuellement avant. Voir : https://github.com/YunoHost-Apps/wallabag2_ynh/issues/39 - -* La mise à niveau depuis le paquet YunoHost de [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) demande une opĂ©ration manuelle, c'est pourquoi un nouveau paquet est fournit. Pour le processus de migration, merci de vous référer à [la documentation officiel de Wallabag](https://doc.wallabag.org/fr/user/import/wallabagv1.html). - - -### Branche de test (*Testing*) -*Soyez concient que la branche testing* pourrait *contenir des bugs et n'est pas recommandĂ©e si vous recherchez la stabilitĂ© de votre application.* - -Les personnes souhaitant (bĂȘta) tester de nouvelles mises Ă  jour (ex: une nouvelle version), listée dans la [section des Pull Requests](https://github.com/YunoHost-Apps/wallabag2_ynh/pulls), sont les bienvenues. Plus de tests nous permettrons de sortir des mises Ă  jour plus vite. Pour tester la branche *testing*, utilisez `sudo yunohost app upgrade wallabag2 -u https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing`. - -Attention : Une mise Ă  jour classique avec l'interface d'administration ou avec `sudo yunohost app upgrade wallabag2` (sans prĂ©ciser l'URL) fera retourner votre application au niveau de la branche master. *Ceci pourrait casser votre wallabag* si vous revenez Ă  une version prĂ©cĂ©dente (et si la nouvelle n'est pas rĂ©trocompatible). - +Supprimer un utilisateur YunoHost ne supprimera pas l'utilisateur Wallabag liĂ©, il sera seulement dĂ©sactivĂ©. Vous devez le supprimer manuellement avant. Voir : https://github.com/YunoHost-Apps/wallabag2_ynh/issues/39 diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index f2e514a..137390e 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1,4 +1,2 @@ -[Wallabag](https://www.wallabag.org/) is a self hostable Read-It-Later application allowing you to not miss any content anymore. Click, save, read it when you can. -It extracts content so that you can read it when you have time. - -It provides a web interface, browser (Firefox / Chrome / Opera) add-ons, mobile apps (Android / iOS / Windows Phone) and even on e-reader (PocketBook / Kobo). +Wallabag is a self hostable Read-It-Later application allowing you to not miss any content anymore. Click, save, read it when you can. +It provides a web interface, browser (Firefox/Chrome/Opera) add-ons, mobile apps (Android/iOS/Windows Phone) and even on e-reader (PocketBook/Kobo). diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index bf2e239..0f83191 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -1,3 +1,2 @@ -[Wallabag](https://www.wallabag.org/) est une application de lecture diffĂ©rĂ©e : elle permet simplement d’archiver une page web en ne conservant que le contenu. Les Ă©lĂ©ments superflus (menus, publicitĂ©s, etc.) sont supprimĂ©s. - -Sont disponibles une interface web, des add-ons pour navigateurs (Firefox / Chrome / Opera), des applications pour mobile (Android / iOS / Windows Phone) et mĂȘme sur liseuse (PocketBook / Kobo). +Wallabag est une application de lecture diffĂ©rĂ©e : elle permet simplement d’archiver une page web en ne conservant que le contenu. Les Ă©lĂ©ments superflus (menus, publicitĂ©s, etc.) sont supprimĂ©s. +Sont disponibles une interface web, des add-ons pour navigateurs (Firefox/Chrome/Opera), des applications pour mobile (Android/iOS/Windows Phone) et mĂȘme sur liseuse (PocketBook/Kobo). diff --git a/manifest.toml b/manifest.toml index 0b5bf63..75c431b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -21,7 +21,7 @@ yunohost = ">= 11.1.19" architectures = "all" multi_instance = true ldap = true -sso = false +sso = true disk = "50M" ram.build = "50M" ram.runtime = "50M" diff --git a/scripts/install b/scripts/install index 8725050..7ee9488 100644 --- a/scripts/install +++ b/scripts/install @@ -24,16 +24,11 @@ ynh_setup_source --dest_dir="$install_dir" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 - # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low @@ -42,7 +37,7 @@ ynh_add_fpm_config --usage=low --footprint=low #================================================= # CONFIGURE WALLABAG #================================================= -ynh_script_progression --message="Configuring wallabag..." --weight=35 +ynh_script_progression --message="Configuring wallabag..." --weight=25 ynh_add_config --template="../conf/parameters.yml" --destination="$install_dir/app/config/parameters.yml" @@ -95,8 +90,8 @@ fi #================================================= # SETUP LOGROTATE #================================================= +ynh_script_progression --message="Configuring log rotation..." --weight=1 -ynh_script_progression --message="Configuring log rotation..." # Use logrotate to manage application logfile(s) touch "$install_dir/var/logs/prod.log" ynh_use_logrotate "$install_dir/var/logs/prod.log" diff --git a/scripts/remove b/scripts/remove index 04f5377..e8afc43 100644 --- a/scripts/remove +++ b/scripts/remove @@ -10,36 +10,19 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# STANDARD REMOVE +# REMOVE SYSTEMD SERVICE #================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." - # Remove the dedicated PHP-FPM config ynh_remove_fpm_config -#================================================= -# REMOVE FAIL2BAN CONFIGURATION -#================================================= -ynh_script_progression --message="Removing Fail2Ban configuration..." - # Remove the dedicated Fail2Ban config ynh_remove_fail2ban_config diff --git a/scripts/restore b/scripts/restore index 7b2d7ba..2bb80a9 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,15 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -40,29 +31,6 @@ if [ -e $install_dir/var/cache/prod/appProdProjectContainer.php ]; then chmod 700 $install_dir/var/cache/prod/appProdProjectContainer.php fi -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the PHP-FPM configuration..." - -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - -#================================================= -# RESTORE FAIL2BAN CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the Fail2Ban configuration..." - -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 - #================================================= # RESTORE THE MYSQL DATABASE #================================================= @@ -70,12 +38,27 @@ ynh_script_progression --message="Restoring the MySQL database..." --weight=3 ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 + +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/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 + #================================================= # GENERIC FINALIZATION #================================================= -# RELOAD NGINX AND PHP-FPM +# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." +ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 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 1a8d064..3a8d3ee 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -32,22 +32,17 @@ then fi #================================================= -# NGINX CONFIGURATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." - -# Create a dedicated NGINX config -ynh_add_nginx_config - -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low -# Set-up fail2ban +# Create a dedicated NGINX config +ynh_add_nginx_config + +# Set-up Fail2Ban # Create the log file is not already existing if [ ! -f "$install_dir/var/logs/prod.log" ] then @@ -56,9 +51,11 @@ then chown $app: "$install_dir/var/logs/prod.log" fi -# Add fail2ban config +# Add Fail2Ban config ynh_add_fail2ban_config --logpath="$install_dir/var/logs/prod.log" --failregex='app.ERROR: Authentication failure for user "([\w]+)?", from IP ""' --max_retry=5 # same as install config +ynh_use_logrotate --non-append + #================================================= # SPECIFIC UPGRADE #================================================= @@ -67,7 +64,7 @@ ynh_add_fail2ban_config --logpath="$install_dir/var/logs/prod.log" --failregex=' if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Reconfiguring wallabag..." --weight=11 + ynh_script_progression --message="Reconfiguring wallabag..." --weight=1 # Copy and set Wallabag dist configuration ynh_add_config --template="../conf/parameters.yml" --destination="$install_dir/app/config/parameters.yml" @@ -97,14 +94,6 @@ fi ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_create" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_delete" -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= - -ynh_use_logrotate --non-append - #================================================= # SECURE FILES AND DIRECTORIES #=================================================