- Use gunicorn

- Add env variable GUNICORN_WORKERS (default: 1)
- new Port (8000)
- You don't need to run "flask deploy" by hand anymore
This commit is contained in:
Patrick Jentsch 2020-04-20 10:11:45 +02:00
parent f91583484e
commit 15373ed00f
5 changed files with 12 additions and 14 deletions

View File

@ -8,7 +8,7 @@ ENV FLASK_APP=nopaque.py
ENV LANG=C.UTF-8
EXPOSE 5000
EXPOSE 8000
RUN apt-get update \

View File

@ -5,10 +5,8 @@ wait-for-it db:5432 --strict --timeout=0
echo "Waiting for redis..."
wait-for-it redis:6379 --strict --timeout=0
if [ $# -eq 0 ]; then
venv/bin/python nopaque.py
elif [ $1 == "flask" ]; then
venv/bin/python -m $@
else
echo "Unknown command"
fi
GUNICORN_WORKERS="${GUNICORN_WORKERS:-1}"
source venv/bin/activate
flask deploy
gunicorn --bind :5000 --workers "${GUNICORN_WORKERS}" --worker-class eventlet nopaque:app

View File

@ -14,7 +14,7 @@ GITLAB_PASSWORD=
### Flask ###
FLASK_CONFIG=
# SECRET_KEY=
SECRET_KEY=
### Flask-Mail ###
MAIL_SERVER=
@ -24,6 +24,9 @@ MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_DEFAULT_SENDER=
### Gunicorn ###
GUNICORN_WORKERS=
### nopaque ###
NOPAQUE_ADMIN=
NOPAQUE_STORAGE=

View File

@ -1,6 +1,6 @@
import eventlet
eventlet.monkey_patch() # noqa
from app import create_app, db, socketio
from app import create_app, db
from app.models import Corpus, Job, Role, User
from flask_migrate import Migrate, upgrade
import os
@ -34,7 +34,3 @@ def test():
import unittest
tests = unittest.TestLoader().discover('tests')
unittest.TextTestRunner(verbosity=2).run(tests)
if __name__ == '__main__':
socketio.run(app, host='0.0.0.0')

View File

@ -7,6 +7,7 @@ Flask-SocketIO
Flask-SQLAlchemy
Flask-Table
Flask-WTF
gunicorn
jsonpatch
psycopg2
redis