mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +00:00
Change the scaling logic and switch back to the socketio web server
This commit is contained in:
parent
ccdd0d3faa
commit
fc1389e8b1
8
.env.tpl
8
.env.tpl
@ -108,14 +108,14 @@ NOPAQUE_ADMIN=
|
||||
# Swarm nodes
|
||||
# NOPAQUE_DATA_DIR=
|
||||
|
||||
# CHOOSE ONE: False, True
|
||||
# DEFAULT: True
|
||||
# NOPAQUE_DAEMON_ENABLED=
|
||||
|
||||
# NOTE: Get these from the nopaque development team
|
||||
NOPAQUE_DOCKER_REGISTRY_USERNAME=
|
||||
NOPAQUE_DOCKER_REGISTRY_PASSWORD=
|
||||
|
||||
# CHOOSE ONE: False, True
|
||||
# DEFAULT: True
|
||||
# NOPAQUE_IS_PRIMARY_INSTANCE=
|
||||
|
||||
# transport://[userid:password]@hostname[:port]/[virtual_host]
|
||||
NOPAQUE_SOCKETIO_MESSAGE_QUEUE_URI=
|
||||
|
||||
|
@ -125,8 +125,6 @@ def import_corpus():
|
||||
db.session.add(corpus_file)
|
||||
db.session.flush(objects=[corpus_file])
|
||||
db.session.refresh(corpus)
|
||||
current_app.logger.warning(vrt_file)
|
||||
current_app.logger.warning(corpus_file.path)
|
||||
try:
|
||||
shutil.copy2(vrt_file, corpus_file.path)
|
||||
except Exception as e:
|
||||
|
27
boot.sh
27
boot.sh
@ -1,26 +1,21 @@
|
||||
#!/bin/bash
|
||||
source venv/bin/activate
|
||||
if [[ "${#}" -eq 0 ]]; then
|
||||
while true; do
|
||||
echo "INFO Run deployment tasks..."
|
||||
flask deploy
|
||||
if [[ "${?}" == "0" ]]; then
|
||||
break
|
||||
fi
|
||||
echo "WARNING ...Failed, retrying in 5 secs..."
|
||||
sleep 5
|
||||
done
|
||||
if [[ "${NOPAQUE_DAEMON_ENABLED:-True}" == "True" ]]; then
|
||||
if [[ "${NOPAQUE_IS_PRIMARY_INSTANCE:-True}" == "True" ]]; then
|
||||
while true; do
|
||||
echo "INFO Run deployment tasks..."
|
||||
flask deploy
|
||||
if [[ "${?}" == "0" ]]; then
|
||||
break
|
||||
fi
|
||||
echo "WARNING ...Failed, retrying in 5 secs..."
|
||||
sleep 5
|
||||
done
|
||||
echo "INFO Start nopaque daemon..."
|
||||
flask daemon run &
|
||||
fi
|
||||
echo "INFO Start nopaque..."
|
||||
gunicorn \
|
||||
--error-logfile - \
|
||||
$([ "${ENABLE_GUNICORN_RELOAD:-False}" == "True" ] && echo "--reload") \
|
||||
--worker-class eventlet \
|
||||
-b :5000 \
|
||||
-w 1 nopaque:app
|
||||
python nopaque.py
|
||||
elif [[ "${1}" == "flask" ]]; then
|
||||
exec ${@:1}
|
||||
else
|
||||
|
@ -47,8 +47,8 @@ class Config:
|
||||
|
||||
''' # nopaque # '''
|
||||
NOPAQUE_ADMIN = os.environ.get('NOPAQUE_ADMIN')
|
||||
NOPAQUE_DAEMON_ENABLED = \
|
||||
os.environ.get('NOPAQUE_DAEMON_ENABLED', 'true').lower() == 'true'
|
||||
NOPAQUE_IS_PRIMARY_INSTANCE = \
|
||||
os.environ.get('NOPAQUE_IS_PRIMARY_INSTANCE', 'true').lower() == 'true'
|
||||
NOPAQUE_DATA_DIR = \
|
||||
os.path.abspath(os.environ.get('NOPAQUE_DATA_DIR', '/mnt/nopaque'))
|
||||
NOPAQUE_DOCKER_REGISTRY = 'gitlab.ub.uni-bielefeld.de:4567'
|
||||
|
@ -2,8 +2,6 @@ version: "3.5"
|
||||
|
||||
services:
|
||||
nopaque:
|
||||
environment:
|
||||
- ENABLE_GUNICORN_RELOAD=True
|
||||
ports:
|
||||
- "5000:5000"
|
||||
volumes:
|
||||
|
@ -3,4 +3,4 @@ version: "3.5"
|
||||
services:
|
||||
nopaque:
|
||||
environment:
|
||||
- NOPAQUE_DAEMON_ENABLED=False
|
||||
- NOPAQUE_IS_PRIMARY_INSTANCE=False
|
||||
|
10
nopaque.py
10
nopaque.py
@ -3,7 +3,7 @@
|
||||
import eventlet
|
||||
eventlet.monkey_patch()
|
||||
|
||||
from app import db, cli, create_app # noqa
|
||||
from app import db, cli, create_app, socketio # noqa
|
||||
from app.models import (
|
||||
Corpus,
|
||||
CorpusFile,
|
||||
@ -46,3 +46,11 @@ def make_shell_context() -> Dict[str, Any]:
|
||||
'TranskribusHTRModel': TranskribusHTRModel,
|
||||
'User': User
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
socketio.run(app, host='0.0.0.0')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -14,7 +14,6 @@ Flask-RESTX
|
||||
Flask-SocketIO~=5.1
|
||||
Flask-SQLAlchemy
|
||||
Flask-WTF
|
||||
gunicorn
|
||||
hiredis
|
||||
jsonschema
|
||||
MarkupSafe==2.0.1
|
||||
|
Loading…
Reference in New Issue
Block a user