<p>I have a Node app that's composed of several independent modules, talking to each other over AMQP. This app is started by an index.js file that instatiates every other index.js in the different folders of my project, which in turn instantiate the actual modules.</p>

<p>I've been reading about microservices and I'd like to convert my application to Docker containers. I've found examples of how to convert a simple Node app to Docker, but I want to separate my app so that every module is in an independent Node container (this is because each module is independent and doesn't depend on other modules to work. They receive work from the message queue, and put results on the message queue).</p>

<p>What I can't find is information on how I should organize and deploy my code. Should I have a different Node project (with separate packages.json) for each of my modules? Or should I have a single Node project for all my modules and deploy each of them individually?</p>

<p>After I have my project organized, is there a script tool that will generate (build* and deploy) each of my modules to its own container? All examples I've found so far are "hello world" level samples that just pack one app.</p>

<p>During development, will I have to deploy new containers for each change I test?</p>

<p>*: build because I use ES6 and I have to use Babel.</p>

<p>There are several layers that you need to pass.</p>

<p>First, you need to containerize each microservice into its own container image. Usually you will use Docker for that.</p>

<p>Each app will have a separate Dockerfile which you will use to create docker images which you will push to docker image registries which will be pulled by whoever wants to run your app.</p>

<p>As for the codebase organisation, you can have one repository with all your microservices, but you will need multiple Dockerfiles to create images for all of them.</p>

<p>Then you need to orchestrate your containers created from your images (run them). If you want your app to run on one host you may get away with Docker compose, which lets you define which containers are run in what order in single yaml manifest file. Docs are here: <a href="https://docs.docker.com/compose/" rel="nofollow noreferrer">https://docs.docker.com/compose/</a></p>

<p>If you want to run your app in a kubernetes cluster, you will want to create a k8s Deployment (<a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/deployment/</a>) which will run your containers as pods on your cluster nodes.</p>
