File tree Expand file tree Collapse file tree 4 files changed +43
-1
lines changed
ansible_ai_connect/main/settings Expand file tree Collapse file tree 4 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 94
94
"csp.middleware.CSPMiddleware" ,
95
95
]
96
96
97
+ if os .environ .get ("CSRF_TRUSTED_ORIGINS" ):
98
+ CSRF_TRUSTED_ORIGINS = os .environ .get ("CSRF_TRUSTED_ORIGINS" ).split ("," )
99
+ else :
100
+ CSRF_TRUSTED_ORIGINS = ["http://localhost:8000" ]
101
+
97
102
# Allow Prometheus to scrape metrics
98
103
ALLOWED_CIDR_NETS = [os .environ .get ("ALLOWED_CIDR_NETS" , "10.0.0.0/8" )]
99
104
Original file line number Diff line number Diff line change @@ -2,6 +2,11 @@ upstream uwsgi {
2
2
server unix:///var/run/uwsgi/ansible_wisdom.sock;
3
3
}
4
4
5
+ upstream daphne {
6
+ server unix:///var/run/daphne/ansible_wisdom.sock;
7
+ }
8
+
9
+
5
10
server {
6
11
listen 8000 default_server;
7
12
server_name _;
@@ -14,4 +19,12 @@ server {
14
19
uwsgi_pass uwsgi;
15
20
include /etc/nginx/uwsgi_params;
16
21
}
22
+
23
+ location /api/v1/ai/streaming_chat/ {
24
+ proxy_pass http://daphne;
25
+ proxy_http_version 1.1;
26
+ proxy_set_header Upgrade $http_upgrade;
27
+ proxy_set_header Connection "upgrade";
28
+ proxy_redirect off;
29
+ }
17
30
}
Original file line number Diff line number Diff line change @@ -28,6 +28,29 @@ stdout_logfile_maxbytes = 0
28
28
stderr_logfile = /dev/stderr
29
29
stderr_logfile_maxbytes = 0
30
30
31
+ [fcgi-program:daphne]
32
+ # TCP socket used by Nginx backend upstream
33
+ socket=tcp://localhost:9000
34
+
35
+ # When daphne is running in multiple processes, each needs to have a different socket.
36
+ # In such a case, it is recommended to include process # in the name of socket, but
37
+ # then those generated socket names cannot be specified in nginx config file...
38
+ # So use this with numprocs=1 for now. See https://github.com/django/daphne/issues/287
39
+ # for more details.
40
+ numprocs=1
41
+ command = /var/www/venv/bin/daphne -u /var/run/daphne/ansible_wisdom.sock --fd 0 --access-log - --proxy-headers ansible_ai_connect.main.asgi:application
42
+
43
+ autostart = true
44
+ autorestart = true
45
+ stopwaitsecs = 1
46
+ stopsignal = KILL
47
+ stopasgroup = true
48
+ killasgroup = true
49
+ stdout_logfile = /dev/stdout
50
+ stdout_logfile_maxbytes = 0
51
+ stderr_logfile = /dev/stderr
52
+ stderr_logfile_maxbytes = 0
53
+
31
54
; [program:test]
32
55
; command = sleep infinity
33
56
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ RUN /var/www/venv/bin/python3.11 -m pip --no-cache-dir install --no-binary=all c
50
50
51
51
RUN /var/www/venv/bin/python3.11 -m pip --no-cache-dir install -r/var/www/ansible-ai-connect-service/requirements.txt
52
52
RUN /var/www/venv/bin/python3.11 -m pip --no-cache-dir install -e/var/www/ansible-ai-connect-service/
53
- RUN mkdir /var/run/uwsgi
53
+ RUN mkdir /var/run/uwsgi /var/run/daphne
54
54
55
55
RUN echo -e "\
56
56
{\n \
@@ -99,6 +99,7 @@ RUN for dir in \
99
99
/var/log/supervisor \
100
100
/var/run/supervisor \
101
101
/var/run/uwsgi \
102
+ /var/run/daphne \
102
103
/var/www/wisdom \
103
104
/var/log/nginx \
104
105
/etc/ari \
You can’t perform that action at this time.
0 commit comments