From 5be9db78f20c7e64a33718e73fd1132adb0ac225 Mon Sep 17 00:00:00 2001 From: Giordon Stark Date: Wed, 4 Jun 2025 09:43:55 -0700 Subject: [PATCH 1/5] use gevent instead --- setting/requirements-pip.txt | 1 + viewer/app.py | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/setting/requirements-pip.txt b/setting/requirements-pip.txt index 272c2989b..55a6fb09d 100644 --- a/setting/requirements-pip.txt +++ b/setting/requirements-pip.txt @@ -8,6 +8,7 @@ Flask-Mail Flask-PyMongo == 2.3.0 Flask-Session Flask-SocketIO +gevent ~= 25.5 influxdb itkdb[eos] >= 0.6.14 itksn >= 0.4.2 diff --git a/viewer/app.py b/viewer/app.py index 4cb89f9fd..d6dd907b5 100755 --- a/viewer/app.py +++ b/viewer/app.py @@ -59,15 +59,16 @@ logger = logging.getLogger("localdb") # ============================== # setupLogging("logs/development.log") +app_kwargs = {"host": "0.0.0.0", "port": args.fport, "debug": False} # ============================== # Setup SSL Certificate # ============================== if args.fcert and args.fkey: context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) context.load_cert_chain(args.fcert, args.fkey) + app_kwargs["ssl_context"] = context localdb_url = "https" + localdb_url else: - context = None localdb_url = "http" + localdb_url # app @@ -210,10 +211,8 @@ def truncate_uid(uid, front=6, back=6): if __name__ == "__main__": # check_latest_localdb_version() check_gitlab_announcements() + socketio.run( app, - host="0.0.0.0", - port=args.fport, - debug=False, - ssl_context=context, + **app_kwargs, ) -- GitLab From ac05bfdbcaa329401efbb8000441b5f64166448f Mon Sep 17 00:00:00 2001 From: Giordon Stark Date: Wed, 4 Jun 2025 10:01:39 -0700 Subject: [PATCH 2/5] why did this use request_uri? that's wrong --- viewer/functions/common.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/viewer/functions/common.py b/viewer/functions/common.py index b366e8745..d9b5a830c 100755 --- a/viewer/functions/common.py +++ b/viewer/functions/common.py @@ -409,9 +409,8 @@ class PrefixMiddleware: self.prefix = prefix def __call__(self, environ, start_response): - if environ["REQUEST_URI"].startswith(self.prefix): - if environ["PATH_INFO"].startswith(self.prefix): - environ["PATH_INFO"] = environ["PATH_INFO"][len(self.prefix) :] + if environ["PATH_INFO"].startswith(self.prefix): + environ["PATH_INFO"] = environ["PATH_INFO"][len(self.prefix) :] environ["SCRIPT_NAME"] = self.prefix return self.app(environ, start_response) start_response("404", [("Content-Type", "text/plain")]) -- GitLab From 5c0356a798dc78557994ee529e901a1351852270 Mon Sep 17 00:00:00 2001 From: Giordon Stark Date: Wed, 4 Jun 2025 10:19:17 -0700 Subject: [PATCH 3/5] freeze more versions --- setting/requirements-pip.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/setting/requirements-pip.txt b/setting/requirements-pip.txt index 55a6fb09d..89289000c 100644 --- a/setting/requirements-pip.txt +++ b/setting/requirements-pip.txt @@ -2,12 +2,12 @@ arguments arrow cachecontrol==0.14.1 filetype -Flask -Flask-HTTPAuth -Flask-Mail +Flask>=3.1.1 +Flask-HTTPAuth == 4.8.0 +Flask-Mail == 0.10.0 Flask-PyMongo == 2.3.0 -Flask-Session -Flask-SocketIO +Flask-Session == 0.8.0 +Flask-SocketIO == 5.5.1 gevent ~= 25.5 influxdb itkdb[eos] >= 0.6.14 @@ -30,4 +30,6 @@ PyYAML requests rich scipy +simple-websocket==1.1.0 tzlocal +werkzeug==3.1.3 -- GitLab From 3e522d3769c998c018338a7160fea629daf74dbb Mon Sep 17 00:00:00 2001 From: Giordon Stark Date: Wed, 4 Jun 2025 10:31:45 -0700 Subject: [PATCH 4/5] freeze flask to 3.0.3 before Partitioned see https://gitlab.cern.ch/YARR/localdb-tools/-/merge_requests/263#note_9641229 --- setting/requirements-pip.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setting/requirements-pip.txt b/setting/requirements-pip.txt index 89289000c..d34e11222 100644 --- a/setting/requirements-pip.txt +++ b/setting/requirements-pip.txt @@ -2,7 +2,7 @@ arguments arrow cachecontrol==0.14.1 filetype -Flask>=3.1.1 +Flask == 3.0.3 Flask-HTTPAuth == 4.8.0 Flask-Mail == 0.10.0 Flask-PyMongo == 2.3.0 -- GitLab From a9480b0f91e795078d95fc93f315bc57fefbcd9e Mon Sep 17 00:00:00 2001 From: Giordon Stark Date: Wed, 4 Jun 2025 10:32:05 -0700 Subject: [PATCH 5/5] Revert "freeze flask to 3.0.3 before Partitioned" This reverts commit 3e522d3769c998c018338a7160fea629daf74dbb. --- setting/requirements-pip.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setting/requirements-pip.txt b/setting/requirements-pip.txt index d34e11222..89289000c 100644 --- a/setting/requirements-pip.txt +++ b/setting/requirements-pip.txt @@ -2,7 +2,7 @@ arguments arrow cachecontrol==0.14.1 filetype -Flask == 3.0.3 +Flask>=3.1.1 Flask-HTTPAuth == 4.8.0 Flask-Mail == 0.10.0 Flask-PyMongo == 2.3.0 -- GitLab