From 4b96b02c7263ecaf004a6a1943d660afd324e19c Mon Sep 17 00:00:00 2001 From: Pedro Crespo-Valero <32402063+pcrespov@users.noreply.github.com> Date: Wed, 16 Jul 2025 14:57:33 +0200 Subject: [PATCH 01/11] new env --- .env-devel | 2 ++ services/docker-compose.yml | 1 + .../application_settings.py | 23 ++++++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.env-devel b/.env-devel index 3a8f10903751..d5217eb49712 100644 --- a/.env-devel +++ b/.env-devel @@ -395,6 +395,8 @@ WEBSERVER_PROJECTS={} WEBSERVER_PROMETHEUS_API_VERSION=v1 WEBSERVER_PROMETHEUS_URL=http://prometheus:9090 WEBSERVER_PUBLICATIONS=1 +# WEBSERVER_REALTIME_COLLABORATION='{"RTC_MAX_NUMBER_OF_USERS":3}' +WEBSERVER_REALTIME_COLLABORATION=null WEBSERVER_SCICRUNCH={} WEBSERVER_SESSION_SECRET_KEY='REPLACE_ME_with_result__Fernet_generate_key=' WEBSERVER_SOCKETIO=1 diff --git a/services/docker-compose.yml b/services/docker-compose.yml index b9c3c08abd2b..b4680e177098 100644 --- a/services/docker-compose.yml +++ b/services/docker-compose.yml @@ -673,6 +673,7 @@ services: SWARM_STACK_NAME: ${SWARM_STACK_NAME} WEBSERVER_DEV_FEATURES_ENABLED: ${WEBSERVER_DEV_FEATURES_ENABLED} + WEBSERVER_REALTIME_COLLABORATION: ${WEBSERVER_REALTIME_COLLABORATION} WEBSERVER_LOGLEVEL: ${WEBSERVER_LOGLEVEL} WEBSERVER_PROFILING: ${WEBSERVER_PROFILING} diff --git a/services/web/server/src/simcore_service_webserver/application_settings.py b/services/web/server/src/simcore_service_webserver/application_settings.py index af7c4c79ed87..d5c53bee9fb4 100644 --- a/services/web/server/src/simcore_service_webserver/application_settings.py +++ b/services/web/server/src/simcore_service_webserver/application_settings.py @@ -10,6 +10,7 @@ from pydantic import ( AliasChoices, AnyHttpUrl, + PositiveInt, TypeAdapter, field_validator, model_validator, @@ -55,11 +56,20 @@ # NOTE: to mark a plugin as a DEV-FEATURE annotated it with -# `Field(json_schema_extra={_X_DEV_FEATURE_FLAG: True})` +# `Field(json_schema_extra={_X_FEATURE_UNDER_DEVELOPMENT: True})` # This will force it to be disabled when WEBSERVER_DEV_FEATURES_ENABLED=False _X_FEATURE_UNDER_DEVELOPMENT: Final[str] = "x-dev-feature" +class RealTimeCollaborationSettings(BaseApplicationSettings): + RTC_MAX_NUMBER_OF_USERS: Annotated[ + PositiveInt, + Field( + description="Maximum number of users allowed in a real-time collaboration session", + ), + ] + + class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings): # CODE STATICS --------------------------------------------------------- API_VERSION: str = API_VERSION @@ -277,6 +287,17 @@ class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings): Field(json_schema_extra={"auto_default_from_env": True}), ] + WEBSERVER_REALTIME_COLLABORATION: Annotated[ + RealTimeCollaborationSettings | None, + Field( + description="Enables real-time collaboration features", + json_schema_extra={ + "auto_default_from_env": True, + _X_FEATURE_UNDER_DEVELOPMENT: True, + }, + ), + ] + WEBSERVER_REDIS: Annotated[ RedisSettings | None, Field(json_schema_extra={"auto_default_from_env": True}) ] From 18184440d9f93142e804d5cf45653fc8295c8fc9 Mon Sep 17 00:00:00 2001 From: Pedro Crespo-Valero <32402063+pcrespov@users.noreply.github.com> Date: Wed, 16 Jul 2025 15:13:23 +0200 Subject: [PATCH 02/11] advertise it --- .../application_settings.py | 4 ++++ .../unit/isolated/test_application_settings.py | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/services/web/server/src/simcore_service_webserver/application_settings.py b/services/web/server/src/simcore_service_webserver/application_settings.py index d5c53bee9fb4..fc9e5991a54a 100644 --- a/services/web/server/src/simcore_service_webserver/application_settings.py +++ b/services/web/server/src/simcore_service_webserver/application_settings.py @@ -503,6 +503,7 @@ def _get_disabled_advertised_plugins(self) -> list[str]: "WEBSERVER_LICENSES", "WEBSERVER_PAYMENTS", "WEBSERVER_SCICRUNCH", + "WEBSERVER_REALTIME_COLLABORATION", } return [_ for _ in advertised_plugins if not self.is_enabled(_)] + [ # NOTE: Permanently retired in https://github.com/ITISFoundation/osparc-simcore/pull/7182 @@ -579,6 +580,9 @@ def to_client_statics(self) -> dict[str, Any]: "WEBSERVER_PROJECTS": { "PROJECTS_MAX_NUM_RUNNING_DYNAMIC_NODES", }, + "WEBSERVER_REALTIME_COLLABORATION": { + "RTC_MAX_NUMBER_OF_USERS", + }, "WEBSERVER_SESSION": {"SESSION_COOKIE_MAX_AGE"}, "WEBSERVER_TRASH": { "TRASH_RETENTION_DAYS", diff --git a/services/web/server/tests/unit/isolated/test_application_settings.py b/services/web/server/tests/unit/isolated/test_application_settings.py index c8c12355922b..56d4842d1d84 100644 --- a/services/web/server/tests/unit/isolated/test_application_settings.py +++ b/services/web/server/tests/unit/isolated/test_application_settings.py @@ -65,6 +65,7 @@ def test_settings_to_client_statics(app_settings: ApplicationSettings): # special alias assert statics["stackName"] == "master-simcore" assert statics["pluginsDisabled"] == [ + "WEBSERVER_REALTIME_COLLABORATION", "WEBSERVER_META_MODELING", "WEBSERVER_VERSION_CONTROL", ] @@ -78,6 +79,7 @@ def test_settings_to_client_statics_plugins( "WEBSERVER_SCICRUNCH", "WEBSERVER_META_MODELING", "WEBSERVER_VERSION_CONTROL", + "WEBSERVER_REALTIME_COLLABORATION", } for name in disable_plugins: monkeypatch.setenv(name, "null") @@ -85,9 +87,15 @@ def test_settings_to_client_statics_plugins( monkeypatch.setenv("WEBSERVER_FOLDERS", "0") disable_plugins.add("WEBSERVER_FOLDERS") + monkeypatch.setenv( + "WEBSERVER_REALTIME_COLLABORATION", '{"RTC_MAX_NUMBER_OF_USERS":3}' + ) + disable_plugins.remove("WEBSERVER_REALTIME_COLLABORATION") + settings = ApplicationSettings.create_from_envs() statics = settings.to_client_statics() + # ------------- print("STATICS:\n", json_dumps(statics, indent=1)) assert settings.WEBSERVER_LOGIN @@ -108,6 +116,13 @@ def test_settings_to_client_statics_plugins( == settings.WEBSERVER_SESSION.SESSION_COOKIE_MAX_AGE ) + assert "WEBSERVER_REALTIME_COLLABORATION" in statics["pluginsDisabled"] + assert settings.WEBSERVER_REALTIME_COLLABORATION + assert ( + statics["webserverRealtimeCollaboration"]["RTC_MAX_NUMBER_OF_USERS"] + == settings.WEBSERVER_REALTIME_COLLABORATION.RTC_MAX_NUMBER_OF_USERS + ) + assert statics["vcsReleaseTag"] assert TypeAdapter(HttpUrl).validate_python(statics["vcsReleaseUrl"]) From 6a6e747057cf21d3fd8d0f55f994e419f73da967 Mon Sep 17 00:00:00 2001 From: Pedro Crespo-Valero <32402063+pcrespov@users.noreply.github.com> Date: Wed, 16 Jul 2025 15:20:17 +0200 Subject: [PATCH 03/11] udpates tests --- .../unit/isolated/test_application_settings.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/services/web/server/tests/unit/isolated/test_application_settings.py b/services/web/server/tests/unit/isolated/test_application_settings.py index 56d4842d1d84..b38eae3d25c9 100644 --- a/services/web/server/tests/unit/isolated/test_application_settings.py +++ b/services/web/server/tests/unit/isolated/test_application_settings.py @@ -74,6 +74,7 @@ def test_settings_to_client_statics(app_settings: ApplicationSettings): def test_settings_to_client_statics_plugins( mock_webserver_service_environment: EnvVarsDict, monkeypatch: pytest.MonkeyPatch ): + # explicitly disable these plugins disable_plugins = { "WEBSERVER_EXPORTER", "WEBSERVER_SCICRUNCH", @@ -84,18 +85,22 @@ def test_settings_to_client_statics_plugins( for name in disable_plugins: monkeypatch.setenv(name, "null") + # explicitly disable WEBSERVER_FOLDERS monkeypatch.setenv("WEBSERVER_FOLDERS", "0") disable_plugins.add("WEBSERVER_FOLDERS") + # set WEBSERVER_REALTIME_COLLABORATION (NOTE: WEBSERVER_DEV_FEATURES_ENABLED=True) ) monkeypatch.setenv( "WEBSERVER_REALTIME_COLLABORATION", '{"RTC_MAX_NUMBER_OF_USERS":3}' ) disable_plugins.remove("WEBSERVER_REALTIME_COLLABORATION") settings = ApplicationSettings.create_from_envs() - statics = settings.to_client_statics() + assert settings.WEBSERVER_DEV_FEATURES_ENABLED # ------------- + + statics = settings.to_client_statics() print("STATICS:\n", json_dumps(statics, indent=1)) assert settings.WEBSERVER_LOGIN @@ -116,16 +121,18 @@ def test_settings_to_client_statics_plugins( == settings.WEBSERVER_SESSION.SESSION_COOKIE_MAX_AGE ) - assert "WEBSERVER_REALTIME_COLLABORATION" in statics["pluginsDisabled"] + assert statics["vcsReleaseTag"] + assert TypeAdapter(HttpUrl).validate_python(statics["vcsReleaseUrl"]) + + # check WEBSERVER_REALTIME_COLLABORATION enabled + assert "WEBSERVER_REALTIME_COLLABORATION" not in statics["pluginsDisabled"] assert settings.WEBSERVER_REALTIME_COLLABORATION assert ( statics["webserverRealtimeCollaboration"]["RTC_MAX_NUMBER_OF_USERS"] == settings.WEBSERVER_REALTIME_COLLABORATION.RTC_MAX_NUMBER_OF_USERS ) - assert statics["vcsReleaseTag"] - assert TypeAdapter(HttpUrl).validate_python(statics["vcsReleaseUrl"]) - + # check disabled plugins assert set(statics["pluginsDisabled"]) == (disable_plugins) From 6a2675a9d80f447e7b19345823c5291374e409c5 Mon Sep 17 00:00:00 2001 From: Pedro Crespo-Valero <32402063+pcrespov@users.noreply.github.com> Date: Wed, 16 Jul 2025 15:39:40 +0200 Subject: [PATCH 04/11] =?UTF-8?q?=E2=9C=A8=20update=20WEBSERVER=5FREALTIME?= =?UTF-8?q?=5FCOLLABORATION=20setting=20and=20adjust=20related=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env-devel | 3 +-- .../tests/unit/isolated/test_application_settings.py | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.env-devel b/.env-devel index d5217eb49712..94abfdde6a6e 100644 --- a/.env-devel +++ b/.env-devel @@ -395,8 +395,7 @@ WEBSERVER_PROJECTS={} WEBSERVER_PROMETHEUS_API_VERSION=v1 WEBSERVER_PROMETHEUS_URL=http://prometheus:9090 WEBSERVER_PUBLICATIONS=1 -# WEBSERVER_REALTIME_COLLABORATION='{"RTC_MAX_NUMBER_OF_USERS":3}' -WEBSERVER_REALTIME_COLLABORATION=null +WEBSERVER_REALTIME_COLLABORATION='{"RTC_MAX_NUMBER_OF_USERS":3}' WEBSERVER_SCICRUNCH={} WEBSERVER_SESSION_SECRET_KEY='REPLACE_ME_with_result__Fernet_generate_key=' WEBSERVER_SOCKETIO=1 diff --git a/services/web/server/tests/unit/isolated/test_application_settings.py b/services/web/server/tests/unit/isolated/test_application_settings.py index b38eae3d25c9..4c662ed12d66 100644 --- a/services/web/server/tests/unit/isolated/test_application_settings.py +++ b/services/web/server/tests/unit/isolated/test_application_settings.py @@ -65,7 +65,6 @@ def test_settings_to_client_statics(app_settings: ApplicationSettings): # special alias assert statics["stackName"] == "master-simcore" assert statics["pluginsDisabled"] == [ - "WEBSERVER_REALTIME_COLLABORATION", "WEBSERVER_META_MODELING", "WEBSERVER_VERSION_CONTROL", ] @@ -74,13 +73,14 @@ def test_settings_to_client_statics(app_settings: ApplicationSettings): def test_settings_to_client_statics_plugins( mock_webserver_service_environment: EnvVarsDict, monkeypatch: pytest.MonkeyPatch ): + monkeypatch.delenv("WEBSERVER_REALTIME_COLLABORATION", raising=False) + # explicitly disable these plugins disable_plugins = { "WEBSERVER_EXPORTER", "WEBSERVER_SCICRUNCH", "WEBSERVER_META_MODELING", "WEBSERVER_VERSION_CONTROL", - "WEBSERVER_REALTIME_COLLABORATION", } for name in disable_plugins: monkeypatch.setenv(name, "null") @@ -89,11 +89,10 @@ def test_settings_to_client_statics_plugins( monkeypatch.setenv("WEBSERVER_FOLDERS", "0") disable_plugins.add("WEBSERVER_FOLDERS") - # set WEBSERVER_REALTIME_COLLABORATION (NOTE: WEBSERVER_DEV_FEATURES_ENABLED=True) ) + # set WEBSERVER_REALTIME_COLLABORATION (NOTE: for now WEBSERVER_DEV_FEATURES_ENABLED=True) ) monkeypatch.setenv( "WEBSERVER_REALTIME_COLLABORATION", '{"RTC_MAX_NUMBER_OF_USERS":3}' ) - disable_plugins.remove("WEBSERVER_REALTIME_COLLABORATION") settings = ApplicationSettings.create_from_envs() assert settings.WEBSERVER_DEV_FEATURES_ENABLED From d1ce6d7f8606a152335fd99d21d8c248d5ed5f8f Mon Sep 17 00:00:00 2001 From: Pedro Crespo-Valero <32402063+pcrespov@users.noreply.github.com> Date: Wed, 16 Jul 2025 15:45:34 +0200 Subject: [PATCH 05/11] fixes --- .../src/simcore_service_webserver/application_settings.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/web/server/src/simcore_service_webserver/application_settings.py b/services/web/server/src/simcore_service_webserver/application_settings.py index fc9e5991a54a..6baa4f4c9447 100644 --- a/services/web/server/src/simcore_service_webserver/application_settings.py +++ b/services/web/server/src/simcore_service_webserver/application_settings.py @@ -16,6 +16,7 @@ model_validator, ) from pydantic.fields import Field +from pydantic_settings import BaseSettings from servicelib.logging_utils import LogLevelInt from servicelib.logging_utils_filtering import LoggerName, MessageSubstring from settings_library.application import BaseApplicationSettings @@ -61,7 +62,7 @@ _X_FEATURE_UNDER_DEVELOPMENT: Final[str] = "x-dev-feature" -class RealTimeCollaborationSettings(BaseApplicationSettings): +class RealTimeCollaborationSettings(BaseSettings): RTC_MAX_NUMBER_OF_USERS: Annotated[ PositiveInt, Field( From 804b738ebce650d50070a7491d21bf83a8256084 Mon Sep 17 00:00:00 2001 From: Pedro Crespo-Valero <32402063+pcrespov@users.noreply.github.com> Date: Wed, 16 Jul 2025 15:51:23 +0200 Subject: [PATCH 06/11] wrong base --- .../src/simcore_service_webserver/application_settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/server/src/simcore_service_webserver/application_settings.py b/services/web/server/src/simcore_service_webserver/application_settings.py index 6baa4f4c9447..b1e3687552a4 100644 --- a/services/web/server/src/simcore_service_webserver/application_settings.py +++ b/services/web/server/src/simcore_service_webserver/application_settings.py @@ -16,10 +16,10 @@ model_validator, ) from pydantic.fields import Field -from pydantic_settings import BaseSettings from servicelib.logging_utils import LogLevelInt from servicelib.logging_utils_filtering import LoggerName, MessageSubstring from settings_library.application import BaseApplicationSettings +from settings_library.base import BaseCustomSettings from settings_library.email import SMTPSettings from settings_library.postgres import PostgresSettings from settings_library.prometheus import PrometheusSettings @@ -62,7 +62,7 @@ _X_FEATURE_UNDER_DEVELOPMENT: Final[str] = "x-dev-feature" -class RealTimeCollaborationSettings(BaseSettings): +class RealTimeCollaborationSettings(BaseCustomSettings): RTC_MAX_NUMBER_OF_USERS: Annotated[ PositiveInt, Field( From 74b7d0821068597265e8142e800b61c36134b610 Mon Sep 17 00:00:00 2001 From: Pedro Crespo-Valero <32402063+pcrespov@users.noreply.github.com> Date: Wed, 16 Jul 2025 16:05:04 +0200 Subject: [PATCH 07/11] =?UTF-8?q?=E2=9C=A8=20add=20real-time=20collaborati?= =?UTF-8?q?on=20settings=20and=20bootstrap=20module?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application_settings.py | 12 +----------- .../realtime/__init__.py | 0 .../realtime/bootstrap.py | 16 ++++++++++++++++ .../realtime/settings.py | 16 ++++++++++++++++ 4 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 services/web/server/src/simcore_service_webserver/realtime/__init__.py create mode 100644 services/web/server/src/simcore_service_webserver/realtime/bootstrap.py create mode 100644 services/web/server/src/simcore_service_webserver/realtime/settings.py diff --git a/services/web/server/src/simcore_service_webserver/application_settings.py b/services/web/server/src/simcore_service_webserver/application_settings.py index b1e3687552a4..968d2a508235 100644 --- a/services/web/server/src/simcore_service_webserver/application_settings.py +++ b/services/web/server/src/simcore_service_webserver/application_settings.py @@ -10,7 +10,6 @@ from pydantic import ( AliasChoices, AnyHttpUrl, - PositiveInt, TypeAdapter, field_validator, model_validator, @@ -19,7 +18,6 @@ from servicelib.logging_utils import LogLevelInt from servicelib.logging_utils_filtering import LoggerName, MessageSubstring from settings_library.application import BaseApplicationSettings -from settings_library.base import BaseCustomSettings from settings_library.email import SMTPSettings from settings_library.postgres import PostgresSettings from settings_library.prometheus import PrometheusSettings @@ -42,6 +40,7 @@ from .login.settings import LoginSettings from .payments.settings import PaymentsSettings from .projects.settings import ProjectsSettings +from .realtime.settings import RealTimeCollaborationSettings from .resource_manager.settings import ResourceManagerSettings from .resource_usage.settings import ResourceUsageTrackerSettings from .rest.settings import RestSettings @@ -62,15 +61,6 @@ _X_FEATURE_UNDER_DEVELOPMENT: Final[str] = "x-dev-feature" -class RealTimeCollaborationSettings(BaseCustomSettings): - RTC_MAX_NUMBER_OF_USERS: Annotated[ - PositiveInt, - Field( - description="Maximum number of users allowed in a real-time collaboration session", - ), - ] - - class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings): # CODE STATICS --------------------------------------------------------- API_VERSION: str = API_VERSION diff --git a/services/web/server/src/simcore_service_webserver/realtime/__init__.py b/services/web/server/src/simcore_service_webserver/realtime/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/services/web/server/src/simcore_service_webserver/realtime/bootstrap.py b/services/web/server/src/simcore_service_webserver/realtime/bootstrap.py new file mode 100644 index 000000000000..3647a485fdeb --- /dev/null +++ b/services/web/server/src/simcore_service_webserver/realtime/bootstrap.py @@ -0,0 +1,16 @@ +import logging + +from aiohttp import web +from servicelib.aiohttp.application_setup import ModuleCategory, app_module_setup + +_logger = logging.getLogger(__name__) + + +@app_module_setup( + __name__, + ModuleCategory.ADDON, + settings_name="WEBSERVER_REALTIME_COLLABORATION", + logger=_logger, +) +def setup_realtime_feature(app: web.Application): + assert app["settings"].WEBSERVER_REALTIME_COLLABORATION # nosec diff --git a/services/web/server/src/simcore_service_webserver/realtime/settings.py b/services/web/server/src/simcore_service_webserver/realtime/settings.py new file mode 100644 index 000000000000..d1fc3b30c091 --- /dev/null +++ b/services/web/server/src/simcore_service_webserver/realtime/settings.py @@ -0,0 +1,16 @@ +from typing import Annotated + +from pydantic import ( + PositiveInt, +) +from pydantic.fields import Field +from settings_library.base import BaseCustomSettings + + +class RealTimeCollaborationSettings(BaseCustomSettings): + RTC_MAX_NUMBER_OF_USERS: Annotated[ + PositiveInt, + Field( + description="Maximum number of users allowed in a real-time collaboration session", + ), + ] From a3938b9c05519f6ce23c0828ffd463286f8ada2e Mon Sep 17 00:00:00 2001 From: Pedro Crespo-Valero <32402063+pcrespov@users.noreply.github.com> Date: Wed, 16 Jul 2025 16:05:56 +0200 Subject: [PATCH 08/11] adds setup --- .../web/server/src/simcore_service_webserver/application.py | 2 ++ .../server/src/simcore_service_webserver/realtime/bootstrap.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/services/web/server/src/simcore_service_webserver/application.py b/services/web/server/src/simcore_service_webserver/application.py index 4af3a5c27e40..120451874c9e 100644 --- a/services/web/server/src/simcore_service_webserver/application.py +++ b/services/web/server/src/simcore_service_webserver/application.py @@ -7,6 +7,7 @@ from aiohttp import web from servicelib.aiohttp.application import create_safe_application +from simcore_service_webserver.realtime.bootstrap import setup_realtime_collaboration from ._meta import WELCOME_DB_LISTENER_MSG, WELCOME_GC_MSG, WELCOME_MSG, info from .activity.plugin import setup_activity @@ -160,6 +161,7 @@ def create_application() -> web.Application: setup_publications(app) setup_studies_dispatcher(app) setup_exporter(app) + setup_realtime_collaboration(app) # NOTE: *last* events app.on_startup.append(_welcome_banner) diff --git a/services/web/server/src/simcore_service_webserver/realtime/bootstrap.py b/services/web/server/src/simcore_service_webserver/realtime/bootstrap.py index 3647a485fdeb..0f63ec74b1c6 100644 --- a/services/web/server/src/simcore_service_webserver/realtime/bootstrap.py +++ b/services/web/server/src/simcore_service_webserver/realtime/bootstrap.py @@ -12,5 +12,5 @@ settings_name="WEBSERVER_REALTIME_COLLABORATION", logger=_logger, ) -def setup_realtime_feature(app: web.Application): +def setup_realtime_collaboration(app: web.Application): assert app["settings"].WEBSERVER_REALTIME_COLLABORATION # nosec From c91fdb8823434e380e3a798cc074faa8b3c65eec Mon Sep 17 00:00:00 2001 From: Pedro Crespo-Valero <32402063+pcrespov@users.noreply.github.com> Date: Wed, 16 Jul 2025 17:00:32 +0200 Subject: [PATCH 09/11] minor --- .../simcore_service_webserver/realtime/bootstrap.py | 4 +++- .../src/simcore_service_webserver/realtime/settings.py | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/services/web/server/src/simcore_service_webserver/realtime/bootstrap.py b/services/web/server/src/simcore_service_webserver/realtime/bootstrap.py index 0f63ec74b1c6..147da70b5a43 100644 --- a/services/web/server/src/simcore_service_webserver/realtime/bootstrap.py +++ b/services/web/server/src/simcore_service_webserver/realtime/bootstrap.py @@ -13,4 +13,6 @@ logger=_logger, ) def setup_realtime_collaboration(app: web.Application): - assert app["settings"].WEBSERVER_REALTIME_COLLABORATION # nosec + from .settings import get_plugin_settings + + assert get_plugin_settings(app), "setup_settings not called?" diff --git a/services/web/server/src/simcore_service_webserver/realtime/settings.py b/services/web/server/src/simcore_service_webserver/realtime/settings.py index d1fc3b30c091..f5e49f79dab8 100644 --- a/services/web/server/src/simcore_service_webserver/realtime/settings.py +++ b/services/web/server/src/simcore_service_webserver/realtime/settings.py @@ -1,11 +1,14 @@ from typing import Annotated +from aiohttp import web from pydantic import ( PositiveInt, ) from pydantic.fields import Field from settings_library.base import BaseCustomSettings +from ..constants import APP_SETTINGS_KEY + class RealTimeCollaborationSettings(BaseCustomSettings): RTC_MAX_NUMBER_OF_USERS: Annotated[ @@ -14,3 +17,10 @@ class RealTimeCollaborationSettings(BaseCustomSettings): description="Maximum number of users allowed in a real-time collaboration session", ), ] + + +def get_plugin_settings(app: web.Application) -> RealTimeCollaborationSettings: + settings = app[APP_SETTINGS_KEY].WEBSERVER_REALTIME_COLLABORATION + assert settings, "setup_settings not called?" # nosec + assert isinstance(settings, RealTimeCollaborationSettings) # nosec + return settings From 57dc049d31874fc9741f73c21abc1f714f5a355a Mon Sep 17 00:00:00 2001 From: Pedro Crespo-Valero <32402063+pcrespov@users.noreply.github.com> Date: Thu, 17 Jul 2025 10:34:28 +0200 Subject: [PATCH 10/11] @sanderegg review: rename --- .../web/server/src/simcore_service_webserver/application.py | 4 +++- .../src/simcore_service_webserver/application_settings.py | 2 +- .../{realtime => collaboration}/__init__.py | 0 .../{realtime => collaboration}/bootstrap.py | 0 .../{realtime => collaboration}/settings.py | 0 5 files changed, 4 insertions(+), 2 deletions(-) rename services/web/server/src/simcore_service_webserver/{realtime => collaboration}/__init__.py (100%) rename services/web/server/src/simcore_service_webserver/{realtime => collaboration}/bootstrap.py (100%) rename services/web/server/src/simcore_service_webserver/{realtime => collaboration}/settings.py (100%) diff --git a/services/web/server/src/simcore_service_webserver/application.py b/services/web/server/src/simcore_service_webserver/application.py index 120451874c9e..96056e14c4a5 100644 --- a/services/web/server/src/simcore_service_webserver/application.py +++ b/services/web/server/src/simcore_service_webserver/application.py @@ -7,7 +7,9 @@ from aiohttp import web from servicelib.aiohttp.application import create_safe_application -from simcore_service_webserver.realtime.bootstrap import setup_realtime_collaboration +from simcore_service_webserver.collaboration.bootstrap import ( + setup_realtime_collaboration, +) from ._meta import WELCOME_DB_LISTENER_MSG, WELCOME_GC_MSG, WELCOME_MSG, info from .activity.plugin import setup_activity diff --git a/services/web/server/src/simcore_service_webserver/application_settings.py b/services/web/server/src/simcore_service_webserver/application_settings.py index 968d2a508235..a858290461c7 100644 --- a/services/web/server/src/simcore_service_webserver/application_settings.py +++ b/services/web/server/src/simcore_service_webserver/application_settings.py @@ -29,6 +29,7 @@ from ._meta import API_VERSION, API_VTAG, APP_NAME from .catalog.settings import CatalogSettings +from .collaboration.settings import RealTimeCollaborationSettings from .constants import APP_SETTINGS_KEY from .diagnostics.settings import DiagnosticsSettings from .director_v2.settings import DirectorV2Settings @@ -40,7 +41,6 @@ from .login.settings import LoginSettings from .payments.settings import PaymentsSettings from .projects.settings import ProjectsSettings -from .realtime.settings import RealTimeCollaborationSettings from .resource_manager.settings import ResourceManagerSettings from .resource_usage.settings import ResourceUsageTrackerSettings from .rest.settings import RestSettings diff --git a/services/web/server/src/simcore_service_webserver/realtime/__init__.py b/services/web/server/src/simcore_service_webserver/collaboration/__init__.py similarity index 100% rename from services/web/server/src/simcore_service_webserver/realtime/__init__.py rename to services/web/server/src/simcore_service_webserver/collaboration/__init__.py diff --git a/services/web/server/src/simcore_service_webserver/realtime/bootstrap.py b/services/web/server/src/simcore_service_webserver/collaboration/bootstrap.py similarity index 100% rename from services/web/server/src/simcore_service_webserver/realtime/bootstrap.py rename to services/web/server/src/simcore_service_webserver/collaboration/bootstrap.py diff --git a/services/web/server/src/simcore_service_webserver/realtime/settings.py b/services/web/server/src/simcore_service_webserver/collaboration/settings.py similarity index 100% rename from services/web/server/src/simcore_service_webserver/realtime/settings.py rename to services/web/server/src/simcore_service_webserver/collaboration/settings.py From 0a7434ebd218ae53b85191f30fe5c37b9f058f58 Mon Sep 17 00:00:00 2001 From: Pedro Crespo-Valero <32402063+pcrespov@users.noreply.github.com> Date: Thu, 17 Jul 2025 10:35:57 +0200 Subject: [PATCH 11/11] forgot in last pr --- services/static-webserver/client/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/static-webserver/client/Makefile b/services/static-webserver/client/Makefile index 850dfe8989b2..cb7293594589 100644 --- a/services/static-webserver/client/Makefile +++ b/services/static-webserver/client/Makefile @@ -44,7 +44,7 @@ follow-dev-logs: ## follow the logs of the qx compiler .PHONY: compile touch upgrade compile: ## qx compiles host' 'source' -> image's 'build-output' # qx compile 'source' within $(docker_image) image [itisfoundation/qooxdoo-kit:${QOOXDOO_KIT_TAG}] - @docker --debug buildx build \ + @docker buildx build \ --load \ --file $(docker_file) \ --tag $(docker_image) \ @@ -58,7 +58,7 @@ compile: ## qx compiles host' 'source' -> image's 'build-output' touch: ## minimal image build with /project/output-build inside # touch /project/output-build such that multi-stage 'services/web/Dockerfile' can build development target (fixes #1097) - @docker --debug buildx build \ + @docker buildx build \ --load \ --file $(docker_file) \ --tag $(docker_image) \