Install gevent-websocket and use it by default until we have a better solution (#850)

* Install `gevent-websocket` and use it by default until we have a better solution
* May help with #849
This commit is contained in:
Kevin Chung
2019-01-24 02:47:50 -05:00
committed by GitHub
parent 06f0715369
commit ae8ce0b430
3 changed files with 6 additions and 4 deletions

View File

@@ -209,8 +209,8 @@ class Config(object):
Example: /ctfd
SOCKETIO_ASYNC_MODE:
Specifies what async mode SocketIO should use. The simplest but least performant option is 'threading'.
Switching to a different async mode is not recommended without the appropriate load balancing mechanisms
Specifies what async mode SocketIO should use.
Specifying your own async mode is not recommended without the appropriate load balancing mechanisms
in place and proper understanding of how websockets are supported by Flask.
https://flask-socketio.readthedocs.io/en/latest/#deployment
'''
@@ -219,7 +219,7 @@ class Config(object):
SQLALCHEMY_TRACK_MODIFICATIONS = (not os.getenv("SQLALCHEMY_TRACK_MODIFICATIONS")) # Defaults True
UPDATE_CHECK = (not os.getenv("UPDATE_CHECK")) # Defaults True
APPLICATION_ROOT = os.getenv('APPLICATION_ROOT') or '/'
SOCKETIO_ASYNC_MODE = os.getenv('SOCKETIO_ASYNC_MODE') or 'threading'
SOCKETIO_ASYNC_MODE = os.getenv('SOCKETIO_ASYNC_MODE')
'''
=== OAUTH ===

View File

@@ -2,6 +2,7 @@
set -eo pipefail
WORKERS=${WORKERS:-1}
WORKER_CLASS=${WORKER_CLASS:-geventwebsocket.gunicorn.workers.GeventWebSocketWorker}
ACCESS_LOG=${ACCESS_LOG:--}
ERROR_LOG=${ERROR_LOG:--}
@@ -40,6 +41,6 @@ echo "Starting CTFd"
exec gunicorn 'CTFd:create_app()' \
--bind '0.0.0.0:8000' \
--workers $WORKERS \
--worker-class 'gevent' \
--worker-class "$WORKER_CLASS" \
--access-logfile "$ACCESS_LOG" \
--error-logfile "$ERROR_LOG"

View File

@@ -20,6 +20,7 @@ netaddr==0.7.19
redis==2.10.6
datafreeze==0.1.0
gevent==1.3.7
gevent-websocket==0.10.1
python-dotenv==0.9.1
flask-restplus==0.12.1
pathlib2==2.3.2