From de1ddda0e871721f077ad3d68fa2882a75529c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Fri, 27 Sep 2024 14:31:14 +0200 Subject: [PATCH] chore(deploy): Spawn the websocket server in the docker image. Checks if the `WEBSOCKET_ENABLED` is set to `True` and runs the websocket server accordingly. --- docker/uwsgi.ini | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docker/uwsgi.ini b/docker/uwsgi.ini index 602ce3fa..02a648c6 100644 --- a/docker/uwsgi.ini +++ b/docker/uwsgi.ini @@ -10,3 +10,17 @@ enable-threads = true static-map = /static=/srv/umap/static static-map = /uploads=/srv/umap/uploads buffer-size = 32768 + +; Run the websocket server only when the env variable +; WEBSOCKET_ENABLED is set to True. +; This is enough for the base docker image, but does not +; take into account the settings as the source of truth. +if-env = WEBSOCKET_ENABLED +websocket_enabled = %(_) +endif = + +if-opt = websocket_enabled=True +print = Starting the Websocket Server (WEBSOCKET_ENABLED=%(websocket_enabled)) +attach-daemon = umap run_websocket_server +endif = +lazy-apps = true \ No newline at end of file