From 9cb0ea0de8f497615b2a26715dd1fd3eeeb0edf9 Mon Sep 17 00:00:00 2001 From: Stavros-Anastasios Charismiadis Date: Thu, 3 Apr 2025 14:55:16 +0300 Subject: [PATCH 1/3] Migrate from gunicorn 22 to 23, except helper service --- .../TS29222_CAPIF_API_Invoker_Management_API/requirements.txt | 2 +- .../TS29222_CAPIF_API_Provider_Management_API/requirements.txt | 2 +- .../TS29222_CAPIF_Access_Control_Policy_API/requirements.txt | 2 +- services/TS29222_CAPIF_Auditing_API/requirements.txt | 2 +- services/TS29222_CAPIF_Discover_Service_API/requirements.txt | 2 +- services/TS29222_CAPIF_Events_API/requirements.txt | 2 +- .../TS29222_CAPIF_Logging_API_Invocation_API/requirements.txt | 2 +- services/TS29222_CAPIF_Publish_Service_API/requirements.txt | 2 +- services/TS29222_CAPIF_Routing_Info_API/requirements.txt | 2 +- services/TS29222_CAPIF_Security_API/requirements.txt | 2 +- services/register/requirements.txt | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/services/TS29222_CAPIF_API_Invoker_Management_API/requirements.txt b/services/TS29222_CAPIF_API_Invoker_Management_API/requirements.txt index c28e5fb6..9e154c60 100644 --- a/services/TS29222_CAPIF_API_Invoker_Management_API/requirements.txt +++ b/services/TS29222_CAPIF_API_Invoker_Management_API/requirements.txt @@ -21,5 +21,5 @@ opentelemetry-sdk == 1.20.0 flask_executor == 1.0.0 Flask-APScheduler == 1.13.1 werkzeug == 3.0.6 -gunicorn == 22.0.0 +gunicorn == 23.0.0 packaging == 24.0 \ No newline at end of file diff --git a/services/TS29222_CAPIF_API_Provider_Management_API/requirements.txt b/services/TS29222_CAPIF_API_Provider_Management_API/requirements.txt index 0b5ec10e..9d79f084 100644 --- a/services/TS29222_CAPIF_API_Provider_Management_API/requirements.txt +++ b/services/TS29222_CAPIF_API_Provider_Management_API/requirements.txt @@ -19,5 +19,5 @@ opentelemetry-api == 1.19.0 opentelemetry-sdk == 1.19.0 flask_executor == 1.0.0 werkzeug == 3.0.4 -gunicorn == 22.0.0 +gunicorn == 23.0.0 packaging == 24.0 diff --git a/services/TS29222_CAPIF_Access_Control_Policy_API/requirements.txt b/services/TS29222_CAPIF_Access_Control_Policy_API/requirements.txt index e38f272c..9524b428 100644 --- a/services/TS29222_CAPIF_Access_Control_Policy_API/requirements.txt +++ b/services/TS29222_CAPIF_Access_Control_Policy_API/requirements.txt @@ -20,5 +20,5 @@ opentelemetry-sdk == 1.19.0 flask_executor == 1.0.0 Flask-APScheduler == 1.13.1 Flask-Script == 2.0.6 -gunicorn == 22.0.0 +gunicorn == 23.0.0 packaging == 24.0 \ No newline at end of file diff --git a/services/TS29222_CAPIF_Auditing_API/requirements.txt b/services/TS29222_CAPIF_Auditing_API/requirements.txt index da3a4c51..40ed48bc 100644 --- a/services/TS29222_CAPIF_Auditing_API/requirements.txt +++ b/services/TS29222_CAPIF_Auditing_API/requirements.txt @@ -20,5 +20,5 @@ opentelemetry-sdk == 1.19.0 flask_executor == 1.0.0 werkzeug == 3.0.4 pyopenssl == 24.1.0 -gunicorn == 22.0.0 +gunicorn == 23.0.0 packaging == 24.0 diff --git a/services/TS29222_CAPIF_Discover_Service_API/requirements.txt b/services/TS29222_CAPIF_Discover_Service_API/requirements.txt index 32a15be2..04ff0c77 100644 --- a/services/TS29222_CAPIF_Discover_Service_API/requirements.txt +++ b/services/TS29222_CAPIF_Discover_Service_API/requirements.txt @@ -20,5 +20,5 @@ opentelemetry-api == 1.19.0 opentelemetry-sdk == 1.19.0 flask_executor == 1.0.0 werkzeug == 3.0.4 -gunicorn == 22.0.0 +gunicorn == 23.0.0 packaging == 24.0 diff --git a/services/TS29222_CAPIF_Events_API/requirements.txt b/services/TS29222_CAPIF_Events_API/requirements.txt index bfe2e17c..1edc40a9 100644 --- a/services/TS29222_CAPIF_Events_API/requirements.txt +++ b/services/TS29222_CAPIF_Events_API/requirements.txt @@ -24,5 +24,5 @@ aiohttp == 3.10.5 async-timeout == 4.0.3 werkzeug == 3.0.4 pyopenssl == 24.2.1 -gunicorn == 22.0.0 +gunicorn == 23.0.0 packaging == 24.0 \ No newline at end of file diff --git a/services/TS29222_CAPIF_Logging_API_Invocation_API/requirements.txt b/services/TS29222_CAPIF_Logging_API_Invocation_API/requirements.txt index e5640804..7abd4609 100644 --- a/services/TS29222_CAPIF_Logging_API_Invocation_API/requirements.txt +++ b/services/TS29222_CAPIF_Logging_API_Invocation_API/requirements.txt @@ -21,5 +21,5 @@ opentelemetry-sdk == 1.19.0 flask_executor == 1.0.0 werkzeug == 3.0.4 pyopenssl == 24.1.0 -gunicorn == 22.0.0 +gunicorn == 23.0.0 packaging == 24.0 diff --git a/services/TS29222_CAPIF_Publish_Service_API/requirements.txt b/services/TS29222_CAPIF_Publish_Service_API/requirements.txt index 0496b8e4..73be6c5f 100644 --- a/services/TS29222_CAPIF_Publish_Service_API/requirements.txt +++ b/services/TS29222_CAPIF_Publish_Service_API/requirements.txt @@ -20,6 +20,6 @@ opentelemetry-sdk == 1.17.0 flask_executor == 1.0.0 Flask-APScheduler == 1.13.1 werkzeug == 3.0.4 -gunicorn == 22.0.0 +gunicorn == 23.0.0 packaging == 24.0 diff --git a/services/TS29222_CAPIF_Routing_Info_API/requirements.txt b/services/TS29222_CAPIF_Routing_Info_API/requirements.txt index 0ecdd1f3..9c190938 100644 --- a/services/TS29222_CAPIF_Routing_Info_API/requirements.txt +++ b/services/TS29222_CAPIF_Routing_Info_API/requirements.txt @@ -4,5 +4,5 @@ python_dateutil >= 2.6.0 setuptools == 74.0.0 Flask == 3.0.3 werkzeug == 3.0.4 -gunicorn == 22.0.0 +gunicorn == 23.0.0 packaging == 24.0 diff --git a/services/TS29222_CAPIF_Security_API/requirements.txt b/services/TS29222_CAPIF_Security_API/requirements.txt index b3fd4f79..cfd57783 100644 --- a/services/TS29222_CAPIF_Security_API/requirements.txt +++ b/services/TS29222_CAPIF_Security_API/requirements.txt @@ -21,5 +21,5 @@ opentelemetry-sdk == 1.19.0 Flask-APScheduler == 1.13.1 flask_executor == 1.0.0 werkzeug == 3.0.4 -gunicorn == 22.0.0 +gunicorn == 23.0.0 packaging == 24.0 \ No newline at end of file diff --git a/services/register/requirements.txt b/services/register/requirements.txt index 1c1cb217..15c8c083 100644 --- a/services/register/requirements.txt +++ b/services/register/requirements.txt @@ -8,5 +8,5 @@ pyyaml == 6.0.1 requests == 2.32.2 bcrypt == 4.0.1 flask_httpauth == 4.8.0 -gunicorn == 22.0.0 +gunicorn == 23.0.0 packaging == 24.0 -- GitLab From ffe5510b391a706e9f6104885bd92659d840faa3 Mon Sep 17 00:00:00 2001 From: Stavros-Anastasios Charismiadis Date: Mon, 7 Apr 2025 17:58:57 +0300 Subject: [PATCH 2/3] Change helper version of gunicorn --- services/helper/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/helper/requirements.txt b/services/helper/requirements.txt index 48b0fba6..2a09c37f 100644 --- a/services/helper/requirements.txt +++ b/services/helper/requirements.txt @@ -6,5 +6,5 @@ flask_jwt_extended == 4.6.0 pyopenssl == 24.1.0 pyyaml == 6.0.1 requests == 2.32.2 -gunicorn == 22.0.0 +gunicorn == 23.0.0 packaging == 24.0 -- GitLab From b176304f3d6a1f21a1e2777df72334a1c49c944d Mon Sep 17 00:00:00 2001 From: Stavros-Anastasios Charismiadis Date: Tue, 29 Apr 2025 14:12:22 +0300 Subject: [PATCH 3/3] Add async gunicorn worker in helper service --- services/helper/helper_service/app.py | 2 ++ services/helper/helper_service/wsgi.py | 4 ++-- services/helper/prepare_helper.sh | 4 ++-- services/helper/requirements.txt | 2 ++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/services/helper/helper_service/app.py b/services/helper/helper_service/app.py index 6dd56d8c..5d6019cc 100644 --- a/services/helper/helper_service/app.py +++ b/services/helper/helper_service/app.py @@ -7,6 +7,7 @@ from db.db import MongoDatabse import requests from OpenSSL.crypto import PKey, TYPE_RSA, X509Req, dump_certificate_request, FILETYPE_PEM, dump_privatekey from flask import Flask +from asgiref.wsgi import WsgiToAsgi from config import Config from controllers.helper_controller import helper_routes @@ -82,3 +83,4 @@ cert_file.close() app.register_blueprint(helper_routes) app.logger.setLevel(numeric_level) +asgi_app = WsgiToAsgi(app) \ No newline at end of file diff --git a/services/helper/helper_service/wsgi.py b/services/helper/helper_service/wsgi.py index 6026b0fa..55e6ab2d 100644 --- a/services/helper/helper_service/wsgi.py +++ b/services/helper/helper_service/wsgi.py @@ -1,4 +1,4 @@ -from app import app +from app import asgi_app if __name__ == "__main__": - app.run() + asgi_app.run() diff --git a/services/helper/prepare_helper.sh b/services/helper/prepare_helper.sh index d4297f64..3fe4988c 100644 --- a/services/helper/prepare_helper.sh +++ b/services/helper/prepare_helper.sh @@ -1,5 +1,5 @@ #!/bin/bash -gunicorn --bind 0.0.0.0:8080 \ - --chdir /usr/src/app/helper_service wsgi:app \ No newline at end of file +gunicorn -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8080 \ + --chdir /usr/src/app/helper_service wsgi:asgi_app \ No newline at end of file diff --git a/services/helper/requirements.txt b/services/helper/requirements.txt index 2a09c37f..14644ee7 100644 --- a/services/helper/requirements.txt +++ b/services/helper/requirements.txt @@ -7,4 +7,6 @@ pyopenssl == 24.1.0 pyyaml == 6.0.1 requests == 2.32.2 gunicorn == 23.0.0 +uvicorn == 0.34.2 +asgiref == 3.8.1 packaging == 24.0 -- GitLab