mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 10:54:18 +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:
|
||||||
|
9
boot.sh
9
boot.sh
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
if [[ "${#}" -eq 0 ]]; then
|
if [[ "${#}" -eq 0 ]]; then
|
||||||
|
if [[ "${NOPAQUE_IS_PRIMARY_INSTANCE:-True}" == "True" ]]; then
|
||||||
while true; do
|
while true; do
|
||||||
echo "INFO Run deployment tasks..."
|
echo "INFO Run deployment tasks..."
|
||||||
flask deploy
|
flask deploy
|
||||||
@ -10,17 +11,11 @@ if [[ "${#}" -eq 0 ]]; then
|
|||||||
echo "WARNING ...Failed, retrying in 5 secs..."
|
echo "WARNING ...Failed, retrying in 5 secs..."
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
if [[ "${NOPAQUE_DAEMON_ENABLED:-True}" == "True" ]]; then
|
|
||||||
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