Hi,

I'm not the expert on that, but since no-one else is replying I'll throw my
ideas anyway.

One solution that does get rid of the docker containers but doesn't otherwise
achieve very much is to continue routing from nginx. For one client nginx can be
connecting to the :8001 backend, for another client with :8002, and so on. Now
all backends can be running on the same machine and use the same virtualenv and
project directory, just different settings. For example, you might have
/etc/mydjangoproject/client1/settings.py,
/etc/mydjangoproject/client2/settings.py, and likewise have many uwsgi/gunicorn
instances, each one of them setting PYTHONPATH to a different one of these
directories so that Django reads the settings from there.

The problem with this setup is that it seems like an unnecessary use of
resources. You will still be running X Django instances when, in theory, one
should be enough. The benefits are that it will be somewhat simpler (since you
want be using Docker), and, if you were running many MySQL instances (one in
each docker), you also save some resources because you will be running only one
MySQL server (with many databases).

Otherwise, to run a single Django instance, you could define many DATABASES and
create a database router that selects the appropriate database each time. I
believe that this is doable with minimal or no changes to the application code
(only in settings and in a file that defines the database router and is imported
by settings). But you may also need to take care of media files. In FileField,
ImageFields, you need to specify a callable in upload_to.

Regards,

Antonis Christofides
http://djangodeployment.com

On 12/16/2016 04:53 PM, Peter Edache wrote:
> I basically want to get rid of all the docker containers for each client, and
> just have a single application with many client (as the tenant) and mysql
> databases for each tenant. Just like the way django_tenant_schemas
> <https://django-tenant-schemas.readthedocs.io/en/latest/install.html> is
> working on postgres sql server. 
> Thanks @Antonis Christofides
>
> On Saturday, December 10, 2016 at 4:33:13 PM UTC+1, Antonis Christofides 
> wrote:
>
>     Hi,
>
>     I don't understand what the problem is. You have a setup that works. What
>     exactly do you want? You want to run many distinct instances of the
>     application on the same server? And you want to get rid of docker?
>
>     Antonis Christofides
>     http://djangodeployment.com
>
>     On 2016-12-09 17:13, Peter Edache wrote:
>>     Hello guys, we are currently looking for a way to migrate our previous
>>     django application to a full multi-tenant  application, currently the way
>>     we are handling our client is by giving each client a docker container
>>     and using nginx to do the routing, through sub-domain mapping.  But after
>>     researching i found, lot of article on multitenant using postgres sql but
>>     could not find a better approach for MySQL. Can anyone share a solution
>>     with me.
>>     Thanks
>>     -- 
>>     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...@googlegroups.com <javascript:>.
>>     To post to this group, send email to django...@googlegroups.com
>>     <javascript:>.
>>     Visit this group at https://groups.google.com/group/django-users
>>     <https://groups.google.com/group/django-users>.
>>     To view this discussion on the web visit
>>     
>> https://groups.google.com/d/msgid/django-users/ff7515e9-5de5-46ef-9490-6a8e49c3c289%40googlegroups.com
>>     
>> <https://groups.google.com/d/msgid/django-users/ff7515e9-5de5-46ef-9490-6a8e49c3c289%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>     For more options, visit https://groups.google.com/d/optout
>>     <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
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto: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/d8c3a510-8689-4885-a004-18bac54412d8%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d8c3a510-8689-4885-a004-18bac54412d8%40googlegroups.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/5f507732-3556-a8e6-1897-9f43792a8a29%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to