diff --git a/CHANGELOG.md b/CHANGELOG.md index b0b6673041..7f693e7978 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ Versioning](https://semver.org/spec/v2.0.0.html). - Add peertube transcript generation +### Changed + +- Split websocket and asgi apps in tray + ### Fixed - Allow to change username if one is persisted on classroom join diff --git a/src/tray/templates/services/app/deploy_ws.yml.j2 b/src/tray/templates/services/app/deploy_ws.yml.j2 new file mode 100644 index 0000000000..75035b09c1 --- /dev/null +++ b/src/tray/templates/services/app/deploy_ws.yml.j2 @@ -0,0 +1,29 @@ +{% set service_variant = "ws" %} +{% set marsha_replicas = marsha_ws_replicas %} +{% set marsha_livenessprobe = { + "httpGet": { + "path": "/__heartbeat__", + "port": "django-port", + "httpHeaders": [{ + "name": "Host", + "value": marsha_hosts[0], + }], + }, + "initialDelaySeconds": 60, + "periodSeconds": 30 , +} %} +{% set marsha_readynessprobe = { + "httpGet": { + "path": "/__lbheartbeat__", + "port": "django-port", + "httpHeaders": [{ + "name": "Host", + "value": marsha_hosts[0], + }], + }, + "initialDelaySeconds": 10, + "periodSeconds": 5, +} %} +{% set marsha_resources = marsha_ws_resources %} + +{% include "./_deploy_base.yml.j2" with context %} diff --git a/src/tray/templates/services/app/svc_ws.yml.j2 b/src/tray/templates/services/app/svc_ws.yml.j2 new file mode 100644 index 0000000000..bbcb342c91 --- /dev/null +++ b/src/tray/templates/services/app/svc_ws.yml.j2 @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: marsha + service: ws + version: "{{ marsha_image_tag }}" + deployment_stamp: "{{ deployment_stamp }}" + name: marsha-ws-{{ deployment_stamp }} # name of the service should be host name in nginx + namespace: "{{ namespace_name }}" +spec: + ports: + - name: {{ marsha_django_port }}-tcp + port: {{ marsha_django_port }} + protocol: TCP + targetPort: {{ marsha_django_port }} + selector: + app: marsha + deployment: "marsha-ws-{{ deployment_stamp }}" + type: ClusterIP diff --git a/src/tray/templates/services/nginx/configs/marsha.conf.j2 b/src/tray/templates/services/nginx/configs/marsha.conf.j2 index 4aecc7c47a..5abff43699 100644 --- a/src/tray/templates/services/nginx/configs/marsha.conf.j2 +++ b/src/tray/templates/services/nginx/configs/marsha.conf.j2 @@ -4,6 +4,10 @@ upstream marsha-backend { server marsha-app-{{ deployment_stamp }}:{{ marsha_django_port }} fail_timeout=0; } +upstream marsha-ws { + server marsha-ws-{{ deployment_stamp }}:{{ marsha_django_port }} fail_timeout=0; +} + upstream marsha-xapi { server marsha-xapi-{{ deployment_stamp }}:{{ marsha_django_port }} fail_timeout=0; } @@ -62,7 +66,7 @@ server { } location /ws/ { - proxy_pass http://marsha-backend; + proxy_pass http://marsha-ws; proxy_http_version 1.1; proxy_set_header Connection "Upgrade"; diff --git a/src/tray/vars/all/main.yml b/src/tray/vars/all/main.yml index 9e16518f22..04a3b87dba 100644 --- a/src/tray/vars/all/main.yml +++ b/src/tray/vars/all/main.yml @@ -33,6 +33,7 @@ marsha_image_name: "fundocker/marsha" marsha_image_tag: "3.23.0" marsha_django_port: 8000 marsha_app_replicas: 1 +marsha_ws_replicas: 1 marsha_xapi_replicas: 1 marsha_celery_replicas: 1 marsha_django_configuration: "Development" @@ -123,6 +124,14 @@ marsha_app_resources: cpu: 0.8 memory: 1Gi +marsha_ws_resources: + requests: + cpu: 0.3 + memory: 500Mi + limits: + cpu: 0.8 + memory: 1Gi + marsha_xapi_resources: requests: cpu: 0.3