Skip to content
Browse files

migrate to production WSGI

  • Loading branch information
FAUSheppy committed Feb 22, 2020
1 parent 3498668 commit 68e72907869584ac18a3ed41fda76a1915a252f1
Showing with 24 additions and 1 deletion.
  1. +17 −0
  2. +7 −1 →
@@ -6,6 +6,23 @@ The config file uses *COMMA* as a separator, lines are comments if they start wi


# Running standalone with flask-inbuild server

usage: [-h] [-i INTERFACE] [-p PORT] [-c C]
Simple Webhook listener

optional arguments:
-h, --help show this help message and exit
Interface to listen on (default:
-p PORT, --port PORT Port to listen on (default: 5000)
-c C Config for handling of webhooks (default:

# Running with waitress (WSGI)

waitress-serve --host --port 5000 --call 'app:createApp'

# Running behind NGINX for SSL
You can (and should) run this tool behind a reverse proxy handling SSL. I recommend nginx with this configuration. Note the *proxy_next_upstream*-directive which tells nginx, that it should only report a timeout as bad gateway, since the backend will respond with certain error codes to ease debugging.

@@ -7,6 +7,7 @@
import subprocess

app = flask.Flask("webhook-listener")
app.config["EXEC_CONFIG"] = "webhook.config"
TOKEN_HEADER = "X-Gitlab-Token"
@@ -85,6 +86,11 @@ def readExecutionConfig(configFile):
projectIdent, token, scriptName = line.split(SEPERATOR)
config.update({projectIdent:(token, scriptName)})

def init():

if __name__ == "__main__":

parser = argparse.ArgumentParser(description="Simple Webhook listener", \
@@ -95,5 +101,5 @@ def readExecutionConfig(configFile):
parser.add_argument("-c", default="webhook.config", help="Config for handling of webhooks")
args = parser.parse_args()

app.config["EXEC_CONFIG"] = args.c, port=args.port)

0 comments on commit 68e7290

Please sign in to comment.
You can’t perform that action at this time.