Building Multi Tenant Applications with Django by Shabda Raaj
English | 29 July 2018 | ASIN: B07G1Q7GQL | 45 Pages | EPUB | 368.34 KB
English | 29 July 2018 | ASIN: B07G1Q7GQL | 45 Pages | EPUB | 368.34 KB
Are you building SaaS app? If you are, you are probably looking to add multi tenancy to your apps.
This book will teach you about the various multi tenancy architectures, the trade offs involved, and how to build a multi tenant app the right way.
Table of Contents:
Introduction to multi tenant applications
- What are multi tenant apps?
- The structure of this book
- The various approached to multi tenancy
Shared database with shared schema
- The base single-tenant app
- Adding multi tenancy to models
- Identifying tenants
- Extracting tenant from request
- A detour to /etc/hosts
- Using tenant_from_request in the views
- Isolating the admin
Shared database with isolated schema
- Limitations of shared schema and our current method
- What are database schemas?
- Managing database migrations
- Tenant separation in views
- A middleware to set schemas
- Beyond the request-response cycle
Isolated database with a shared app server
- Multiple database support in Django
- Database routing in Django
- Per tenant database routing using middlewares
- Outside the request response cycle
Completely isolated tenants using Docker
- Tools we will use
- Building a docker image from our app code
- Using docker-compose to run multi container, multi-tenant apps
- The final docker-compose.yaml
Tying it all together
- Launching new tenants
- A comparison of trade-offs of various methods
- What method should I use?
Third party apps
- Open source Django multi tenancy apps
- A tour of django-tenant-schemas