I have deployed a MEAN Stack app (not using any MEAN frameworks) on google compute engine. Currently, it's deployed over a single n1-standard-1 virtual machine (1 virtual CPU + 3.75GB memory).
Inside of it, I'm running 4 docker containers. One each for:
- reverse proxy - listens on port 80(http) & 443(https) then proxy request to locally running node instance (port 3000)
- web application (nodejs + expressjs)
- mongodb
- redis
I was using this as my dev. environment and now since the site is in production (it's performing pretty slow).
How do I refactor this to a better scalable architecture?
My solutions:
- deploy with at least 4 vm's with above config. (each running a single docker container): reverse proxy (1 vm), mongodb - (1 vm), redis - (1 vm), app - (multiple vm's). flexible but a bit costly?
- deploy with a bigger vm (more CPU & RAM). cheaper alternative than above?
Ideally, I want to start small (with less cost) & and scale upwards as requirement grows but architecture has to be flexible enough to scale easily.
May I have some good solutions?