Blog

Some of my recent posts and ramblings.

Setting up Nodejs micro services with Docker, Compose, Nginx and Rethinkdb

There is a lot of excitement around Docker and how incredibly easy it makes deployments. The Docker website is a little lacking in making this clear, besides there are a lot of other blogs which talk about how Docker is not for small apps and it’s only for large scale applications which is not at all true. Docker is perfect when you are starting out, it enforces best practices and at the same time makes it so much easier to deploy your services.

I will walk through a simple example, which will provide a good foundation and also allow scaling out as you grow. Our example service has two services, an accounts service which needs to connect to a database(rethinkdb in this case, but you can use any other) and a service which connects to the pagerduty api. Rethinkdb has a very good web interface which we want to be able to access, but protect it via http basic authentication. Since there are multiple services, we will use nginx to proxy the requests through port 80.

You will need to install two things, Docker and Compose, http://docs.docker.com/compose/install/

Here is the setup, there are some comments in the files themselves and a more detailed explanation at the end.

So, there you go. If you haven’t noticed, the only thing you have to install on your server is Docker and Compose, every thing else after that is taken care of by docker.  This is incredibly powerful. One limitation here is of course, all of these containers run on the same host. But with Machine and Swarm, this will be resolved very soon.


Leave a Reply

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>