4.9 KiB
Docker Multi-Service Notes Application
1. Introduction
This project is a multi-container web application deployed using Docker. It demonstrates how multiple services such as frontend, backend, database, and file storage can be containerized and orchestrated using Docker Compose.
The system follows a microservices architecture where each service runs independently and communicates through a Docker network.
2. Objectives
- Deploy a complete web application using Docker containers
- Use multiple services (frontend, backend, database)
- Enable communication between services
- Implement persistent storage using Docker volumes
- Provide scripts for managing the application lifecycle
3. System Architecture
The application consists of the following services:
3.1 Frontend (Nginx)
- Serves static files (HTML, CSS, JavaScript)
- Provides user interface for interacting with the system
3.2 Backend (Node.js + Express)
- Handles API requests
- Implements business logic
- Manages notes and file uploads
3.3 MongoDB
- NoSQL database for storing notes
- Uses persistent storage
3.4 Mongo Express
- Web interface to view and manage database data
4. Features
- Create notes
- Delete notes
- Upload files
- List uploaded files
- Download files
- Persistent data storage
5. Technologies Used
- Docker
- Docker Compose
- Node.js (Express)
- MongoDB
- Nginx
- HTML, CSS, JavaScript
6. Ports and Services
| Service | Port | Description |
|---|---|---|
| Frontend | 8080 | Web interface |
| Backend | 3000 | API server |
| Mongo Express | 8081 | Database UI |
7. Database Credentials
The MongoDB database is configured with the following credentials:
- Username: admin
- Password: pass
These credentials are used by Mongo Express to connect to the MongoDB service.
8. Persistent Storage
The application uses Docker volumes:
- mongo-data → stores database data
- uploads → stores uploaded files
These ensure that data is not lost when containers restart.
9. Network Requirement (IMPORTANT)
⚠️ This application is hosted on a university virtual machine.
To access the application, you must:
- Be connected to the Tuke university network, OR
- Use a Tuke VPN connection
Without VPN/network access, the application URLs may not be reachable.
10. Application Workflow
- User accesses frontend via browser
- Frontend sends requests to backend API
- Backend processes requests
- Backend interacts with MongoDB
- MongoDB stores/retrieves data
- Mongo Express allows database visualization
11. Scripts
11.1 Prepare Application
./prepare-app.sh
- Builds Docker images
- Creates volumes and network
11.2 Start Application
./start-app.sh
- Starts all containers
- Application available at:
11.3 Stop Application
./stop-app.sh
- Stops all containers
- Data remains intact
11.4 Remove Application
./remove-app.sh
- Removes containers, volumes, and images
12. Docker Configuration
The application is configured using docker-compose.yml, where:
- Each service runs in its own container
- Services communicate using Docker networking
- Volumes are used for persistent storage
13. Key Concepts Demonstrated
- Multi-container Docker architecture
- Service isolation and communication
- Persistent storage using volumes
- RESTful API design
- Static file serving
14. Conclusion
This project demonstrates how to deploy a scalable web application using Docker containers. It highlights the importance of modular architecture, persistent storage, and service communication.