I am a little bit confused.
I am launching daphne locally this way: daphne common.asgi:channel_layer --port 8338
and everything is "ok" with it. When I use curl -v 127.0.0.1:8338
get the following output
* Rebuilt URL to: 127.0.0.1:8338/
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8338 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:8338
> User-Agent: curl/7.51.0
> Accept: */*
But when I try to launch docker container with port allocation, it doesn't argue that 8338 port is already used:
docker run \
-tid \
-p 8338:8338 \
-v $(PWD):/app \
--network matryoshka_net \
--hostname matryoshka_daphne \
--name matryoshka_daphne \
matryoshka_daphne
Running above code is "ok" with daphne already launched. So it seems to me that ports were not allocated properly.
What am I missing?
So that produces next problem, that I can't redirect signals to websockets to my docker container by nginx. Because there is nothing on port 8338 (when only container launched). Here is nginx.conf:
server {
listen 127.0.0.1;
gzip on;
gzip_types text/plain application/json text/css application/x-javascript text/javascript application/javascript;
location / {
proxy_set_header Host $host;
proxy_read_timeout 20s;
client_max_body_size 10m;
proxy_pass http://127.0.0.1:8000;
}
location /ws/ {
proxy_pass http://127.0.0.1:8338;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}