{"id":15129885,"url":"https://github.com/kaviara-14/dockerize-a-three-tier-mern-stack-application","last_synced_at":"2026-02-24T00:40:55.162Z","repository":{"id":256504162,"uuid":"855510950","full_name":"kaviara-14/Dockerize-a-Three-Tier-MERN-Stack-Application","owner":"kaviara-14","description":"Hosted a Three Tier MERN Stack Application in AWS EC2  Instance and Elastic IP Address attached to it","archived":false,"fork":false,"pushed_at":"2024-12-20T05:24:41.000Z","size":187,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-11T17:14:00.129Z","etag":null,"topics":["docker","docker-compose","three-tier-architecture"],"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/kaviara-14.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":"2024-09-11T01:38:33.000Z","updated_at":"2024-12-20T05:24:44.000Z","dependencies_parsed_at":"2024-09-11T06:48:17.631Z","dependency_job_id":"61351f2a-1737-4525-bd95-b729ffa23292","html_url":"https://github.com/kaviara-14/Dockerize-a-Three-Tier-MERN-Stack-Application","commit_stats":null,"previous_names":["kaviara-14/dockerize-a-three-tier-mern-stack-application"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaviara-14%2FDockerize-a-Three-Tier-MERN-Stack-Application","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaviara-14%2FDockerize-a-Three-Tier-MERN-Stack-Application/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaviara-14%2FDockerize-a-Three-Tier-MERN-Stack-Application/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaviara-14%2FDockerize-a-Three-Tier-MERN-Stack-Application/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaviara-14","download_url":"https://codeload.github.com/kaviara-14/Dockerize-a-Three-Tier-MERN-Stack-Application/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386932,"owners_count":20930738,"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","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","docker-compose","three-tier-architecture"],"created_at":"2024-09-26T02:22:18.999Z","updated_at":"2025-10-30T06:04:08.851Z","avatar_url":"https://github.com/kaviara-14.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dockerize a Three Tier MERN Stack Application\n\nThis repository demonstrates how to Dockerize a three-tier MERN (MongoDB, Express.js, React, Node.js) stack application using Docker Compose. The application is hosted on an EC2 instance and exposed using an Elastic IP.\n\n**Frontend:** A React.js application running in a development environment. It listens on port 3000 and automatically reloads changes thanks to volume mounting. It is connected to the backend via the react-express network.\n\n**Backend:** An Express.js server configured for development. It communicates with both the frontend and the MongoDB service through custom bridge networks (react-express and express-mongo). It is also set up to handle dependencies on MongoDB.\n\n**MongoDB:** A MongoDB instance running version 4.2.0, with data persisted using Docker volumes. This service is crucial for storing the application's data and is connected through the express-mongo network.\n\n## Commands to Run :\n\n### 1. Launch AWS EC2 Instance\nCreate a new EC2 instance and choose **Amazon Linux 2 Kernel 5.10 AMI** and configure the instance type and security groups. Ensure that port 8080 is open for HTTP traffic.Use an existing key pair or create a new one for SSH access.\n\n---\n### 2. Install Docker on EC2 Instance\nRun the following commands to install and configure Docker\n``` bash\n# Docker install\nsudo yum update -y\nsudo amazon-linux-extras install docker\nsudo service docker start\nsudo usermod -a -G docker ec2-user\npwd\n\n# Docker compose install\nsudo curl -L \"https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)\" -o /usr/local/bin/docker-compose\nsudo chmod +x /usr/local/bin/docker-compose\n```\n---\n\n### 3. Clone the Repository\nClone this repository to your EC2 instance:\n\n```bash\ngit clone https://github.com/your-username/mern-stack-docker.git\ncd mern-stack-docker\n\n```\n---\n\n### 4.  Build and Run the Application\nRun the following commands to build and start the Docker containers:\n\n``` bash\ndocker-compose up --build -d\n```\nRun the Docker container, mapping port 80 on the host to port 3000 in the container\n   \nThis will start your Node.js app in the Docker container, accessible via the EC2 instance's public IP.\n\n---\n\n### 5. Attach Elastic IP Address \nGo to the Elastic IPs in the AWS EC2,Allocate a new Elastic IP address.And Associate the Elastic IP with your EC2 instance.After attaching the Elastic IP, your Node.js application will be accessible via the Elastic IP at port 80.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaviara-14%2Fdockerize-a-three-tier-mern-stack-application","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaviara-14%2Fdockerize-a-three-tier-mern-stack-application","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaviara-14%2Fdockerize-a-three-tier-mern-stack-application/lists"}