diff --git a/config/RECIPIENTS b/config/RECIPIENTS new file mode 100644 index 00000000..e680ab4c --- /dev/null +++ b/config/RECIPIENTS @@ -0,0 +1 @@ +your.mail@address.heres \ No newline at end of file diff --git a/systemd/stapps-proxy.service b/systemd/stapps-proxy.service new file mode 100644 index 00000000..36d0b008 --- /dev/null +++ b/systemd/stapps-proxy.service @@ -0,0 +1,23 @@ +[Unit] +Description=@openstapps/proxy +Documentation=https://gitlab.com/openstapps/proxy +After=network-online.target +Requires=network-online.target +OnFailure=stapps-unit-status-mail@%n.service + +[Service] +ExecStart=/usr/bin/env docker run --rm --net="host" \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v /opt/stapps-compose/proxy/ssl/chain.crt:/etc/nginx/certs/ssl.crt \ + -v /opt/stapps-compose/proxy/ssl/private.key:/etc/nginx/certs/ssl.key \ + -v /opt/stapps-compose/proxy/static:/static \ + registry.gitlab.com/openstapps/proxy/master +StartLimitBurst=2 +StartLimitIntervalSec=100s +Restart=always +RestartSec=20s +WorkingDirectory=/opt/stapps-compose/proxy +User=root + +[Install] +WantedBy=multi-user.target diff --git a/systemd/stapps-unit-status-mail.sh b/systemd/stapps-unit-status-mail.sh new file mode 100755 index 00000000..645f4390 --- /dev/null +++ b/systemd/stapps-unit-status-mail.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +MAILTO=`cat ../config/RECIPIENTS` +UNIT=$1 + +EXTRA="" +for e in "${@:2}"; do + EXTRA+="$e"$'\n' +done + +UNITSTATUS=$(systemctl status --lines=50 $UNIT) + +ssmtp $MAILTO <