From a27e6948d0c054d6e93c7737b1a38bf2d15a0b89 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Wed, 23 May 2018 21:22:00 +0200 Subject: [PATCH] Fix logrotate and YunoHost service definition --- scripts/backup | 6 ++++++ scripts/install | 6 +++++- scripts/restore | 9 +-------- scripts/upgrade | 3 ++- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/scripts/backup b/scripts/backup index 1250b27..d0fe227 100644 --- a/scripts/backup +++ b/scripts/backup @@ -44,6 +44,12 @@ ynh_backup "$final_path" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup "/etc/logrotate.d/$app" + #================================================= # BACKUP SYSTEMD #================================================= diff --git a/scripts/install b/scripts/install index fb1c284..6363f69 100644 --- a/scripts/install +++ b/scripts/install @@ -289,6 +289,8 @@ mkdir "$final_path/tmp/sockets" # Set permissions to app files chown -R $app: $final_path +# Restrict rights to log directory (needed by logrotate) +chmod g-w $final_path/log #================================================= # SETUP LOGROTATE @@ -296,12 +298,14 @@ chown -R $app: $final_path # Use logrotate to manage application logfile(s) ynh_use_logrotate "$final_path/log/unicorn.stderr.log" +ynh_use_logrotate "$final_path/log/unicorn.stdout.log" +ynh_use_logrotate "$final_path/log/production.log" #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --log "$final_path/log/unicorn.stderr.log" +yunohost service add $app --log "$final_path/log/unicorn.stderr.log" "$final_path/log/unicorn.stdout.log" "$final_path/log/production.log" #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index 56f4fc6..c1c56b3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -92,12 +92,6 @@ ynh_psql_execute_file_as_root ./db.sql "$db_name" systemctl daemon-reload systemctl enable $app.service -#================================================= -# SETUP LOGROTATE -#================================================= - -ynh_use_logrotate - #================================================= # RECREATE OF THE DEDICATED USER #================================================= @@ -110,13 +104,12 @@ ynh_system_user_create $app $final_path 1 #================================================= chown -R $app: $final_path -chown -R $app: /var/log/$app #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --log "$final_path/log/unicorn.stderr.log" +yunohost service add $app --log "$final_path/log/unicorn.stderr.log" "$final_path/log/unicorn.stdout.log" "$final_path/log/production.log" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index eb254bc..ec1bbb7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -187,7 +187,8 @@ if ! ynh_is_upstream_up_to_date ; then # Set permissions to app files chown -R $app: $final_path - + # Restrict rights to log directory (needed by logrotate) + chmod g-w $final_path/log fi #================================================= # SETUP SSOWAT