Hello, I have a django app deployed in DO. Currently I have 3 customers, so I created 3 different droplets. Its ok for now but I may have another 3-4 customers signing up in next few days and I expect it to grow 3-4 customers every month. I would really appreciate if someone could help me to figure out:
Everytime when i have a new customer, Just take snapshot of one of the existing droplet and deploy that snapshot to new droplet and just change server_name in nginx file. Does it works? Currently everytime I have a customer i follow this https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04 . There should be some easy way as it’s same app with same database structure (Postgress) just for different customer
Most of my customers aren’t using all the resources. for example my each droplet has 1TB data transfer and max data transfer i am using in last 3 months is 2GB. I have 3 droplets and in a billing it says you have used 2GB of 3000GB data last month. I read that i can host multiple django in one droplets, should i consider this approach?
I think any option I select from above, at the end i have to to git pull, restart server for each project. Is there any better alternatives that i can just to git pull, django migrate in a single place. (I am also looking at django-tenant)
I would really appreciate if anyone could direct me or let me know what should i look for or read for.
Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello,
Having each customer on a separate Droplet has its benefits so that if one server has issues, not all of your customers would be affected but just one.
Taking a snapshot of the server and then spinning up a new Droplet based on the snapshot is a good approach, alternatively, you could use this 1-Click Django installation here:
https://marketplace.digitalocean.com/apps/django
Also, you could host multiple Django applications on the same server by using separate Nginx server blocks for each application.
For more information on Nginx server blocks and how to set them up you can follow the steps here:
https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04
Regarding Django multitenancy, I could suggest taking a look at this GitHub project here:
https://github.com/citusdata/django-multitenant
Hope that this helps! Regards, Bobby
I hope you managed to find a solution but just incase anyone has the same problem, if the application is the same you can develop it as a multi tenant solution either running on multiple
Depending on the nature of your solution i would recommend using django-tenant to deploy a multi tenant solution.
For the moment as you think about how to move forward, you can create multiple app servers on the same droplet to reduce your cost and maximize resources, subdomains can help serve each client with their own stand alone solution on the same server.
You can reference the sources below,
https://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
https://books.agiliq.com/projects/django-multi-tenant/en/latest/
Incase you are planning on use DO Cloud Postgres you need to modify user permissions for your user to able allowed to create schemas
https://docs.digitalocean.com/products/databases/postgresql/how-to/modify-user-privileges/