diff --git a/conf/systemd.service b/conf/systemd.service index cb7d3f7..56ac7ee 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ WorkingDirectory=__FINALPATH__/ Environment="__YNH_NODE_LOAD_PATH__" ExecStart=__YNH_NODE__ red.js -p __PORT__ -u __FINALPATH__/data -StandardOutput=append:/var/log/__APP__/__APP__.log +StandardOutput=syslog StandardError=inherit # Sandboxing options to harden security diff --git a/scripts/backup b/scripts/backup index a47c764..4a572dc 100755 --- a/scripts/backup +++ b/scripts/backup @@ -45,12 +45,6 @@ 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 #================================================= diff --git a/scripts/install b/scripts/install index e6cb691..ad941ee 100755 --- a/scripts/install +++ b/scripts/install @@ -132,19 +132,11 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate - #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --description="Low-code programming for event-driven applications" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Low-code programming for event-driven applications" --log_type="systemd" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/remove b/scripts/remove index e9fb896..f8743af 100755 --- a/scripts/remove +++ b/scripts/remove @@ -64,22 +64,9 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - -# Remove the app-specific logrotate config -ynh_remove_logrotate - #================================================= # SPECIFIC REMOVE #================================================= -# REMOVE THE LOG FILE -#================================================= - -# Remove the log files -ynh_secure_remove --file="/var/log/$app" #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index a4820f7..0d29ed6 100755 --- a/scripts/restore +++ b/scripts/restore @@ -95,12 +95,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=3 ynh_systemd_action --service_name=$app --action="start" -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index bccbec5..f3e3c7e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -97,6 +97,12 @@ elif [[ ! -f "$final_path/data/flows.json" && -f "$final_path/data/>>" ]]; then mv "$final_path/data/>>" "$final_path/data/flows.json" fi +# Remove logrotate and log directory, we use syslog now +if [[ -d "/etc/logrotate.d/$app" ]]; then + ynh_remove_logrotate + ynh_secure_remove --file="/var/log/$app" +fi + #================================================= # CLOSING PORT #================================================= @@ -184,14 +190,6 @@ if [[ "${PACKAGE_CHECK_EXEC:-}" = "1" ]] ; then ynh_add_config --template="../conf/flows.json" --destination="$final_path/data/flows.json" fi -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append - #================================================= # SETUP SYSTEMD #================================================= @@ -217,7 +215,7 @@ chmod a-w "$final_path/data/settings.js" # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --description="Low-code programming for event-driven applications" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Low-code programming for event-driven applications" --log_type="systemd" #================================================= # START SYSTEMD SERVICE