From f337bfc083794731d1bc9a38fda6632e41975624 Mon Sep 17 00:00:00 2001 From: girst Date: Sat, 25 Jul 2020 16:39:02 +0200 Subject: [PATCH] fix loading webhooks as frontend module, simplify startup.sh --- app/webhooks/__init__.py | 2 +- config/startup.sh | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/webhooks/__init__.py b/app/webhooks/__init__.py index 8853fd8..61a830d 100755 --- a/app/webhooks/__init__.py +++ b/app/webhooks/__init__.py @@ -9,7 +9,7 @@ import sqlite3 from flask import Flask, Blueprint, request from urllib.parse import parse_qs, urlparse -from common.common import * +from ..common.common import * frontend = Blueprint('webhooks', __name__) diff --git a/config/startup.sh b/config/startup.sh index 4819460..863e2a1 100755 --- a/config/startup.sh +++ b/config/startup.sh @@ -1,13 +1,13 @@ #!/bin/sh -export CONFIG_DIR=/opt/yt/config/ -export VENV_ROOT=/opt/yt/venv/ -export MOD_DIR=/opt/yt/ -export APP_DIR=/opt/yt/app/ +MOD_DIR=/opt/yt/ +VENV_DIR="/opt/yt/venv/" +CONFIG_DIR="/opt/yt/config/" -# iptables -A INPUT -p tcp -m multiport --destination-ports 8800,8801 -j ACCEPT - -. "$VENV_ROOT/bin/activate" export YT_CONFIG="$CONFIG_DIR/config.ini" -gunicorn --config="$CONFIG_DIR/gunicorn-frontend-config.py" --chdir="$MOD_DIR" --daemon app:app -gunicorn --config="$CONFIG_DIR/gunicorn-webhooks-config.py" --chdir="$APP_DIR" --daemon 'webhooks:app()' + +PATH="$VENV_DIR/bin" gunicorn --config="$CONFIG_DIR/gunicorn-frontend-config.py" --chdir="$MOD_DIR" --daemon app:app +PATH="$VENV_DIR/bin" gunicorn --config="$CONFIG_DIR/gunicorn-webhooks-config.py" --chdir="$MOD_DIR" --daemon 'app.webhooks:app()' + +# hacky redirect to https, optional: +# nc -lkc 'read http path proto; printf "HTTP/1.1 301 Moved\\nLocation: https://localhost/%s\\n\\n" $path' >/dev/null 2>&1 80 & -- 2.39.3