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