|
1 | | -In this DevOps task, you need to build and deploy a full-stack CRUD application using the MEAN stack (MongoDB, Express, Angular 15, and Node.js). The backend will be developed with Node.js and Express to provide REST APIs, connecting to a MongoDB database. The frontend will be an Angular application utilizing HTTPClient for communication. |
| 1 | +# 🚀 MEAN Stack CRUD Application – DevOps Assignment |
2 | 2 |
|
3 | | -The application will manage a collection of tutorials, where each tutorial includes an ID, title, description, and published status. Users will be able to create, retrieve, update, and delete tutorials. Additionally, a search box will allow users to find tutorials by title. |
| 3 | +## 📌 Project Overview |
4 | 4 |
|
5 | | -## Project setup |
| 5 | +This project demonstrates the complete containerization, deployment, and automation of a full-stack **MEAN (MongoDB, Express, Angular, Node.js)** application. |
| 6 | +The application manages a collection of tutorials and supports full **CRUD operations** along with search functionality. |
6 | 7 |
|
7 | | -### Node.js Server |
| 8 | +The objective of this assignment was to implement a production-ready DevOps workflow including: |
8 | 9 |
|
| 10 | +* Docker containerization |
| 11 | +* Cloud deployment |
| 12 | +* Reverse proxy |
| 13 | +* CI/CD automation |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## 🏗️ Architecture Overview |
| 18 | + |
| 19 | + |
| 20 | +``` |
| 21 | +Developer → GitHub → GitHub Actions (CI/CD) |
| 22 | + → Docker Hub → AWS EC2 → Docker Compose |
| 23 | + → MongoDB → Backend → Frontend → Nginx Reverse Proxy |
| 24 | +``` |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## 🛠️ Tech Stack |
| 29 | + |
| 30 | +### 🔹 Backend |
| 31 | + |
| 32 | +* Node.js |
| 33 | +* Express.js |
| 34 | +* MongoDB |
| 35 | +* Mongoose |
| 36 | + |
| 37 | +### 🔹 Frontend |
| 38 | + |
| 39 | +* Angular 15 |
| 40 | +* HTTPClient |
| 41 | + |
| 42 | +### 🔹 DevOps & Cloud |
| 43 | + |
| 44 | +* Docker |
| 45 | +* Docker Compose |
| 46 | +* AWS EC2 (Ubuntu) |
| 47 | +* Nginx |
| 48 | +* GitHub Actions |
| 49 | +* Docker Hub |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +## ✨ Features |
| 54 | + |
| 55 | +✔ Create, Read, Update, Delete tutorials |
| 56 | +✔ Search tutorials by title |
| 57 | +✔ REST API based architecture |
| 58 | +✔ Containerized microservices |
| 59 | +✔ Cloud deployment |
| 60 | +✔ Reverse proxy on port 80 |
| 61 | +✔ Automated CI/CD pipeline |
| 62 | +✔ Zero manual deployment |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | +## 📂 Project Structure |
| 67 | + |
| 68 | +``` |
| 69 | +crud-dd-task-mean-app |
| 70 | +│ |
| 71 | +├── backend |
| 72 | +│ ├── app |
| 73 | +│ ├── server.js |
| 74 | +│ └── Dockerfile |
| 75 | +│ |
| 76 | +├── frontend |
| 77 | +│ ├── src |
| 78 | +│ └── Dockerfile |
| 79 | +│ |
| 80 | +├── docker-compose.yml |
| 81 | +└── README.md |
| 82 | +``` |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## ⚙️ Setup & Installation |
| 87 | + |
| 88 | +### 🔹 Clone the repository |
| 89 | + |
| 90 | +``` |
| 91 | +git clone https://github.com/deep-priyo/mean-crud-devops |
| 92 | +cd mean-crud-devops |
| 93 | +``` |
| 94 | + |
| 95 | +--- |
| 96 | + |
| 97 | +### 🔹 Backend Setup |
| 98 | + |
| 99 | +``` |
9 | 100 | cd backend |
| 101 | +npm install |
| 102 | +node server.js |
| 103 | +``` |
| 104 | + |
| 105 | +--- |
10 | 106 |
|
| 107 | +### 🔹 Frontend Setup |
| 108 | + |
| 109 | +``` |
| 110 | +cd frontend |
11 | 111 | npm install |
| 112 | +ng serve |
| 113 | +``` |
12 | 114 |
|
13 | | -You can update the MongoDB credentials by modifying the `db.config.js` file located in `app/config/`. |
| 115 | +Application runs on: |
14 | 116 |
|
15 | | -Run `node server.js` |
| 117 | +``` |
| 118 | +http://localhost:4200 |
| 119 | +``` |
16 | 120 |
|
17 | | -### Angular Client |
| 121 | +--- |
18 | 122 |
|
19 | | -cd frontend |
| 123 | +## 🐳 Docker Containerization |
20 | 124 |
|
21 | | -npm install |
| 125 | +Both frontend and backend are containerized using Docker. |
| 126 | + |
| 127 | +### 🔹 Build images |
| 128 | + |
| 129 | +``` |
| 130 | +docker build -t <docker-username>/mean-backend ./backend |
| 131 | +docker build -t <docker-username>/mean-frontend ./frontend |
| 132 | +``` |
| 133 | + |
| 134 | +### 🔹 Push to Docker Hub |
| 135 | + |
| 136 | +``` |
| 137 | +docker push <docker-username>/mean-backend |
| 138 | +docker push <docker-username>/mean-frontend |
| 139 | +``` |
| 140 | + |
| 141 | +--- |
| 142 | + |
| 143 | +## ☁️ Cloud Deployment (AWS EC2) |
| 144 | + |
| 145 | +An Ubuntu EC2 instance was configured with: |
| 146 | + |
| 147 | +* Docker |
| 148 | +* Docker Compose |
| 149 | +* Nginx |
| 150 | + |
| 151 | +The application is deployed using: |
| 152 | + |
| 153 | +``` |
| 154 | +docker compose up -d |
| 155 | +``` |
| 156 | + |
| 157 | +MongoDB is deployed as an official Docker container. |
| 158 | + |
| 159 | +--- |
| 160 | + |
| 161 | +## 🔄 CI/CD Pipeline |
| 162 | + |
| 163 | +GitHub Actions is configured to automate: |
| 164 | + |
| 165 | +* Docker image build |
| 166 | +* Image push to Docker Hub |
| 167 | +* Automatic deployment on AWS EC2 |
| 168 | + |
| 169 | +### ✔ Pipeline triggers |
| 170 | + |
| 171 | +Every push to the **main branch** triggers: |
| 172 | + |
| 173 | +1. Build updated Docker images |
| 174 | +2. Push images to Docker Hub |
| 175 | +3. SSH into EC2 |
| 176 | +4. Pull latest images |
| 177 | +5. Restart containers |
| 178 | + |
| 179 | +--- |
| 180 | + |
| 181 | +## 🌐 Nginx Reverse Proxy |
| 182 | + |
| 183 | +Nginx is configured to: |
| 184 | + |
| 185 | +* Route frontend and backend traffic |
| 186 | +* Expose the application on **port 80** |
| 187 | +* Hide internal container ports |
| 188 | +* Enable production-style deployment |
| 189 | + |
| 190 | +Users access the system via: |
| 191 | +http://<EC2-public-IPv4-address> |
| 192 | +--- |
| 193 | + |
| 194 | +## 🔐 Security Considerations |
| 195 | + |
| 196 | +✔ Docker containers isolated |
| 197 | +✔ MongoDB internal network |
| 198 | +✔ SSH secure access |
| 199 | +✔ Secrets managed using GitHub Actions |
| 200 | +✔ Reverse proxy architecture |
| 201 | + |
| 202 | +## 📸 Screenshots & Demonstration |
| 203 | + |
| 204 | +### 🔹 1. Application UI – Cloud Deployment |
| 205 | + |
| 206 | + |
| 207 | + |
| 208 | +This screenshot shows the main dashboard of the MEAN stack CRUD application deployed on AWS EC2. |
| 209 | +The application is accessible through the public IPv4 address and is served via an Nginx reverse proxy on port 80, confirming successful cloud deployment. |
| 210 | + |
| 211 | +--- |
| 212 | + |
| 213 | +### 🔹 2. Tutorial Details & Update Operations |
| 214 | + |
| 215 | + |
| 216 | + |
| 217 | +This view demonstrates full CRUD functionality. Users can update, publish, or delete tutorials. |
| 218 | +All actions interact with REST APIs built using Node.js and Express, with data persisted in MongoDB running inside Docker containers. |
| 219 | + |
| 220 | +--- |
| 221 | + |
| 222 | +### 🔹 3. Add Tutorial – Create Operation |
| 223 | + |
| 224 | + |
| 225 | + |
| 226 | +This screenshot confirms the create functionality using the Angular frontend. |
| 227 | +The form submits data to containerized backend services deployed on AWS EC2, validating end-to-end integration of frontend, backend, and database in a cloud environment. |
| 228 | + |
| 229 | +--- |
| 230 | + |
| 231 | +### 🔹 4. Docker Images in Docker Hub |
| 232 | + |
| 233 | + |
| 234 | + |
| 235 | +This screenshot shows the Docker images for frontend and backend stored in Docker Hub. |
| 236 | +These images are automatically built and pushed using GitHub Actions as part of the CI/CD workflow. |
| 237 | + |
| 238 | +--- |
| 239 | + |
| 240 | +### 🔹 5. Running Containers on AWS EC2 |
| 241 | + |
| 242 | + |
| 243 | + |
| 244 | +This confirms that all application services (frontend, backend, and MongoDB) are running successfully on the AWS EC2 instance using Docker Compose. |
| 245 | + |
| 246 | +--- |
| 247 | + |
| 248 | +### 🔹 6. GitHub Actions CI/CD Workflow |
| 249 | + |
| 250 | + |
| 251 | + |
| 252 | +This screenshot shows the automated CI/CD pipeline execution. |
| 253 | +It includes image build, push to Docker Hub, and automated deployment to the cloud infrastructure. |
| 254 | + |
| 255 | +--- |
| 256 | + |
| 257 | +### 🔹 7. Successful Deployment Logs |
| 258 | + |
| 259 | + |
| 260 | + |
| 261 | +This demonstrates the successful completion of the automated deployment process, including remote container updates and service restart on EC2. |
| 262 | + |
| 263 | +--- |
| 264 | + |
| 265 | +### 🔹 8. Nginx Reverse Proxy Configuration |
| 266 | + |
| 267 | + |
| 268 | + |
| 269 | +This confirms that the application is served through an Nginx reverse proxy on port 80. |
| 270 | +Internal container ports are hidden, providing a production-style architecture and improved security. |
| 271 | + |
| 272 | +## 📊 Why This Approach |
| 273 | + |
| 274 | +This project demonstrates a production-ready DevOps workflow: |
| 275 | + |
| 276 | +* Scalable architecture |
| 277 | +* Automated deployment |
| 278 | +* Containerized services |
| 279 | +* Cloud-ready |
| 280 | +* High availability |
| 281 | + |
| 282 | +This approach ensures: |
| 283 | +✔ Faster deployment |
| 284 | +✔ Reduced manual errors |
| 285 | +✔ Improved scalability |
| 286 | +✔ Easy maintenance |
| 287 | + |
| 288 | +--- |
| 289 | + |
| 290 | +## 🚀 Future Improvements |
| 291 | + |
| 292 | +* HTTPS with SSL |
| 293 | +* Domain configuration |
| 294 | +* Kubernetes deployment |
| 295 | +* Monitoring with Prometheus & Grafana |
| 296 | +* Load balancing |
| 297 | +* Blue-Green deployment |
| 298 | + |
| 299 | +--- |
| 300 | + |
| 301 | +## 👨💻 Author |
| 302 | + |
| 303 | +**P M** |
| 304 | +DevOps | Full-Stack | Cloud | Automation |
| 305 | + |
| 306 | +--- |
| 307 | + |
| 308 | +## 📬 Contact |
22 | 309 |
|
23 | | -Run `ng serve --port 8081` |
| 310 | +Feel free to reach out for any queries or collaboration. |
24 | 311 |
|
25 | | -You can modify the `src/app/services/tutorial.service.ts` file to adjust how the frontend interacts with the backend. |
| 312 | +--- |
26 | 313 |
|
27 | | -Navigate to `http://localhost:8081/` |
| 314 | +⭐ Thank you for reviewing this project! |
0 commit comments