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