Node.js, Express.js, Docker, Redis, MongoDB, Nginx
Before setting up the project make sure you have an IDE.
-
Fork the repository. (Click Top Right in this Page)
-
Clone the repository which you have forked.
https://github.com/<YOUR_GITHUB_USERNAME>/node-docker.git
- Go into the directory containing the project.
cd node-docker
- Make sure you have Node.js Installed and run the below command. This command will spin up the application with required containers from docker-compose.yml & docker-compose.dev.yml files.
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d --build
- Run below command to get logs of the Application
docker logs <CONTAINER_ID>/<CONTAINER_NAME> -f
- Go to
localhost:3000
to verify the running Application
- To stop the application without removing volumes, run the below command.
docker-compose -f docker-compose.yml -f docker-compose.dev.yml down
- To spin up the application again after executing above command, run the below command
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d -V
- To stop the application and also remove the volumes, run the below command.
docker-compose -f docker-compose.yml -f docker-compose.dev.yml down -v
- If any new npm package is added, run the below command.
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d --build -V
- To scale the express application, run the below command by specifing the number.
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d --scale node-app=<number>