Question: How to deploy a multi-tenant django app to AWS?

Question

How to deploy a multi-tenant django app to AWS?

Answers 1
Added at 2017-01-01 03:01
Tags
Question

I have an Django+Postgres app that has a multi-tenant structure and I don't have prior experience deploying this type of app to AWS. I have followed the general Elastic Beanstalk tutorial to deploy a simple app. (https://realpython.com/blog/python/deploying-a-django-app-to-aws-elastic-beanstalk/) However, I am looking for a solution that allows me to more flexibly create different "sites". Currently, I have learned to create different sites via this tutorial (http://mycodesmells.com/post/django-tutorial-multi-tenant-setup).

So i have below questions :

  1. how to deploy this app (I am leaning toward not using Elastic Beanstalk but just deploying it to EC2)
  2. how I could create different sites after deploying this app.
Answers
nr: #1 dodano: 2017-01-01 21:01

The following should help:

  • Set up your .ebextensions so your Django project deploys with eb deploy.
  • Set up django-storages with AWS S3 for mediafiles if you need to.
  • Purchase a domain and set it up with AWS Route 53 (you can buy via Route 53, too).
  • Point your root domain alias to your Elastic Beanstalk app.
  • Point a wildcard domain to your app, too.
  • Set up AWS SES to save your domain emails to an AWS S3 bucket. You can use other providers as well, SES is just about the easiest.
  • Provision AWS ACM certificates for HTTPS support.

You now have your site working under .example.com and can use tenant.example.com to refer to a single client's setup - it refers to the same deployment but has a different Host header which lets Django tenant schemas to distinguish clients. You have wildcard forwards and do not need any setup other than in Django for adding new tenants.

Source Show
◀ Wstecz