mirror of
https://github.com/YunoHost-Apps/tracim_ynh.git
synced 2024-10-01 13:34:52 +02:00
Manage logs
This commit is contained in:
parent
d68eaa3b60
commit
a34c416e3c
9 changed files with 17 additions and 74 deletions
|
@ -9,4 +9,3 @@ threads = 8
|
|||
env = TRACIM_CONF_PATH=__FINALPATH__/backend/development.ini
|
||||
socket = /tmp/uwsgi-__APP__-caldav.socket
|
||||
chmod-socket = 660
|
||||
logto = /var/log/__APP__/__APP__-caldav.log
|
||||
|
|
|
@ -10,6 +10,3 @@ chmod-socket = 660
|
|||
workers = 4
|
||||
threads = 4
|
||||
env = TRACIM_CONF_PATH=__FINALPATH__/backend/development.ini
|
||||
logto = /var/log/__APP__/__APP__-web.log
|
||||
|
||||
|
||||
|
|
|
@ -9,4 +9,3 @@ threads = 8
|
|||
env = TRACIM_CONF_PATH=__FINALPATH__/backend/development.ini
|
||||
socket = /tmp/uwsgi-__APP__-webdav.socket
|
||||
chmod-socket = 660
|
||||
logto = /var/log/__APP__/__APP__-webdav.log
|
||||
|
|
|
@ -54,14 +54,9 @@ ynh_backup --src_path="$datadir" --is_big
|
|||
#=================================================
|
||||
|
||||
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
|
||||
#=================================================
|
||||
|
|
|
@ -82,7 +82,7 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_supervisor_action --service_name=$app --action="stop" --log_path="/var/log/supervisor/supervisord.log" #--line_match="line to match"
|
||||
ynh_supervisor_action --service_name=$app --action="stop" --log_path="/var/log/supervisor/supervisord.log"
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
|
@ -139,8 +139,8 @@ chown $app:$app "$final_path/frontend/configEnv.json"
|
|||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name="uwsgi" --action="restart" --log_path="/var/log/uwsgi/$app/$app.log"
|
||||
ynh_supervisor_action --service_name="$app" --action="restart" --log_path="/var/log/supervisor/supervisord.log" #--line_match="line to match"
|
||||
ynh_systemd_action --service_name="uwsgi" --action="restart" --log_path="/var/log/uwsgi/app/$app.log" --line_match="spawned uWSGI"
|
||||
ynh_supervisor_action --service_name="$app" --action="restart" --log_path="/var/log/supervisor/supervisord.log"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
|
@ -190,6 +190,7 @@ pushd "$final_path"
|
|||
popd
|
||||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_exec_warn_less ynh_package_autoremove
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
|
@ -220,22 +221,12 @@ ln -sf /etc/uwsgi/apps-available/$app-caldav.ini /etc/uwsgi/apps-enabled/$app-ca
|
|||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..."
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chown -R $app:$app "/var/log/$app"
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add uwsgi --log="/var/log/uwsgi/$app/$app.log"
|
||||
yunohost service add uwsgi --log="/var/log/uwsgi/app/$app.log"
|
||||
yunohost service add supervisor --log="/var/log/supervisor/supervisord.log"
|
||||
|
||||
#=================================================
|
||||
|
@ -244,8 +235,8 @@ yunohost service add supervisor --log="/var/log/supervisor/supervisord.log"
|
|||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name="uwsgi" --action="restart" --log_path="/var/log/uwsgi/$app/$app.log"
|
||||
ynh_supervisor_action --service_name="$app" --action="restart" --log_path="/var/log/supervisor/supervisord.log" #--line_match="line to match"
|
||||
ynh_systemd_action --service_name="uwsgi" --action="restart" --log_path="/var/log/uwsgi/app/$app.log" --line_match="spawned uWSGI"
|
||||
ynh_supervisor_action --service_name="$app" --action="restart" --log_path="/var/log/supervisor/supervisord.log"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
|
@ -61,15 +61,7 @@ ynh_secure_remove --file="/etc/uwsgi/apps-enabled/$app-webdav.ini"
|
|||
ynh_secure_remove --file="/etc/uwsgi/apps-available/$app-webdav.ini"
|
||||
ynh_secure_remove --file="/etc/uwsgi/apps-enabled/$app-caldav.ini"
|
||||
ynh_secure_remove --file="/etc/uwsgi/apps-available/$app-caldav.ini"
|
||||
ynh_systemd_action --service_name="uwsgi" --action="restart" --log_path="/var/log/uwsgi/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..."
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
ynh_systemd_action --service_name="uwsgi" --action="restart" --log_path="/var/log/uwsgi/app/$app.log" --line_match="spawned uWSGI"
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
|
@ -117,14 +109,6 @@ ynh_remove_app_dependencies
|
|||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE VARIOUS FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing various files..."
|
||||
|
||||
# Remove the log files
|
||||
ynh_secure_remove --file="/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -121,19 +121,12 @@ ynh_restore_file --origin_path="/etc/supervisor/conf.d/$app.conf"
|
|||
supervisorctl reread
|
||||
supervisorctl update
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add uwsgi --log="/var/log/uwsgi/$app/$app.log"
|
||||
yunohost service add uwsgi --log="/var/log/uwsgi/app/$app.log"
|
||||
yunohost service add supervisor --log="/var/log/supervisor/supervisord.log"
|
||||
|
||||
#=================================================
|
||||
|
@ -142,8 +135,8 @@ yunohost service add supervisor --log="/var/log/supervisor/supervisord.log"
|
|||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name="uwsgi" --action="restart" --log_path="/var/log/uwsgi/$app/$app.log"
|
||||
ynh_supervisor_action --service_name="$app" --action="restart" --log_path="/var/log/supervisor/supervisord.log" #--line_match="line to match"
|
||||
ynh_systemd_action --service_name="uwsgi" --action="restart" --log_path="/var/log/uwsgi/app/$app.log" --line_match="spawned uWSGI"
|
||||
ynh_supervisor_action --service_name="$app" --action="restart" --log_path="/var/log/supervisor/supervisord.log"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
|
@ -59,7 +59,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_supervisor_action --service_name=$app --action="stop" --log_path="/var/log/supervisor/supervisord.log" #--line_match="line to match"
|
||||
ynh_supervisor_action --service_name=$app --action="stop" --log_path="/var/log/supervisor/supervisord.log"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
|
@ -164,6 +164,7 @@ pushd "$final_path"
|
|||
popd
|
||||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_exec_warn_less ynh_package_autoremove
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
|
@ -194,20 +195,12 @@ ln -sf /etc/uwsgi/apps-available/$app-caldav.ini /etc/uwsgi/apps-enabled/$app-ca
|
|||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..."
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add uwsgi --log="/var/log/uwsgi/$app/$app.log"
|
||||
yunohost service add uwsgi --log="/var/log/uwsgi/app/$app.log"
|
||||
yunohost service add supervisor --log="/var/log/supervisor/supervisord.log"
|
||||
|
||||
#=================================================
|
||||
|
@ -216,16 +209,8 @@ yunohost service add supervisor --log="/var/log/supervisor/supervisord.log"
|
|||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name="uwsgi" --action="restart" --log_path="/var/log/uwsgi/$app/$app.log"
|
||||
ynh_supervisor_action --service_name="$app" --action="restart" --log_path="/var/log/supervisor/supervisord.log" #--line_match="line to match"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfiguring Fail2Ban..."
|
||||
|
||||
# Create a dedicated Fail2Ban config
|
||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
|
||||
ynh_systemd_action --service_name="uwsgi" --action="restart" --log_path="/var/log/uwsgi/app/$app.log" --line_match="spawned uWSGI"
|
||||
ynh_supervisor_action --service_name="$app" --action="restart" --log_path="/var/log/supervisor/supervisord.log"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
Loading…
Reference in a new issue