Use Docker Compose to run a multi-container application
The goal of this project is to practice using Docker Compose to run a multi-container application in production. You will use Docker Compose to run a Node.js application and a MongoDB database.
Create a simple unauthenticated Node.js API service for creating a simple todo list. The API should have the following endpoints:
GET /todos
— get all todosPOST /todos
— create a new todoGET /todos/:id
— get a single todo by idPUT /todos/:id
— update a single todo by idDELETE /todos/:id
— delete a single todo by idThe API should connect to MongoDB to store the todo items. You can use Express for the API and Mongoose to connect to MongoDB. You can use nodemon
to automatically restart the server when the source code changes.
You are required to dockerize the API and have a docker-compose.yml
file which will spin up a MongoDB container and the API container. If everything works, you should be able to access the API via http://localhost:3000
and the todos should be saved to the MongoDB container. Data should be persisted when the containers are stopped and started.
Setup a remote server on Digital Ocean, AWS or any other cloud provider. You should use terraform to create the server and Ansible to configure it properly i.e. setup docker, docker-compose, pulling the image from Docker Hub and running the containers.
Once you have everything working locally, push your code to GitHub and setup a CI/CD pipeline to deploy the application to the remote server. You can use GitHub Actions to setup the pipeline. Make sure to use docker-compose
to run the application in the production environment.
Setup a reverse proxy using Nginx to allow you to access the application via http://your_domain.com
. You should use docker-compose
to setup the reverse proxy.
After completing this project, you will have a good understanding of Docker Compose, multi-container applications, CI/CD pipelines, and more.
Actively Maintained
We are always improving our content, adding new resources and adding features to enhance your learning experience.
Join the Community
roadmap.sh is the 7th most starred project on GitHub and is visited by hundreds of thousands of developers every month.
Roadmaps Best Practices Guides Videos FAQs YouTube
roadmap.sh by @kamrify @kamrify
Community created roadmaps, best practices, projects, articles, resources and journeys to help you choose your path and grow in your career.
Login to your account
You must be logged in to perform this action.