Sunday, November 27, 2016

Re: Structure for deploying django channels in producting in AWS

Hi Vaisagh,

You do not need nginx/apache in front of daphne to make it work (though it is usually a good idea to have it to serve static images, like you would with gunicorn).

Have you tried connecting to the container directly locally from the host machine or from inside the container itself? Have you tried swapping in another container with something else on port 8000 to see if that works? This sounds like a networking issue that's not really specific to Daphne.

Andrew

On Sun, Nov 27, 2016 at 4:06 AM, Vaisagh Viswanathan <vaisagh@ideatory.co> wrote:
Hi,

I'm trying to setup up my django project to use django channels in a dockerized setup. The whole setup seems to work fine on a local server and when I use runserver instead of daphne.  When I run the setup using daphne, the web page gives no response 

The **** page isn't working

*** didn't send any data.

ERR_EMPTY_RESPONSE


I am not sure at what point this is really failing. I tried running daphne with verbosity 2 and it seems the connections are not reaching it. 

The setup is like this:

I am running the whole set up on AWS. I have a Redis cluster that I am connecting to and using as a channel layer. I assume this is working fine, since the runserver seems to be working.

Following this I changed the setup to have two docker containers. The first one runs this script and has port 8000 of container mapped to port 80 of host machine:

cd myproject
python manage.py collectstatic --no-input
python manage.py migrate
python manage.py createsu
daphne myproject.asgi:channel_layer -b 0.0.0.0 -p 8000 --verbosity 2

The second container simply has this:

cd myproject  
python manage.py runworker


The logs from both containers indicate that they are both waiting for some requests to reach them. But nothing seems to be reaching them.

I have no idea what I'm supposed to be fixing here. DO i need to put nginx/apache in front of it for daphne to work??

Regards,
Vaisagh

This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. Ideatory Pte. Ltd., #02-18, 71 Ayer Rajah Crescent, Singapore - 139951, www.ideatory.co.

--
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+unsubscribe@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/b18d4163-1ccf-45d5-9dac-04b44c77245c%40googlegroups.com.
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+unsubscribe@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/CAFwN1uoHztPTJ0KG6-HD0fcANhO6iko3fDdEEEyBiGw8Tm%2BzFQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment