From 34c4f38b52e583245701f3eeacbe4d3932d7b877 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Wed, 15 Sep 2021 14:14:23 +0200
Subject: [PATCH] Fix bug on corpus analysis startup
---
boot.sh | 4 +---
docker-compose.development.yml | 3 +++
nopaque.py | 8 --------
requirements.txt | 7 ++++---
4 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/boot.sh b/boot.sh
index 23edce22..6d3a57e8 100755
--- a/boot.sh
+++ b/boot.sh
@@ -1,7 +1,5 @@
#!/bin/bash
-
source venv/bin/activate
-
if [[ "${NOPAQUE_DAEMON_ENABLED:-True}" == "True" ]]; then
echo "INFO Starting nopaque daemon process..."
./nopaque-daemon.sh &
@@ -16,7 +14,7 @@ if [[ "${#}" -eq 0 ]]; then
echo "Deploy command failed, retrying in 5 secs..."
sleep 5
done
- python nopaque.py
+ gunicorn $([ "${ENABLE_GUNICORN_RELOAD:-False}" == "True" ] && echo "--reload") --worker-class eventlet -b :5000 -w 1 nopaque:app
elif [[ "${1}" == "flask" ]]; then
exec ${@:1}
else
diff --git a/docker-compose.development.yml b/docker-compose.development.yml
index 564eae38..e164f1ad 100644
--- a/docker-compose.development.yml
+++ b/docker-compose.development.yml
@@ -2,6 +2,8 @@ version: "3.5"
services:
nopaque:
+ environment:
+ - ENABLE_GUNICORN_RELOAD=True
ports:
- "5000:5000"
volumes:
@@ -11,5 +13,6 @@ services:
- "./config.py:/home/nopaque/config.py"
- "./migrations:/home/nopaque/migrations"
- "./nopaque.py:/home/nopaque/nopaque.py"
+ - "./nopaque-daemon.sh:/home/nopaque/nopaque-daemon.sh"
- "./requirements.txt:/home/nopaque/requirements.txt"
- "./tests:/home/nopaque/tests"
diff --git a/nopaque.py b/nopaque.py
index 1e32e381..faa1dd2d 100644
--- a/nopaque.py
+++ b/nopaque.py
@@ -1,8 +1,6 @@
# First things first: apply monkey patch, so that no code gets executed without
# patched libraries!
import eventlet
-
-
eventlet.monkey_patch()
@@ -26,9 +24,3 @@ def make_shell_context():
'QueryResult': QueryResult,
'Role': Role,
'User': User}
-
-
-if __name__ == '__main__':
- host = '0.0.0.0'
- port = 5000
- socketio.run(app, host=host, port=port)
diff --git a/requirements.txt b/requirements.txt
index d4e23941..8d9b0668 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,7 +1,7 @@
cqi
docker
-eventlet
-Flask~=1.1.0
+eventlet==0.30.2
+Flask~=1.1
Flask-Assets
Flask-HTTPAuth
Flask-Login
@@ -9,9 +9,10 @@ Flask-Mail
Flask-Migrate
Flask-Paranoid
Flask-RESTX
-Flask-SocketIO~=5.0.0
+Flask-SocketIO~=5.1
Flask-SQLAlchemy
Flask-WTF
+gunicorn
jsonpatch
jsonschema
psycopg2