From 95db8cf952c4379efd5afeb4bd4c81e2c7038daa Mon Sep 17 00:00:00 2001 From: lapineige Date: Thu, 4 Aug 2022 18:08:26 +0200 Subject: [PATCH] Setup logrotate (#144) * Setup logrotate * Setup logrotate * Setup logrotate * Setup logrotate * Setup logrotate * bum version number * Auto-update README Co-authored-by: yunohost-bot --- README.md | 3 +-- README_fr.md | 3 +-- manifest.json | 2 +- scripts/backup | 6 ++++++ scripts/install | 10 ++++++++++ scripts/remove | 8 ++++++++ scripts/restore | 7 +++++++ scripts/upgrade | 6 ++++++ 8 files changed, 40 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b7d6298..b066f40 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,7 @@ 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). - -**Shipped version:** 2.5.1~ynh2 +**Shipped version:** 2.5.1~ynh3 **Demo:** https://demo.yunohost.org/wallabag/ diff --git a/README_fr.md b/README_fr.md index 14646fa..363d5db 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,8 +19,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour 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). - -**Version incluse :** 2.5.1~ynh2 +**Version incluse :** 2.5.1~ynh3 **Démo :** https://demo.yunohost.org/wallabag/ diff --git a/manifest.json b/manifest.json index fafbbb8..bc6231b 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "A self hostable read-it-later app", "fr": "Une application de lecture-plus-tard auto-hébergeable" }, - "version": "2.5.1~ynh2", + "version": "2.5.1~ynh3", "url": "https://www.wallabag.org", "upstream": { "license": "MIT", diff --git a/scripts/backup b/scripts/backup index 7c696c7..703fbd6 100644 --- a/scripts/backup +++ b/scripts/backup @@ -55,6 +55,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" + #================================================= # BACKUP FAIL2BAN CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index 5590651..218363f 100644 --- a/scripts/install +++ b/scripts/install @@ -158,6 +158,16 @@ ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_fil set_permissions +#================================================= +# SETUP LOGROTATE +#================================================= + +ynh_script_progression --message="Configuring log rotation..." +# Use logrotate to manage application logfile(s) +touch "$final_path/var/logs/prod.log" +ynh_use_logrotate "$final_path/var/logs/prod.log" +chown $app:www-data "$final_path/var/logs/prod.log" + #================================================= # SETUP FAIL2BAN #================================================= diff --git a/scripts/remove b/scripts/remove index 542c8a4..608fdf6 100644 --- a/scripts/remove +++ b/scripts/remove @@ -23,6 +23,14 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Removing logrotate configuration..." + +# Remove the app-specific logrotate config +ynh_remove_logrotate + #================================================= # REMOVE THE MYSQL DATABASE #================================================= diff --git a/scripts/restore b/scripts/restore index 17a42dc..333f8dc 100644 --- a/scripts/restore +++ b/scripts/restore @@ -78,6 +78,13 @@ 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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 27eff97..3ce5a5e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -186,6 +186,12 @@ ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_fil #================================================= # GENERIC FINALIZATION +#================================================= +# SETUP LOGROTATE +#================================================= + +ynh_use_logrotate --non-append + #================================================= # SECURE FILES AND DIRECTORIES #=================================================