diff --git a/res/fs-quiz-tool.nginx.conf b/res/fs-quiz-tool.nginx.conf index ff40b73..4b1ae7b 100644 --- a/res/fs-quiz-tool.nginx.conf +++ b/res/fs-quiz-tool.nginx.conf @@ -3,7 +3,7 @@ server { server_name quiz.fasttube.de; - root /root/fs-quiz-tool/web; + root /opt/fs-quiz-tool/web; index index.html; @@ -15,8 +15,6 @@ server { location /db { proxy_pass http://127.0.0.1:12345; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; } ssl_certificate /usr/local/etc/letsencrypt/live/quiz.fasttube.de/fullchain.pem; diff --git a/res/fs-quiz-tool.openrc b/res/fs-quiz-tool.openrc new file mode 100644 index 0000000..28c0d14 --- /dev/null +++ b/res/fs-quiz-tool.openrc @@ -0,0 +1,29 @@ +#!/sbin/openrc-run + +name="$RC_SVCNAME" +directory="/opt/fs-quiz-tool" +command="/opt/fs-quiz-tool/.venv/bin/python" +command_args="-m fs-quiz-tool-db" +command_user="www" +pidfile="/run/$RC_SVCNAME/$RC_SVCNAME.pid" +command_background="yes" + +depend() { + need net +} + +start_pre() { + checkpath --directory --owner $command_user:$command_user --mode 0775 \ + /run/$RC_SVCNAME /var/log/$RC_SVCNAME +} + +start() { + ebegin "Starting ${RC_SVCNAME}" + start-stop-daemon --start --exec ${command} \ + --background --make-pidfile --pidfile ${pidfile} \ + --chdir ${directory} \ + --stdout /var/log/fs-quiz-tool/out.log \ + --stderr /var/log/fs-quiz-tool/err.log \ + -- ${command_args} + eend $? +}