{"id":25774731,"url":"https://github.com/yanliu1111/docker-devops-with-nodejs-express","last_synced_at":"2026-04-12T13:04:48.239Z","repository":{"id":155431297,"uuid":"630277057","full_name":"yanliu1111/Docker-DevOps-with-Nodejs-Express","owner":"yanliu1111","description":"🐳 Learn the core fundamentals of Docker by building a Node/Express app with a Mongo \u0026 Redis database.","archived":false,"fork":false,"pushed_at":"2023-05-21T01:24:54.000Z","size":137,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-27T05:49:59.287Z","etag":null,"topics":["docker","express","mongodb","nginx","nodejs","redis"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yanliu1111.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-20T03:25:22.000Z","updated_at":"2023-05-02T06:17:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"277e2f3b-c9d0-4fd6-9a4a-6057e6ad117a","html_url":"https://github.com/yanliu1111/Docker-DevOps-with-Nodejs-Express","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yanliu1111/Docker-DevOps-with-Nodejs-Express","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanliu1111%2FDocker-DevOps-with-Nodejs-Express","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanliu1111%2FDocker-DevOps-with-Nodejs-Express/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanliu1111%2FDocker-DevOps-with-Nodejs-Express/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanliu1111%2FDocker-DevOps-with-Nodejs-Express/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yanliu1111","download_url":"https://codeload.github.com/yanliu1111/Docker-DevOps-with-Nodejs-Express/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanliu1111%2FDocker-DevOps-with-Nodejs-Express/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269740326,"owners_count":24467753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","express","mongodb","nginx","nodejs","redis"],"created_at":"2025-02-27T05:33:05.419Z","updated_at":"2026-04-12T13:04:48.206Z","avatar_url":"https://github.com/yanliu1111.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg \n    style=\"display: block; \n           margin-left: auto;\n           margin-right: auto;\n           width: 100%;\"\n    src=\"header.jpg\" \n    alt=\"Our logo\"\u003e\n\u003c/img\u003e\n\n\u003ch1 style=\"text-align: center;\"\u003e🐳 Docker learning on the wave 🌊\u003c/h1\u003e\n\n## Introduction\n\n\u003e **Learn the core fundamentals of Docker by building a Node/Express app with a Mongo \u0026 Redis database.** \u003cbr\u003e\n\nTech Stack:\n\n- Docker image\n- Dockerfile\n- Docker Compose\n- Nodejs\n- Express\n- MongoDB\n- Redis\n- Nginx\n\n## Work Done:\n\n1. ✅ In Docker HUB, install Nodejs Docker image\n\n2. ✅ Install MongoDB Docker image\u003cbr\u003e\n\nJust curiosity the reason 👉 when I follow the docker doc to use mongodb image, and want to see my database, I used `mongo -u \"mongoadmin\" -p \"mypassword\"` , which didn't work in my bash, THEN I used `mongosh` and it worked. So I want to know the difference between `mongo` and `mongosh`.\u003cbr\u003e\n\n```bash\nmydb\u003e use admin\nswitched to db admin\nadmin\u003e db.auth(\"username\", \"password\")\n```\n\nThe difference is `mongo` is a shell, and `mongosh` is a shell for MongoDB with more features and better syntax.🤦‍♀️ \u003cbr\u003e\n\n📗 Update-note: In index.js, starting with Mongoose version 6, you should not specify that as an option. It will be handled automatically. `useNewUrlParser`, `useUnifiedTopology`, `useFindAndModify`, and `useCreateIndex` are no longer supported options. Mongoose 6 always behaves as if `useNewUrlParser`, `useUnifiedTopology`, and `useCreateIndex` are true, and `useFindAndModify` is false. \u003cbr\u003e\n\n3. ✅ Install Redis\u003cbr\u003e\n\n- Sigup and Signin in RedisLabs\u003cbr\u003e\n- Troubleshooting in Redis Version 4.0.9\u003cbr\u003e\n  the error I got\n\n```bash\n  Mon, 01 May 2023 04:41:24 GMT express-session deprecated undefined resave option; provide resave option at file:/app/index.js:48:3\n  Mon, 01 May 2023 04:41:24 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at file:/app/index.js:48:3\n  Server listening on port 3000\n  MongoDB connected successfully\n  correct!!!!!!!\n  Error: The client is closed\n    at Commander._RedisClient_sendCommand (/app/node_modules/@redis/client/dist/lib/client/index.js:490:31)\n    at Commander.commandsExecutor (/app/node_modules/@redis/client/dist/lib/client/index.js:188:154)\n    at BaseClass.\u003ccomputed\u003e [as set] (/app/node_modules/@redis/client/dist/lib/commander.js:8:29)\n    at Object.set (file:///app/node_modules/connect-redis/dist/esm/index.js:22:34)\n    at RedisStore.set (file:///app/node_modules/connect-redis/dist/esm/index.js:69:39)\n    at Session.save (/app/node_modules/express-session/session/session.js:72:25)\n    at Session.save (/app/node_modules/express-session/index.js:406:15)\n    at ServerResponse.end (/app/node_modules/express-session/index.js:335:21)\n    at ServerResponse.send (/app/node_modules/express/lib/response.js:232:10)\n    at ServerResponse.json (/app/node_modules/express/lib/response.js:278:15)\n```\n\n**Solution 1st** with Redis Version 4.0.9\u003cbr\u003e\n\n```bash\nconst { createClient } = require('redis');\nconst { REDIS_HOST_URL } = require('../config');\n\nconst client = createClient({ url: REDIS_HOST_URL });\n\n(async () =\u003e {\n    await client.connect();\n})();\n\nclient.on('connect', () =\u003e console.log('::\u003e Redis Client Connected'));\nclient.on('error', (err) =\u003e console.log('\u003c:: Redis Client Error', err));\n```\n\nCannot solve the problem, I got infinite loop for server listening on port 3000\u003cbr\u003e\n\n**Solution 2nd** with Redis Version 3.0.2, problem solved 😶 \u003cbr\u003e\nHere is the reference I used [link](https://stackoverflow.com/questions/70145795/node-redis-does-not-work-on-my-windows-computer-even-though-the-server-is-up-and)\u003cbr\u003e\n\n4. ✅ Nginx for Load balancing to multiple node containers\u003cbr\u003e\n\n- ✅ 2 node instances (port3000) connected to Nginx \u003cbr\u003e\n- ✅ Express CORS configuration \u003cbr\u003e\n\n**Conclusions**: This repo is done, all learning and works flow above, the reason I choose this freeCodeCamp [Tutorial](https://www.youtube.com/watch?v=9zUHg7xjIqQ\u0026ab_channel=freeCodeCamp.org) because it taught docker compose with many packages (node, express, mongodb, redis, nginx) and how to run 2 node instances \u003cbr\u003e\n🤔 **Probably** I don't strongly recommend this tutorial, because the Redis version is version3, I got many errors in the work process, I focused on troubleshooting on most learning time, still have one error leave there, I markered in comment.\n\n**If you are interested in this tutorial**\n\nTo get started, clone the repository and install the dependencies. Code works good.\n\nStart the docker containers:\n\n```bash\ndocker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d --build\n\nor keep the volume\n\ndocker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d --build -V\n```\n\nCheck the logs:\n\n```bash\ndocker logs node-docker-node-app-1 -f\n```\n\nStop the docker containers:\n\n```bash\ndocker-compose -f docker-compose.yml -f docker-compose.dev.yml down\n```\n\nNot finished parts:\n\u003cbr\u003e 5. Dev to Prod \u003c-Jump here, because have to installing docker on Ubuntu(Digital Ocean), and deploy to Digital Ocean\n\u003cbr\u003e 6. Automating \u003c- Setting in Digital Ocean\n\n## What next?\n\nDocker learning never end...🐳\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyanliu1111%2Fdocker-devops-with-nodejs-express","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyanliu1111%2Fdocker-devops-with-nodejs-express","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyanliu1111%2Fdocker-devops-with-nodejs-express/lists"}