Isolate Django apps in different Docker containers

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Isolate Django apps in different Docker containers

Guillaume Dupin
Hello,
 
On a Django project (which will consist of several REST web services), I would like to isolate my services (each service would be a Django application) into different Docker containers to aim to a micro-services architecture. It will allow to benefit of Docker isolation to update independantly the different apps of the project and also to scale each service idependantly according to the load increase by using load-balancers in font of each group of services-containers (plus the numerous advantages brought by Docker).
I understand that, by doing so, each container will run a Django server and that this different servers will surely have to share some data.
 
First, do you think it is possible to do so ?
I have searched examples of such architectural choice but I always found the use of Docker to encapsulate a Django project (one container for the server, one container for the DB for example) and never this idea of "one app per container" architecture.
Do you think it is a valid approach ?
Has someone already tested such a solution ?
One problem I identify is : will each Django server have to be aware of all the services or not ?
 
To go further, if the previous idea is valid, do you think it can be coupled with a separation of databases ? As Django can already manage different databases, I imagined that each application could use several databases : a common Django database (accesible from all the apps) for the generic data and a specific database for all the app-specific data. It would push further the isolation of the services and improve the modularity of the whole project (by allowing to easily delete or add a service without impacting the others)
 
Do you think it is coherent with Django concepts ?
 
Thank you for your help
 
Regards,
Guillaume

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/2745d24c-8de4-4922-8ace-72feeb8fdfa8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Isolate Django apps in different Docker containers

Christian Ledermann
On 25 August 2016 at 14:50, Guillaume Dupin <[hidden email]> wrote:

> Hello,
>
> On a Django project (which will consist of several REST web services), I
> would like to isolate my services (each service would be a Django
> application) into different Docker containers to aim to a micro-services
> architecture. It will allow to benefit of Docker isolation to update
> independantly the different apps of the project and also to scale each
> service idependantly according to the load increase by using load-balancers
> in font of each group of services-containers (plus the numerous advantages
> brought by Docker).
> I understand that, by doing so, each container will run a Django server and
> that this different servers will surely have to share some data.
>
> First, do you think it is possible to do so ?
> I have searched examples of such architectural choice but I always found the
> use of Docker to encapsulate a Django project (one container for the server,
> one container for the DB for example) and never this idea of "one app per
> container" architecture.
> Do you think it is a valid approach ?

yes it is, you just need to setup more than one  django app container
and possibly several postgresql containers as well

> Has someone already tested such a solution ?
> One problem I identify is : will each Django server have to be aware of all
> the services or not ?

that is your design decision, if every servioce has dependencies to every
other service it  probably is a 'not so good' architecture. services should
have minimal dependencies.

> To go further, if the previous idea is valid, do you think it can be coupled
> with a separation of databases ? As Django can already manage different
> databases, I imagined that each application could use several databases : a
> common Django database (accesible from all the apps) for the generic data
> and a specific database for all the app-specific data.

Using a db as an integration point is not a good idea.

> It would push further
> the isolation of the services and improve the modularity of the whole
> project (by allowing to easily delete or add a service without impacting the
> others)
>
> Do you think it is coherent with Django concepts ?
>
> Thank you for your help
>
> Regards,
> Guillaume
>
> --
> 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 [hidden email].
> To post to this group, send email to [hidden email].
> 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/2745d24c-8de4-4922-8ace-72feeb8fdfa8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Best Regards,

Christian Ledermann

Newark-on-Trent - UK
Mobile : +44 7474997517

https://uk.linkedin.com/in/christianledermann
https://github.com/cleder/


<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don’t drive species to extinction

2) Don’t destroy a habitat that species rely on.

3) Don’t change the climate in ways that will result in the above.

}<(((*>

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CABCjzWotaGPGRgaT_JN2F%2Bmsw1G%2BrXM8bHbqmdTcyZQmyOR9ww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Isolate Django apps in different Docker containers

Guillaume Dupin
Hello Christian,

Thank you for your help.

Concerning the first and second point, I would indeed have several Django app containers (one by functionnal services). But what about applications like Django "Admin" for example ? This application needs to be aware of the models to administrate so would I have one Admin application per service (that is to say as much different Admin apps as Django containers) or one central Admin application in a container that would be aware of objects present in others Django containers ? And if so, how is it possible to configure Django to do that ?

For your last answer, one of the main objective of the project will be to be able to integrate specific data model to the generic one in a framework approach so I do not have any choice regarding the DB as an integration point. My question was more on a technical point of view : Django is able to manage different databases but what about the data that must be shared by all the Django appliations (like the data used for the "Admin" application in the case I mentionned above...)

Thanks again

Best Regards,

Guillaume

Le jeudi 25 août 2016 16:37:25 UTC+2, Christian Ledermann a écrit :
On 25 August 2016 at 14:50, Guillaume Dupin <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="scK9YEZaBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">gdu...@...> wrote:

> Hello,
>
> On a Django project (which will consist of several REST web services), I
> would like to isolate my services (each service would be a Django
> application) into different Docker containers to aim to a micro-services
> architecture. It will allow to benefit of Docker isolation to update
> independantly the different apps of the project and also to scale each
> service idependantly according to the load increase by using load-balancers
> in font of each group of services-containers (plus the numerous advantages
> brought by Docker).
> I understand that, by doing so, each container will run a Django server and
> that this different servers will surely have to share some data.
>
> First, do you think it is possible to do so ?
> I have searched examples of such architectural choice but I always found the
> use of Docker to encapsulate a Django project (one container for the server,
> one container for the DB for example) and never this idea of "one app per
> container" architecture.
> Do you think it is a valid approach ?

yes it is, you just need to setup more than one  django app container
and possibly several postgresql containers as well

> Has someone already tested such a solution ?
> One problem I identify is : will each Django server have to be aware of all
> the services or not ?

that is your design decision, if every servioce has dependencies to every
other service it  probably is a 'not so good' architecture. services should
have minimal dependencies.

> To go further, if the previous idea is valid, do you think it can be coupled
> with a separation of databases ? As Django can already manage different
> databases, I imagined that each application could use several databases : a
> common Django database (accesible from all the apps) for the generic data
> and a specific database for all the app-specific data.

Using a db as an integration point is not a good idea.

> It would push further
> the isolation of the services and improve the modularity of the whole
> project (by allowing to easily delete or add a service without impacting the
> others)
>
> Do you think it is coherent with Django concepts ?
>
> Thank you for your help
>
> Regards,
> Guillaume
>
> --
> 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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="scK9YEZaBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-users...@googlegroups.com.
> To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="scK9YEZaBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django...@....
> Visit this group at <a href="https://groups.google.com/group/django-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;">https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> <a href="https://groups.google.com/d/msgid/django-users/2745d24c-8de4-4922-8ace-72feeb8fdfa8%40googlegroups.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/2745d24c-8de4-4922-8ace-72feeb8fdfa8%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/2745d24c-8de4-4922-8ace-72feeb8fdfa8%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/django-users/2745d24c-8de4-4922-8ace-72feeb8fdfa8%40googlegroups.com.
> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.



--
Best Regards,

Christian Ledermann

Newark-on-Trent - UK
Mobile : +44 7474997517

<a href="https://uk.linkedin.com/in/christianledermann" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fuk.linkedin.com%2Fin%2Fchristianledermann\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGSWk2KDEz9rO7n7_tcBUWLNAeY_w&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fuk.linkedin.com%2Fin%2Fchristianledermann\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGSWk2KDEz9rO7n7_tcBUWLNAeY_w&#39;;return true;">https://uk.linkedin.com/in/christianledermann
<a href="https://github.com/cleder/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fcleder%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFsnDmvzUN5gC0nJb9yiMQAy6YDIw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fcleder%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFsnDmvzUN5gC0nJb9yiMQAy6YDIw&#39;;return true;">https://github.com/cleder/


<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don’t drive species to extinction

2) Don’t destroy a habitat that species rely on.

3) Don’t change the climate in ways that will result in the above.

}<(((*>

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/c4b57875-aa32-44ec-ab81-f7326b3645ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Isolate Django apps in different Docker containers

Guillaume Dupin
In reply to this post by Christian Ledermann
Hello Christian,

Thank you for your help.

Concerning the first and second point, I would indeed have several Django app containers (one by functionnal services). But what about applications like Django "Admin" for example ? This application needs to be aware of the models to administrate so would I have one Admin application per service (that is to say as much different Admin apps as Django containers) or one central Admin application in a container that would be aware of objects present in others Django containers ? And if so, how is it possible to configure Django to do that ?

For your last answer, one of the main objective of the project will be to be able to integrate specific data model to the generic one in a framework approach so I do not have any choice regarding the DB as an integration point. My question was more on a technical point of view : Django is able to manage different databases but what about the data that must be shared by all the Django appliations (like the data used for the "Admin" application in the case I mentionned above...)

Thanks again !

Best Regards,

Guillaume

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/42143161-2e12-4335-aecf-a2420eb94bca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Isolate Django apps in different Docker containers

Ronit Mishra
In reply to this post by Guillaume Dupin
Hi Guillaumae,

Did you go ahead with this approach? If yes, then would you be kind enough to share your experience and maybe brief us about your process/journey?

On Thursday, August 25, 2016 at 7:25:24 PM UTC+5:30, Guillaume Dupin wrote:
Hello,
 
On a Django project (which will consist of several REST web services), I would like to isolate my services (each service would be a Django application) into different Docker containers to aim to a micro-services architecture. It will allow to benefit of Docker isolation to update independantly the different apps of the project and also to scale each service idependantly according to the load increase by using load-balancers in font of each group of services-containers (plus the numerous advantages brought by Docker).
I understand that, by doing so, each container will run a Django server and that this different servers will surely have to share some data.
 
First, do you think it is possible to do so ?
I have searched examples of such architectural choice but I always found the use of Docker to encapsulate a Django project (one container for the server, one container for the DB for example) and never this idea of "one app per container" architecture.
Do you think it is a valid approach ?
Has someone already tested such a solution ?
One problem I identify is : will each Django server have to be aware of all the services or not ?
 
To go further, if the previous idea is valid, do you think it can be coupled with a separation of databases ? As Django can already manage different databases, I imagined that each application could use several databases : a common Django database (accesible from all the apps) for the generic data and a specific database for all the app-specific data. It would push further the isolation of the services and improve the modularity of the whole project (by allowing to easily delete or add a service without impacting the others)
 
Do you think it is coherent with Django concepts ?
 
Thank you for your help
 
Regards,
Guillaume

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c88fc0a0-a84a-4ea9-94e6-665725626f37%40googlegroups.com.