This commit is contained in:
f 2020-09-04 10:19:00 -03:00
parent c06dc5a527
commit 7484c64be2
3 changed files with 33 additions and 0 deletions

View File

@ -1,2 +1,12 @@
FROM sutty/monit:latest
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