From 92a2b48364d0c1c4f2850902414c2283797d9c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Van=20Der=20Biest?= Date: Fri, 28 Jul 2017 23:19:06 +0200 Subject: [PATCH] wsgi entrypoint and gunicorn server with proper stdout logging --- Dockerfile | 2 +- requirements.txt | 1 + webhooks.py | 4 ++-- wsgi.py | 4 ++++ 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 wsgi.py diff --git a/Dockerfile b/Dockerfile index f94f88e..ad08f48 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,4 +9,4 @@ RUN pip install -r requirements.txt COPY . /app EXPOSE 5000 -CMD ["python", "webhooks.py"] +CMD ["gunicorn", "--bind=0.0.0.0:5000", "--workers=3", "wsgi"] diff --git a/requirements.txt b/requirements.txt index 71d2e90..38c71f1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ Flask==0.12.2 ipaddress==1.0.18 requests==2.18.2 +gunicorn==19.9.0 \ No newline at end of file diff --git a/webhooks.py b/webhooks.py index 082c236..fb2ef69 100644 --- a/webhooks.py +++ b/webhooks.py @@ -16,8 +16,8 @@ # under the License. import logging -from sys import stderr, hexversion -logging.basicConfig(stream=stderr) +from sys import stdout, hexversion +logging.basicConfig(stream=stdout, level=logging.INFO) import hmac from hashlib import sha1 diff --git a/wsgi.py b/wsgi.py new file mode 100644 index 0000000..a6ed6a4 --- /dev/null +++ b/wsgi.py @@ -0,0 +1,4 @@ +from webhooks import application + +if __name__ == "__main__": + application.run(debug=False, host='0.0.0.0')