Should I have multiple droplets without virtual envinroment, or single droplet with multiple virtual environment


By using LAMP image from Digital Ocean, I manage to have a simple PHP web application (for production usage) in droplet, with 0 package installation.

As time goes on, I plan to develop more web application in Python (for production usage too).

I read through , it seems that using virtual environment is highly encouraged.

I was wondering, if I plan to have multiple web applications, should I have multiple droplets (without virtual environment), with each droplet will host 1 web app.

Or, should I have single droplet, with multiple virtual environments?

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Thanks. I first thought virtualenv is similar to vagrant / docker, but I only realize they are completely different stuff till I finish setup yesterday.

Will go for single droplets and multiple vagrant / docker approach at this moment, for cost consideration purpose :)

The simple answer is to use multiple droplets.

The longer answer is, it depends - there are lots of approaches to this. We can get pretty far down the DevOps rabbit hole on this question. (And apologies if I’m explaining some things you already know.)

You’ll want to isolate your applications from each other as much as possible, but there are many ways of doing this. That article mentions Python’s virtualenv tool, which isolates Python’s library directories per application, but your application could still write over some file another application was using, etc. Multiple applications could live side by side without problems, but the trend in server application development these days is to isolate them so you don’t have to take that chance.

So, multiple droplets is one way of doing this. In that case, I would recommend looking into tools like Ansible (or Chef, or Puppet, etc…) to allow you to set up a machine the same way every time with just what that application needs.

Another way of isolating applications is running them in Docker containers - which you can think of like little application-focused virtual machines running along side each other on your droplet.

Both of these approaches require learning a bit of tooling, and some processes to get them right for production-level deployments, and each have their pros and cons. If you’re a beginner, working on applications that aren’t going to be large-scale deployments - I’d say that you’ll probably be fine with whatever you choose. But the more isolation you can get (with either approach), the less headaches you’ll have down the road.