Question

Running Nodejs & MongoDB on the same container/instance?

Hi. I’m new into the world of Docker/Kubernetes (or any container system in general).

I have a NodeJS application (a little CMS) using MongoDB. I want it to be simple to duplicate, configure and customize.

I always hosted my applications on Ubuntu VM, but configuring and doing maintenance is very time consuming.

So I wanted to use the new Digital Ocean App feature to deploy my NodeJS app quickly (and being able to configure and duplicate the same application for multiple clients of mine). But this doesn’t allow me to host my MongoDB database with it (and Digital Ocean doesn’t have MongoDB in his offer, and I don’t want to have it on another host).

So I tried to put my application on Docker, but it seems that digital ocean counts one docker service as a single VM. So I’m unable to have both my NodeJS and MongoDB containers running on the same “server”.

Can Kubernetes can solve this problem or am I doing something wrong?

I don’t really care about performances, instances, microservices and such. My application is simple. If it starts to slow down, I just want to be able to purpose to my client to just buy a better server and do a Digital Ocean API call for it.

Thank you for your help.


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.

Accepted Answer

Thanks for your question! Using Kubernetes would achieve the goal of having both your nodeJS and MongoDb containers running on a single instance. Here is a tutorial that contains instructions on how to configure this on our platform.

Regards, eomolo

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.