mirror of
https://github.com/YunoHost-Apps/nodered_ynh.git
synced 2024-09-03 19:46:25 +02:00
Drop log directory and use syslog
This commit is contained in:
parent
1ded04090a
commit
56a164c83d
6 changed files with 9 additions and 44 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue