mongodbdockermeanjsscalable

scalable meanjs on digitalocean


I'm trying to learn a deployment process that can guarantee a headackeless scaling of a meanjs application (not in the level that people do it in big companies, but also not at a hobby level).

So as long as I understood, this could be a solution to work on:

  1. Having mongodb on digitalocean on Ubuntu
  2. Having the meanjs application (all other than mongodb) in a docker

Then one can scale! Because mongodb could be clustered separately and docker keeps the scaling of the application easy.

Well, I know it sounds trivial and that's why I'm asking here: I just want to go and learn docker and want to be sure before investing time on the above assumed solution!

Do you think this guarantee an easy scaling, say, for a simple online multiplayer game on meanjs please? Thank you.


Solution

  • UPDATE 31/07/2018

    Digital Ocean introducing Kubernates which does all the orchestration they have also released load balancer which I think will work well with kubernates

    ==============

    There is no off the shelf solution.

    You can use docker with swamp but for small deployment it brings additional issues of monitoring and networking.

    So here is what I did:

    1. Create a script to generate HAProxy config when you start/stop instance
    2. Have mongo in a cluster or replica or whatever. Database usually does not need to be scaled dynamically. You just have single mongo server then you scale it up and when you can't scale it vertically anymore you scale it horizontally by creating replica set and then scale it up until you can't then you do sharding.

    So have HAProxy as load balancer that accepts connections on port 80 and forwards to your droples oven private network. You can also write scripts to use DO API to create an image with your deployment and fire it up once you have more traffic either dynamically by detecting response time or cpu load or whatever other metric you have or statically.

    I hope this helps.