Merge branch 'master' into antifascista

This commit is contained in:
f 2022-03-15 19:52:09 -03:00
commit 6c2e64f5cf
3 changed files with 33 additions and 0 deletions

View File

@ -2,3 +2,13 @@ ARG ALPINE_VERSION=3.13.6
ARG BASE_IMAGE=sutty/monit
FROM ${BASE_IMAGE}:${ALPINE_VERSION}
MAINTAINER "f <f@sutty.nl>"
ENV SRS_DOMAIN sutty.nl
ENV SRS_SECRET /etc/postsrsd.secret
RUN apk add --no-cache postsrsd
COPY ./monit.conf /etc/monit.d/postsrsd.conf
COPY ./postsrsd.sh /usr/local/bin/postsrsd
EXPOSE 10001
EXPOSE 10002

6
monit.conf Normal file
View File

@ -0,0 +1,6 @@
check process postsrsd with pidfile /tmp/postsrsd.pid
start program = "/usr/local/bin/postsrsd"
stop program = "/bin/sh -c 'cat /tmp/postsrsd.pid | xargs -r kill'"
if failed port 10001 for 3 cycles then restart
if failed port 10002 for 3 cycles then restart

17
postsrsd.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
set -e
export SRS_PID_FILE=/tmp/postsrsd.pid
case "$1" in
stop)
test -f "${SRS_PID_FILE}" && cat /tmp/postsrsd.pid | xargs -r kill
exit $?
;;
esac
test -n "${SRS_DOMAIN}"
test -n "${SRS_SECRET}"
test -f "${SRS_SECRET}" || dd if=/dev/urandom bs=18 count=1 status=none | base64 > "${SRS_SECRET}"
/usr/sbin/postsrsd -e -D -l 0.0.0.0 -u postsrsd -4