From 64cc239d5b741a0d1e99d3aa430aa9792362c97b Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 12 Mar 2024 23:49:49 -0400 Subject: [PATCH 1/2] fix: use copytruncate in logrotate commands While using create is more correct, logs in Dokku are considered ephemeral, and thus shouldn't be considered subject to the more comprehensive log retention standards one might require out of a logging system. By switching to copytruncate, we can ensure that logs mounted from within containers do not have that matched the old settings (closes #6633) and cases where the log file is written by a user other than the one specified in the old logrotate settings (closes #4000). --- plugins/20_events/install | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/plugins/20_events/install b/plugins/20_events/install index 9a352e198..b0765874e 100755 --- a/plugins/20_events/install +++ b/plugins/20_events/install @@ -16,24 +16,24 @@ trigger-events-install() { # exits gracefully if the path already exists mkdir -m 775 -p "$DOKKU_LOGS_DIR" case "$DOKKU_DISTRO" in - arch | debian | raspbian) - chgrp dokku "$DOKKU_LOGS_DIR" - ;; - *) - chown syslog:dokku "$DOKKU_LOGS_DIR" - ;; + arch | debian | raspbian) + chgrp dokku "$DOKKU_LOGS_DIR" + ;; + *) + chown syslog:dokku "$DOKKU_LOGS_DIR" + ;; esac if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then touch "$DOKKU_EVENTS_LOGFILE" case "$DOKKU_DISTRO" in - arch | debian | raspbian) - chgrp dokku "$DOKKU_EVENTS_LOGFILE" - ;; - *) - # chown syslog:root might not work on SUSE - chown syslog:dokku "$DOKKU_EVENTS_LOGFILE" - ;; + arch | debian | raspbian) + chgrp dokku "$DOKKU_EVENTS_LOGFILE" + ;; + *) + # chown syslog:root might not work on SUSE + chown syslog:dokku "$DOKKU_EVENTS_LOGFILE" + ;; esac chmod 664 "$DOKKU_EVENTS_LOGFILE" fi @@ -56,16 +56,12 @@ EOF cat >"$DOKKU_LOGROTATE_FILE" </dev/null || true - endscript - create 664 syslog dokku + notifempty + copytruncate } EOF From 76dd78e441b41fed9415b9ffe010f78bad6446fe Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 13 Mar 2024 01:51:16 -0400 Subject: [PATCH 2/2] chore: run shfmt --- plugins/20_events/install | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/20_events/install b/plugins/20_events/install index b0765874e..ffebb1977 100755 --- a/plugins/20_events/install +++ b/plugins/20_events/install @@ -16,24 +16,24 @@ trigger-events-install() { # exits gracefully if the path already exists mkdir -m 775 -p "$DOKKU_LOGS_DIR" case "$DOKKU_DISTRO" in - arch | debian | raspbian) - chgrp dokku "$DOKKU_LOGS_DIR" - ;; - *) - chown syslog:dokku "$DOKKU_LOGS_DIR" - ;; + arch | debian | raspbian) + chgrp dokku "$DOKKU_LOGS_DIR" + ;; + *) + chown syslog:dokku "$DOKKU_LOGS_DIR" + ;; esac if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then touch "$DOKKU_EVENTS_LOGFILE" case "$DOKKU_DISTRO" in - arch | debian | raspbian) - chgrp dokku "$DOKKU_EVENTS_LOGFILE" - ;; - *) - # chown syslog:root might not work on SUSE - chown syslog:dokku "$DOKKU_EVENTS_LOGFILE" - ;; + arch | debian | raspbian) + chgrp dokku "$DOKKU_EVENTS_LOGFILE" + ;; + *) + # chown syslog:root might not work on SUSE + chown syslog:dokku "$DOKKU_EVENTS_LOGFILE" + ;; esac chmod 664 "$DOKKU_EVENTS_LOGFILE" fi