Thursday, January 26, 2017

Django channels deployment

Hi I am working on some app with Django Channels and I am in the phase when I am looking for the best way how to deploy the Channel project (with scaling and smooth update in mind).
I have this setup:
  1. Nginx server handling SSL certificate, headers, etc. it will proxy to ->
  2. Daphne server - question: I can run Daphne with just two files - asgi.py and settings.py (which will match the Django app settings)?
  3. Redis Channel backend server
  4. Redis Cache server
  5. MySQL database
  6. Server with actual Django code running the workers (few for http.* few for websocket.* channels and few universal).
If I would like to scale I can:
  • Run multiple Daphne servers and load-balance them on the Nginx server
  • Run multiple Redis Channel servers in one shard
  • Run multiple servers with workers
If I would like to update to the new Django code:
  • Just load new code on the worker servers and restart the workers (in case I wouldn't change the CHANNEL_LAYERS settings).
Will it work? Are there the only three conditions? 1. All Daphne servers has to see the Redis, and all workers has to see the Redis too. 2. The Redis has to looks like one instance. 3. Daphne and workers has to have the same CHANNEL_LAYERS settings.

Right now I am in the proof of concept phase and I all test it with the docker-compose (every part in my architecture is separate Docker image) and it is working (only difference is that I am running Daphne and workers on the same machine but I am in the middle of separate them) but I want to be sure that it will work on actual separate servers (I want to use Google Cloud platform) before I will present this idea to my boss :) .

Thanks for your help
Sgiath

--
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/c1eac5c2-b359-4e67-96a8-86fba12f9a07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment