One upgraded droplet VS multiple droplets

May 9, 2017 837 views
Configuration Management Getting Started Development Deployment JavaScript Ubuntu Ubuntu 16.04

Which setup is better for deploying static websites?

Currently I have an ubuntu server running on a single droplet which hosts 1 nodejs app and 2 angularjs apps. I am planning to add more angular apps in the future. However I don't have an idea on which setup is better.

Should I just upgrade my current droplet or create 1 droplet for each app?

Thanks.

3 Answers

Hi @jofftiquez

I would say that there's no clear answer. It all depends.

If you run every app on their own $5 droplet, then it would become a little expensive if you have 20 apps - that would be $100/month in total and a lot of servers to manage.

I pick and choose depending on each app, with stuff like security and importance in mind.

PS. I wouldn't call anything like Node/Angular a static website. It might not change often, but it is dynamic by nature, which is not quite the same as a static HTML-file being served.

@jtittle Do you have any suggestions?

@jofftiquez @hansen

IMO, there's really not a best setup -- it's completely subjective.

If you're only running a handful of sites right now and performance isn't an issue, then there's really no need to upgrade or consider spreading them across multiple Droplets.

If you know you're going to be hosting 25-100 sites (for example) in the not too distant future, then I might look in to an alternative setup that is geared more towards real multi-site hosting.

For example, you might setup a Droplet as a gateway or proxy using NGINX. You'd point all domains to that server and it'd handle sending requests to whichever server the application is hosted on. It's much like load balancing, though you're not really distributing load across numerous servers, instead you're accepting an incoming request and using one server to route.

i.e.

- Gateway
- - Droplet 01 (app01, app02, app03)
- - Droplet 02 (app04)
- - Droplet 03 (app05, app06)

NGINX would run on the Gateway and on each of the Droplets hosting your applications. A request is received by the gateway and would then route (over the private network) to the correct app.

The benefit here is that when you setup the server blocks on the Gateway, you can simply change the private IP of the server for any app should you need to move it around. Restart NGINX on the gateway and the app resolve to the new server instantly.

You don't have much redundancy using this method (really, none with just this basic of a setup), though this is probably one of the most simple setups you could do without moving in to something more complex such as Loading Balancing over multiple Gateways which route to numerous hosts.

...

If you wanted to go more complex, you can definitely do it and NGINX can handle the majority of it for you. It'll work as a Load Balancing, Proxy, Web Server, etc. Although not recommended, you can even mix all three (I tested this -- really odd setup, as noted, I wouldn't recommend it -- but it will work).

  • Wow. Thanks for the suggestions @jtittle that's very helpful.

    Just to add, I am planning to remove the nodejs app because I am planning to move to firebase's cloud functions. So what will be left on the digital ocean are only those angular apps that doesn't talk to each other. I just want to host the websites in digital ocean droplets.

    • @jofftiquez

      No problem at all, happy to help :-).

      As for the Angular apps, in such a case, I'd just host them on a single Droplet unless you're seeing a need to separate them out. Whether static or dynamic, unless you're running in to a performance issue, or traffic is spiking, thus warranting an upgrade/separation, I'd just keep them on a single Droplet.

      You can always upgrade when/if the need arises without much trouble.

Have another answer? Share your knowledge.