Question

One droplet running web app snapshot for each customer?

  • Posted June 25, 2014

Hi guys I need some help figuring out this pattern. I have a web application currently running on flask at site.com

for each of my customer, I want to have a droplet from digitalocean running the copy of the flask app.

I want to consolidate them under a subdomain like customername.site.com

so when they go to customername.site.com, the ip points to their own server.

Now the problem I have is handling cases like:

The reason I have one user per one droplet is because they run cpu and network intensive background jobs in parallel. I don’t want them to interfere with each other.

I guess I’m trying to achieve horizontal scalability, by just cloning an instance of my original web application, instead of trying to force everyone on the same instance.

Any suggestions or feedback would be very useful.

Subscribe
Share

Submit an 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.

In order to deal with the login use case, you could use OAuth. site.com would be the OAuth provider with the customername.site.com sites as consumers. Check out Flask-OAuthlib.

A different approach might be to have site.com act as the front end for all users, but have a scalable backend. That way all of the long running, cpu and network intensive jobs will actually be running on different servers, but the user would only login to the frontend.

As for updating all customer droplets with new code, I’d suggest you look into git hooks. You could setup a git repository with a post receive hook to pushes to each server. You could also use something like Fabric to do automated deployments.