113 lines
2.1 KiB
Markdown
113 lines
2.1 KiB
Markdown
# Docker Multi-Service Notes Application
|
|
|
|
## Project Overview
|
|
|
|
This project is a multi-container web application deployed using Docker. It demonstrates how different services can work together using containerization.
|
|
|
|
The application allows users to:
|
|
|
|
- Add and delete notes
|
|
- Upload files
|
|
- View and download uploaded files
|
|
|
|
---
|
|
|
|
## Architecture
|
|
|
|
The application consists of the following services:
|
|
|
|
**Frontend (Nginx)**
|
|
Serves static HTML, CSS, and JavaScript files. Accessible via browser.
|
|
|
|
**Backend (Node.js + Express)**
|
|
Handles API requests and manages notes and file uploads.
|
|
|
|
**MongoDB**
|
|
Stores notes data and uses a persistent Docker volume.
|
|
|
|
**Mongo Express**
|
|
Provides a web interface to view and manage database data.
|
|
|
|
---
|
|
|
|
## Technologies Used
|
|
|
|
- Docker and Docker Compose
|
|
- Node.js with Express
|
|
- MongoDB (NoSQL database)
|
|
- Nginx (web server)
|
|
- HTML, CSS, and JavaScript
|
|
|
|
---
|
|
|
|
## Service Ports
|
|
|
|
| Service | Port |
|
|
|---------------|------|
|
|
| Frontend | 8080 |
|
|
| Backend | 3000 |
|
|
| Mongo Express | 8081 |
|
|
|
|
---
|
|
|
|
## Persistent Storage
|
|
|
|
The application uses Docker volumes to preserve data across container restarts:
|
|
|
|
- `mongo-data` stores database records
|
|
- `uploads/` stores user-uploaded files
|
|
|
|
Data is retained even after stopping the application.
|
|
|
|
---
|
|
|
|
## How to Run
|
|
|
|
### 1. Prepare the application
|
|
|
|
```bash
|
|
./prepare-app.sh
|
|
```
|
|
|
|
### 2. Start the application
|
|
|
|
```bash
|
|
./start-app.sh
|
|
```
|
|
|
|
Once running, open the following in your browser:
|
|
|
|
- Application: `http://147.232.204.210:8080`
|
|
- Database UI: `http://147.232.204.210/:8081`
|
|
|
|
### 3. Stop the application
|
|
|
|
```bash
|
|
./stop-app.sh
|
|
```
|
|
|
|
### 4. Remove the application
|
|
|
|
```bash
|
|
./remove-app.sh
|
|
```
|
|
|
|
---
|
|
|
|
## Application Workflow
|
|
|
|
1. The user interacts with the frontend in a browser.
|
|
2. The frontend sends API requests to the backend.
|
|
3. The backend processes the requests and communicates with MongoDB.
|
|
4. MongoDB stores or retrieves the relevant data.
|
|
5. Mongo Express provides a separate interface to inspect database content directly.
|
|
|
|
---
|
|
|
|
## Features
|
|
|
|
- Create and delete notes
|
|
- Upload files
|
|
- View and download uploaded files
|
|
- Persistent storage via Docker volumes
|