-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from panubo/upgrade_debian12
Upgrade to debian 12 and add postfix_exporter
- Loading branch information
Showing
10 changed files
with
157 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
: "${CONFIG_RELOADER_ENABLED:=false}" | ||
|
||
if [[ "${CONFIG_RELOADER_ENABLED}" == "true" ]]; then | ||
# Shutdown everything and exit the process crashes or is stopped. | ||
s6-svscanctl -t /etc/s6 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script watches the known TLS cert and keys for changes (`mv` or updated Kubernetes secret) then reloads postfix. | ||
|
||
: "${CONFIG_RELOADER_ENABLED:=false}" | ||
|
||
if [[ "${CONFIG_RELOADER_ENABLED}" != "true" ]]; then | ||
echo "config-reloader >> Config reloader is not being started" | ||
s6-svc -d "$(pwd)" | ||
exit | ||
fi | ||
|
||
watch_files=( | ||
"${TLS_CRT:-/etc/ssl/certs/ssl-cert-snakeoil.pem}" | ||
"${TLS_KEY:-/etc/ssl/private/ssl-cert-snakeoil.key}" | ||
"${CLIENT_TLS_KEY:-/etc/ssl/certs/ssl-cert-snakeoil.pem}" | ||
"${CLIENT_TLS_CRT:-/etc/ssl/private/ssl-cert-snakeoil.key}" | ||
) | ||
|
||
# Start infinite loop | ||
while true; do | ||
postfix reload | ||
echo "config-reloader >> Waiting on config changes..." | ||
# delete_self is the event that triggers when the link is removed and replaced. | ||
inotifywait --event delete_self "${watch_files[@]}" | ||
# sleep to prevent race condition | ||
sleep 3 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
mkdir /var/log/s6-maillog | ||
chown postfix:postfix /var/log/s6-maillog | ||
|
||
exec s6-setuidgid postfix s6-log -bp 1 n3 s10000000 /var/log/s6-maillog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [[ "${POSTFIX_EXPORTER_ENABLED}" == "true" ]]; then | ||
# Shutdown everything and exit the process crashes or is stopped. | ||
s6-svscanctl -t /etc/s6 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
[ "$DEBUG" == 'true' ] && set -x | ||
|
||
# Defaults | ||
: "${LOGOUTPUT:=/dev/stdout}" | ||
|
||
if [[ "${POSTFIX_EXPORTER_ENABLED}" == "true" ]] && [[ "${LOGOUTPUT}" != "/dev/stdout" ]]; then | ||
echo "postfix_exporter >> FATAL exporter is enabled but requires LOGOUTPUT is set to /dev/stdout" | ||
s6-svscanctl -t /etc/s6 | ||
exit 1 | ||
elif [[ "${POSTFIX_EXPORTER_ENABLED}" == "true" ]]; then | ||
s6-svwait -u /etc/s6/postfix/log | ||
echo "postfix_exporter >> Starting postfix_exporter" | ||
exec s6-setuidgid postfix postfix_exporter --postfix.logfile_path=/var/log/s6-maillog/current | ||
fi | ||
|
||
echo "postfix_exporter >> POSTFIX_EXPORTER_ENABLED not \"true\", not starting postfix_exporter" | ||
|
||
s6-svc -d "$(pwd)" | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters