{"id":28226995,"url":"https://github.com/shrsyc/mean-app-docker-deploy","last_synced_at":"2026-04-16T11:03:18.996Z","repository":{"id":286741289,"uuid":"962037220","full_name":"shrsyc/MEAN-app-docker-deploy","owner":"shrsyc","description":"Containerized MEAN app with automated CI/CD via Jenkins, using Docker, Docker Hub, GitHub Webhooks, and Nginx for reverse proxy.","archived":false,"fork":false,"pushed_at":"2025-06-25T08:08:25.000Z","size":157,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-16T14:02:58.569Z","etag":null,"topics":["docker","docker-compose","dockerhub","jenkins","nginx","webhook"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/shrsyc.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":"2025-04-07T14:51:58.000Z","updated_at":"2025-04-16T03:46:16.000Z","dependencies_parsed_at":"2025-04-09T12:27:58.408Z","dependency_job_id":"7dee828e-f6dd-4451-afdb-10e17d7b6ab2","html_url":"https://github.com/shrsyc/MEAN-app-docker-deploy","commit_stats":null,"previous_names":["shrsyc/crud-dd-task-mean-app","shrsyc/mean-app-docker-deploy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shrsyc/MEAN-app-docker-deploy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrsyc%2FMEAN-app-docker-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrsyc%2FMEAN-app-docker-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrsyc%2FMEAN-app-docker-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrsyc%2FMEAN-app-docker-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shrsyc","download_url":"https://codeload.github.com/shrsyc/MEAN-app-docker-deploy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrsyc%2FMEAN-app-docker-deploy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31882886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T09:23:21.276Z","status":"ssl_error","status_checked_at":"2026-04-16T09:23:15.028Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","docker-compose","dockerhub","jenkins","nginx","webhook"],"created_at":"2025-05-18T12:10:07.438Z","updated_at":"2026-04-16T11:03:18.991Z","avatar_url":"https://github.com/shrsyc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CI/CD pipeline to deploy MEAN stack app\n![dd_assignment_1](https://github.com/user-attachments/assets/0a8afeb6-6ccc-4970-a8a3-0453eb5119e4)\n\n## Project Overview\n\nA containerized full-stack MEAN (MongoDB, Express, Angular, Node.js) application integrated with a Jenkins CI/CD pipeline. It automates the process of building, testing, and deploying using Docker, Docker Compose, and GitHub Webhooks, with Docker Hub for image storage and Nginx for frontend delivery and reverse proxying.  \n\n### Key Files\n\n- [backend/Dockerfile](backend/Dockerfile) – Docker setup for the Node.js backend\n- [frontend/Dockerfile](frontend/Dockerfile) – Docker setup for the Nginx-Angular frontend\n- [frontend/nginx.conf](frontend/nginx.conf) – Custom Nginx config for frontend deployment\n- [Jenkinsfile](./Jenkinsfile) - Contains jenkins pipeline script\n- [docker-compose.yml](./docker-compose.yml) - docker-compose file to run frontend, backend, database containers together as a same service\n  \n  \n### Project Structure\n\n\u003cpre lang=\"markdown\"\u003e \n📁 MEAN-app-docker-deploy \n├── 📁 backend \n│   ├── 📁 app \n│   ├── 📄 server.js \n│   └── 📄 Dockerfile\n│   \n├── 📁 frontend \n│   ├── 📁 src \n|   ├── 📄 nginx.conf\n│   └── 📄 Dockerfile \n│   \n├── 📄 Jenkinsfile\n├── 📄 docker-compose.yml\n└── 📄 README.md\n\u003c/pre\u003e\n\n## System Configurations\n\u003e [!NOTE]\n\u003e AWS ec2 Ubuntu VM , 2vCPU 8GiB of memory and 20GiB of storage\n### Install git, java, docker, docker-compose and jenkins\nAll these installations and configurations are done using user data script which will be the first script to be run as root user after creating the VM.  \n\u003cpre\u003e#!/bin/bash\napt update -y\napt upgrade -y\napt install git openjdk-17-jre-headless docker.io docker-compose -y\nwget -O /usr/share/keyrings/jenkins-keyring.asc \\\n  https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key\necho \"deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]\" \\\n  https://pkg.jenkins.io/debian-stable binary/ | sudo tee \\\n  /etc/apt/sources.list.d/jenkins.list \u003e /dev/null\napt-get update\napt-get install jenkins -y\nusermod -aG docker jenkins\nsystemctl restart jenkins\nsystemctl enable jenkins\u003c/pre\u003e\n\n\n## Jenkins Configurations\nTo visualize and manage your CI/CD pipeline effectively, install the following recommended Jenkins plugins:\n\n- **Pipeline: Stage View** – Visualize stages in your pipeline.\n\n\u003e  You can install these from **Jenkins Dashboard → Manage Jenkins → Plugins**.\n\n### Jenkins Credentials\n\n- Add **DockerHub credentials** (`Username with token`) to Jenkins under `Manage Jenkins → Credentials → Global` for secure authentication.\n- These credentials are used in the Jenkins pipeline to **push Docker images** to DockerHub without exposing sensitive data in the script.\n\n\u003cbr/\u003e\n\n![jenkins_cred](https://github.com/user-attachments/assets/8b139e6a-8762-478c-91dc-3bb20744242e)\n\n\u003cbr/\u003e\n\n- Dockerhub token with read write access\n\n\u003cbr/\u003e\n\n![docker_cred](https://github.com/user-attachments/assets/7c5b0b63-a6c9-48e4-8e94-56ece7502fad)\n\n\n### Jenkins Pipeline\n\n- Go to Jenkins Dashboard → New Item, choose Pipeline, and give it a meaningful name and description in the General section.\n\n![image](https://github.com/user-attachments/assets/e85f5e32-7392-4102-998e-9bf71db79b6d)\n\n\u003cbr/\u003e\n\n- In the Build Triggers section, select \"GitHub hook trigger for GITScm polling\" to automatically run the pipeline when a new commit is pushed.\n\n![image](https://github.com/user-attachments/assets/bcf85ec5-1526-449a-b871-97e6d254c158)\n\n\u003cbr/\u003e\n\n- In the Pipeline section, choose \"Pipeline script from SCM\", set SCM to Git, paste your GitHub repository URL, select the desired branch, and provide the path to your Jenkinsfile and then apply and save.\n\n![image](https://github.com/user-attachments/assets/47b5b52b-0d49-46b3-8958-734cc7c8000e)\n\n\n\n\n\n## GitHub Webhook Setup\n\n- In your **repository settings**, go to **Webhooks** and add the **Payload URL** and set the content type to **application/json**.\n\n![image](https://github.com/user-attachments/assets/c4a0af2a-6cdd-4e92-b500-8a18904317da)\n\n\n\u003cbr/\u003e\n\n![image](https://github.com/user-attachments/assets/af803d98-9560-4874-ada2-32c1bf30e016)\n\n\n\n\n- ✅ If you see a **green check mark**, the webhook is active.\n- Any new commits pushed to the repo will automatically trigger the **Jenkins pipeline**.\n\n\n\n## Nginx\n\n- [frontend/nginx.conf](frontend/nginx.conf) – Custom Nginx config for frontend deployment\n- Serves the Angular app on port 80 and uses Nginx reverse proxy to route /api/ requests to the backend, avoiding CORS issues by keeping all traffic under the same domain.\n\n### Serves at Port 80\n\n- Nginx listens on port 80, making the Angular frontend accessible via http://\u003cserver-ip\u003e without needing to specify a port.\n\n\u003cpre lang=\"markdown\"\u003e\nserver {\n    listen 80;\n    ...\n}\n\u003c/pre\u003e\n\n\n### API Reverse Proxy\n\n- Forwards all /api/ requests from frontend to the backend container running on `http://backend:8081`.\n\n\u003cpre lang=\"markdown\"\u003e\nlocation /api/ {\n    proxy_pass http://backend:8081/api/;\n    ...\n}\n\u003c/pre\u003e\n  \n## CI/CD pipeline\n\n![dd_assignment_1](https://github.com/user-attachments/assets/0a8afeb6-6ccc-4970-a8a3-0453eb5119e4)\n\n\n- As soon as a commit is pushed to the main branch, the configured GitHub webhook triggers the Jenkins pipeline automatically.\n- Or you can manually trigger the build from the Jenkins dashboard without any code changes.\n\n### docker images\n- Jenkins pipeline automatically builds Docker images during each run.\n\n![image](https://github.com/user-attachments/assets/18793060-8cb9-4dad-87a8-901896c43d58)\n\n\n\n\n### docker hub\n- Built and pushed frontend and backend Docker images to Docker Hub for remote storage and deployment.\n  \n![image](https://github.com/user-attachments/assets/4067862d-7935-4509-ae3f-1891ed79b2c9)\n\n\n### docker-compose\n- Docker Compose pulls images from remote repositories and runs three containers: frontend, backend, and MongoDB, as part of a single service.\n\n![image](https://github.com/user-attachments/assets/911d04d6-3bef-449d-bcb4-25dfcc9cd069)\n\n![image](https://github.com/user-attachments/assets/fc5fe36d-e4a7-4d4e-a01b-2ec29c07e6f7)\n\n### docker volume\n- Docker volume is used to persist MongoDB data, ensuring it remains intact across container rebuilds and restarts.\n\n![image](https://github.com/user-attachments/assets/cb0cadd2-f72d-4214-af2e-01a7228f700e)\n\n\n\n## Working Application UI\n\n![image](https://github.com/user-attachments/assets/0530899f-581d-4602-8883-ee7af6ec7af4)\n\n![image](https://github.com/user-attachments/assets/c6366cf8-7163-44e4-8066-26c23f52c92d)\n\n![image](https://github.com/user-attachments/assets/86972ba0-830e-4090-aa14-a4202e899fc2)\n\n![image](https://github.com/user-attachments/assets/42e17367-d0aa-4efb-bafb-7be1e02e297c)\n\n\n\u003c!-- webhook testing 1--\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshrsyc%2Fmean-app-docker-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshrsyc%2Fmean-app-docker-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshrsyc%2Fmean-app-docker-deploy/lists"}