diff --git a/core/notify_sessions/routing.py b/core/notify_sessions/routing.py index 45e7428..fdd4e97 100644 --- a/core/notify_sessions/routing.py +++ b/core/notify_sessions/routing.py @@ -3,6 +3,6 @@ from django.urls import path from .consumers import NotifyConsumer websocket_urlpatterns = [ - path('notify//', NotifyConsumer.as_asgi()), + path('ws/notify//', NotifyConsumer.as_asgi()), ] diff --git a/core/requirements.txt b/core/requirements.txt index 5666822..b969d4b 100644 --- a/core/requirements.txt +++ b/core/requirements.txt @@ -1,10 +1,14 @@ aiosmtpd==1.4.4.post2 -asgi-redis +anyio==4.0.0 +asgiref==3.7.2 async-timeout==4.0.3 atpublic==4.0 attrs==23.1.0 -channels +certifi==2023.11.17 +channels==4.0.0 +channels-redis==4.1.0 charset-normalizer==3.3.2 +click==8.1.7 coreapi==2.3.3 coreschema==0.0.4 coverage==7.3.2 @@ -13,10 +17,14 @@ django-extensions==3.2.3 django-soft-delete==0.9.21 djangorestframework==3.14.0 drf-yasg==1.21.7 +h11==0.14.0 +httptools==0.6.1 idna==3.4 +inflection==0.5.1 itypes==1.2.0 Jinja2==3.1.2 MarkupSafe==2.1.3 +msgpack==1.0.7 msgpack-python==0.5.6 openapi-codec==1.3.2 packaging==23.2 @@ -24,11 +32,12 @@ Pillow==10.1.0 python-dotenv==1.0.0 pytz==2023.3.post1 PyYAML==6.0.1 -redis +redis==5.0.1 requests==2.31.0 sdnotify==0.3.2 setproctitle==1.3.3 six==1.16.0 +sniffio==1.3.0 sqlparse==0.4.4 typing_extensions==4.8.0 uritemplate==4.1.1 diff --git a/deploy/ansible/playbooks/templates/nginx.conf.j2 b/deploy/ansible/playbooks/templates/nginx.conf.j2 index 154aaf9..652eb84 100644 --- a/deploy/ansible/playbooks/templates/nginx.conf.j2 +++ b/deploy/ansible/playbooks/templates/nginx.conf.j2 @@ -24,6 +24,14 @@ server { try_files $uri $uri/ /index.html; } + location /ws { + proxy_http_version 1.1; + auth_basic off; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_pass http://c3lf-sys3; + } + location /api { proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/web/src/App.vue b/web/src/App.vue index 9f3cb9a..72309a6 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -35,7 +35,7 @@ export default { } }, created: function () { - this.notify_socket = new WebSocket('wss://' + window.location.host + '/notify/'); + this.notify_socket = new WebSocket('wss://' + window.location.host + '/ws/notify/'); this.notify_socket.onmessage = (e) => { let data = JSON.parse(e.data); console.log(data, e.data);