(Tried to respond right after getting your response, however, I have my message in "sent items" but nothing more... I wonder if there is a filter I managed to hit having my response blocked... Si I will re-write:)
Thank you! I have installed docker on my PC and I run it locally. At setting.py I have: CHANNEL_LAYERS = { 'default': { 'BACKEND': 'channels_redis.core.RedisChannelLayer', 'CONFIG': { # "hosts": [('172.17.0.1', 6379)], "hosts": [('127.0.0.1', 6379)], }, }, } - I am running a windows os, - With docker installation I got a "Docker Quickstart Terminal". This terminal looks like a unix shell (So I am using unix commands inside this shell) - This configuration is the exact configuration that is described at the channels tutorial - I run the docker commands in this shell (as you have seen) - As for "python manage.py shell" and running the set of commands causing the failure I have described: It happens both when I am running the python shell at this Docker terminal or a normal windows CMD - I am running "Microsoft Windows 10 home" 64 bits. The fact that it is the "home" version can be part of the problem I have, however, while 64 bit support is required (docker), there is no limitation as for "home". - - I also think that it is likely that I have a communication problem between the redis server running inside the docker container and the client outside but I can't tell fore sure ( "It looks network/local environment related rather than something redis/docker specific") - As mentioned before, I see the problem also when running the python shell from " Docker Quickstart Terminal" - I have suspended windows defender firewall" and executed the commands inside the python shell again: I still have the problem - when trying to use runserver (instead of shell) and trying to access the site via chrome I get an error message " Chat socket closed unexpectedly" – I assume it is a symptom of the same problem. (I also get a warning “chrome.loadTimes() is deprecated, instead use standardized API: nextHopProtocol in Navigation)” - How can I check this communication? I would use telnet but I am not sure how to use telenet to test the viability of redis and the connectivity to it On Tue, Jan 15, 2019 at 7:32 PM Roger Gammans <rgamm...@gammascience.co.uk> wrote: > > Hi Yuval > > Are you using docker machine ? If so the redis server is on the docker > machine's IP not on the localhost so you would need to update the docker > host in the CHANNEL_LAYERS portion of settings.py. > > You show a unix-like shell like for controlling docker; but the connect > failed error looks very windowssy; so I'm not sure that the docker engine > (daemon) and the python is running on the TCP stack (or kernel/VM) which > you would need for the local host connection to work. Also it might be > sensible to ensure the connection is being block by a local firewall if you > have one. > > It looks network/local environment related rather than something > redis/docker specific. The error show the TCP connection (which you can > test with telnet if you have it install) not be made between python and the > redis deamon the most likely reason for that is a local firewall or a more > complex environment. > > > -- > > Roger Gammans <rgamm...@gammascience.co.uk> > Gamma Science > > > On Tue, 2019-01-15 at 18:49 +0200, Yuval Bachrach wrote: > > I did not configure anything, which is probably the problem.. > I am following the tutorial. I just did what the tutorial instructed to > do: So I have installed docker as instructed but haven't configured > anything. The tutorial calls installing docker and does not state any > action to take after installing....) > as I am not familiar with docker, could not tell if there is a need to > configure anything to make django channels work. I still need to do > whatever is required to make the tutorial work.Do I need to learn basics of > docker first, or are there some simple things I can do to enable the > environment and keep going with the channels tutorial? > > On Tue, Jan 15, 2019 at 6:38 PM PASCUAL Eric <eric.pasc...@cstb.fr> wrote: > > Hi, > > > How is configured your Docker stack exactly ? You should have several > containers in it, at least one for the Redis server, another one for the > Django app. > > > Do you use docker-compose to run the stack ? If yes, could you provide the > YAML descriptor of the stack ? > > > Best > > > Eric > > > ------------------------------ > *From:* django-users@googlegroups.com <django-users@googlegroups.com> on > behalf of Yuval Bachrach <yuval.bachr...@gmail.com> > *Sent:* Tuesday, January 15, 2019 5:31:18 PM > *To:* django-users@googlegroups.com > *Subject:* channnels -- communication with redis > > > I fail to have django channels communication with redis running at docker > container: I am running the channels tutorial and I get an error when just > following the tutorial instructions. > > > I am quite new with Django (designed a simple site) and have no knowledge > on redis nor docker > > > I am trying to lean channels using the tutorial: > https://channels.readthedocs.io/en/latest/tutorial/ > > It uses redis over docker > > > > At tutorial part 2 there is a test for “channel layer can communicate > with Redis”. > > I fails this test. I was looking over the web for solving this > communication problem with no luck. > > As I am not familiar with redis nor docker, I have hard time analyzing the > reasons for the communication problems. I can see that redis is running > inside a docker container. > > > > $ docker ps > > CONTAINER ID IMAGE COMMAND > CREATED STATUS PORTS > > NAMES > > 2bdabc272ec3 redis "docker-entrypoint.s…" About an > hour ago Up About an hour 0.0.0.0:6379->6379/tcp > > quizzical_panini > > $ docker inspect quizzical_panini > redisimage.log > > (YB: will paste the logfile at the end of this message) > > > > > > python manage.py shell > > import channels.layers > > channel_layer = channels.layers.get_channel_layer() > > from asgiref.sync import async_to_sync > > async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'}) > > Error begins with: > > In [4]: async_to_sync(channel_layer.send)('test_channel', {'type': > 'hello'}) > > > --------------------------------------------------------------------------- > > ConnectionRefusedError Traceback (most recent call > last) > > <ipython-input-4-80e65666e9e2> in <module> > > ----> 1 async_to_sync(channel_layer.send)('test_channel', {'type': > 'hello'}) > > A lot of other details. Ends up with: > > 504 # Jump to any except clause below. > > --> 505 raise OSError(err, f'Connect call failed > {address}') > > 506 except (BlockingIOError, InterruptedError): > > 507 # socket is still registered, the callback will be > retried later > > > > ConnectionRefusedError: [Errno 10061] Connect call failed ('127.0.0.1', > 6379) > > > > Some version details: > > installing shell command: > > $ docker run redis --version > > Redis server v=5.0.3 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 > build=9f27eb593282148b > > $ pip install channels_redis > > *A lot of details: ends up with:* > > > Successfully installed channels-redis-2.3.3 > > $ python --version > > Python 3.7.1 > > (note that it is a 32 bit python while docker requires 64 bits. I assumed > it should not be the reason for the problems I do experience > > > > >>>>>>>> redisimage.log generated by docker inspect as shown above <<<<<< > > >>>>>>>> It is long. I can’t tell id/what is relevant > > [ > > { > > "Id": > "2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479", > > "Created": "2019-01-15T14:02:36.679774957Z", > > "Path": "docker-entrypoint.sh", > > "Args": [ > > "redis-server" > > ], > > "State": { > > "Status": "running", > > "Running": true, > > "Paused": false, > > "Restarting": false, > > "OOMKilled": false, > > "Dead": false, > > "Pid": 8731, > > "ExitCode": 0, > > "Error": "", > > "StartedAt": "2019-01-15T14:02:37.086931139Z", > > "FinishedAt": "0001-01-01T00:00:00Z" > > }, > > "Image": > "sha256:5d2989ac9711b6c7a96dfca3110041d6259294f5ccd343491ecfffe3d14757cc", > > "ResolvConfPath": > "/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479/resolv.conf", > > "HostnamePath": > "/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479/hostname", > > "HostsPath": > "/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479/hosts", > > "LogPath": > "/mnt/sda1/var/lib/docker/containers/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479/2bdabc272ec364e6b34a40e253d089e48b73d55cddcade1d51b70c202aad6479-json.log", > > "Name": "/quizzical_panini", > > "RestartCount": 0, > > "Driver": "overlay2", > > "Platform": "linux", > > "MountLabel": "", > > "ProcessLabel": "", > > "AppArmorProfile": "", > > "ExecIDs": null, > > "HostConfig": { > > "Binds": null, > > "ContainerIDFile": "", > > "LogConfig": { > > "Type": "json-file", > > "Config": {} > > }, > > "NetworkMode": "default", > > "PortBindings": { > > "6379/tcp": [ > > { > > "HostIp": "", > > "HostPort": "6379" > > } > > ] > > }, > > "RestartPolicy": { > > "Name": "no", > > "MaximumRetryCount": 0 > > }, > > "AutoRemove": false, > > "VolumeDriver": "", > > "VolumesFrom": null, > > "CapAdd": null, > > "CapDrop": null, > > "Dns": [], > > "DnsOptions": [], > > "DnsSearch": [], > > "ExtraHosts": null, > > "GroupAdd": null, > > "IpcMode": "shareable", > > "Cgroup": "", > > "Links": null, > > "OomScoreAdj": 0, > > "PidMode": "", > > "Privileged": false, > > "PublishAllPorts": false, > > "ReadonlyRootfs": false, > > "SecurityOpt": null, > > "UTSMode": "", > > "UsernsMode": "", > > "ShmSize": 67108864, > > "Runtime": "runc", > > "ConsoleSize": [ > > 30, > > 129 > > ], > > "Isolation": "", > > "CpuShares": 0, > > "Memory": 0, > > "NanoCpus": 0, > > "CgroupParent": "", > > "BlkioWeight": 0, > > "BlkioWeightDevice": [], > > "BlkioDeviceReadBps": null, > > "BlkioDeviceWriteBps": null, > > "BlkioDeviceReadIOps": null, > > "BlkioDeviceWriteIOps": null, > > "CpuPeriod": 0, > > "CpuQuota": 0, > > "CpuRealtimePeriod": 0, > > "CpuRealtimeRuntime": 0, > > "CpusetCpus": "", > > "CpusetMems": "", > > "Devices": [], > > "DeviceCgroupRules": null, > > "DiskQuota": 0, > > "KernelMemory": 0, > > "MemoryReservation": 0, > > "MemorySwap": 0, > > "MemorySwappiness": null, > > "OomKillDisable": false, > > "PidsLimit": 0, > > "Ulimits": null, > > "CpuCount": 0, > > "CpuPercent": 0, > > "IOMaximumIOps": 0, > > "IOMaximumBandwidth": 0, > > "MaskedPaths": [ > > "/proc/asound", > > "/proc/acpi", > > "/proc/kcore", > > "/proc/keys", > > "/proc/latency_stats", > > "/proc/timer_list", > > "/proc/timer_stats", > > "/proc/sched_debug", > > "/proc/scsi", > > "/sys/firmware" > > ], > > "ReadonlyPaths": [ > > "/proc/bus", > > "/proc/fs", > > "/proc/irq", > > "/proc/sys", > > "/proc/sysrq-trigger" > > ] > > }, > > "GraphDriver": { > > "Data": { > > "LowerDir": > "/mnt/sda1/var/lib/docker/overlay2/37ad581f24c8ec87f199192366c304f952ce27177477746a1d33875a1bd7d7c7-init/diff:/mnt/sda1/var/lib/docker/overlay2/c596b32c9a6bf4a75405f329338e49ff6167970587db8155633861147b0e6b8a/diff:/mnt/sda1/var/lib/docker/overlay2/6d489fac67dc1b566ea6afa79d458d979294142d7f35edd719081e5559d586c1/diff:/mnt/sda1/var/lib/docker/overlay2/5683f690ef322b4d9c02b1bec18880ddc76d48cfebb4a5454143c919dbd3cee8/diff:/mnt/sda1/var/lib/docker/overlay2/d8fd6e07474c264294c0064dda1af0f3c09d7ec35301b8eecacb4ee926a7215b/diff:/mnt/sda1/var/lib/docker/overlay2/cb37f96d8c4d6580faba935057636e928684d73ca58c53136a118918bddbb604/diff:/mnt/sda1/var/lib/docker/overlay2/df686dad04ba90e26a4bd48f64a9911f63547b205c7289d81fb55300aaacdbb4/diff", > > "MergedDir": > "/mnt/sda1/var/lib/docker/overlay2/37ad581f24c8ec87f199192366c304f952ce27177477746a1d33875a1bd7d7c7/merged", > > "UpperDir": > "/mnt/sda1/var/lib/docker/overlay2/37ad581f24c8ec87f199192366c304f952ce27177477746a1d33875a1bd7d7c7/diff", > > "WorkDir": > "/mnt/sda1/var/lib/docker/overlay2/37ad581f24c8ec87f199192366c304f952ce27177477746a1d33875a1bd7d7c7/work" > > }, > > "Name": "overlay2" > > }, > > "Mounts": [ > > { > > "Type": "volume", > > "Name": > "aae85a2f1e19aedc87713b76fca072247d04632ef0c17c44e7dd44ad4e46219c", > > "Source": > "/mnt/sda1/var/lib/docker/volumes/aae85a2f1e19aedc87713b76fca072247d04632ef0c17c44e7dd44ad4e46219c/_data", > > "Destination": "/data", > > "Driver": "local", > > "Mode": "", > > "RW": true, > > "Propagation": "" > > } > > ], > > "Config": { > > "Hostname": "2bdabc272ec3", > > "Domainname": "", > > "User": "", > > "AttachStdin": false, > > "AttachStdout": false, > > "AttachStderr": false, > > "ExposedPorts": { > > "6379/tcp": {} > > }, > > "Tty": false, > > "OpenStdin": false, > > "StdinOnce": false, > > "Env": [ > > > "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", > > "GOSU_VERSION=1.10", > > "REDIS_VERSION=5.0.3", > > "REDIS_DOWNLOAD_URL= > http://download.redis.io/releases/redis-5.0.3.tar.gz", > > > "REDIS_DOWNLOAD_SHA=e290b4ddf817b26254a74d5d564095b11f9cd20d8f165459efa53eb63cd93e02" > > ], > > "Cmd": [ > > "redis-server" > > ], > > "ArgsEscaped": true, > > "Image": "redis", > > "Volumes": { > > "/data": {} > > }, > > "WorkingDir": "/data", > > "Entrypoint": [ > > "docker-entrypoint.sh" > > ], > > "OnBuild": null, > > "Labels": {} > > }, > > "NetworkSettings": { > > "Bridge": "", > > "SandboxID": > "d45841da711498d7de27f9d6050c9b5a873e527cb683075277a9fb8621c1dd30", > > "HairpinMode": false, > > "LinkLocalIPv6Address": "", > > "LinkLocalIPv6PrefixLen": 0, > > "Ports": { > > "6379/tcp": [ > > { > > "HostIp": "0.0.0.0", > > "HostPort": "6379" > > } > > ] > > }, > > "SandboxKey": "/var/run/docker/netns/d45841da7114", > > "SecondaryIPAddresses": null, > > "SecondaryIPv6Addresses": null, > > "EndpointID": > "11ad8c469ed5fc9d9ec1b796fe6853b91a8d61915a66f77763073f5f5535000f", > > "Gateway": "172.17.0.1", > > "GlobalIPv6Address": "", > > "GlobalIPv6PrefixLen": 0, > > "IPAddress": "172.17.0.2", > > "IPPrefixLen": 16, > > "IPv6Gateway": "", > > "MacAddress": "02:42:ac:11:00:02", > > "Networks": { > > "bridge": { > > "IPAMConfig": null, > > "Links": null, > > "Aliases": null, > > "NetworkID": > "354ba15e8a867d659da1a3093bd5ddb71df450b6dbb070edf492d980fdaf2c69", > > "EndpointID": > "11ad8c469ed5fc9d9ec1b796fe6853b91a8d61915a66f77763073f5f5535000f", > > "Gateway": "172.17.0.1", > > "IPAddress": "172.17.0.2", > > "IPPrefixLen": 16, > > "IPv6Gateway": "", > > "GlobalIPv6Address": "", > > "GlobalIPv6PrefixLen": 0, > > "MacAddress": "02:42:ac:11:00:02", > > "DriverOpts": null > > } > > } > > } > > } > > ] > > > > -- > > Yuval B > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAD16PYQvZFt%3DT9Od96LthZD-8cCbfA%2Bf37mXt6icZwVbiiX9Ag%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAD16PYQvZFt%3DT9Od96LthZD-8cCbfA%2Bf37mXt6icZwVbiiX9Ag%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/AM0P193MB030846511726FEDB5F8D35DD8C810%40AM0P193MB0308.EURP193.PROD.OUTLOOK.COM > <https://groups.google.com/d/msgid/django-users/AM0P193MB030846511726FEDB5F8D35DD8C810%40AM0P193MB0308.EURP193.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/1547573530.1554.28.camel%40gammascience.co.uk > <https://groups.google.com/d/msgid/django-users/1547573530.1554.28.camel%40gammascience.co.uk?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Yuval B -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAD16PYQgW_PhGOk%3DiANXaRen%2ByaPej0OyOmFPi88%3DHy4ySKzuA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.