3.7 KiB
DOCKER APP DOCUMENTATION
AUTHOR : Somangsu Mukherjee
1. Conditions for Deployment
The application requires the following software:
- Docker (version 20 or newer)
- Docker Compose (v2 or integrated with Docker)
- Bash shell (for .sh scripts) or PowerShell/CMD (Windows)
- Internet connection (to download Docker images)
2. Application Description
This is a simple multi-container web application.
The application allows users to:
Enter their name in a web interface Submit the name to a backend server Store the name in a PostgreSQL database Retrieve and display all stored names
The application demonstrates communication between multiple services using Docker.
3. Virtual Networks and Volumes Virtual Network
Docker Compose automatically creates a virtual network for communication between services.
Services communicate using service names:
Frontend communicates with backend (backend) Backend communicates with database (db) Named Volume pgdata is used for persistent database storage It is mounted to /var/lib/postgresql/data inside the PostgreSQL container This ensures that data is preserved even if containers are stopped or restarted
4. Container Configuration Frontend Image: nginx:latest Port: 8080 (mapped to container port 80) Volume: ./frontend mounted to /usr/share/nginx/html Purpose: the frontend serves static HTML and JavaScript
Backend Built from a custom Dockerfile (Node.js) Port: 3000 Uses Express framework and also communicates with PostgreSQL database to send entered names to be stored
Database (PostgreSQL) Image: postgres:15 Internal port: 5432 Environment variables: POSTGRES_USER=user POSTGRES_PASSWORD=password POSTGRES_DB=mydb the database uses named volume pgdata for persistence which makes sure that data is not lost even after stopping or removing the container. Uses init.sql for initial database setup
Adminer Image: adminer Port: 8081 Purpose: Web interface for managing the PostgreSQL database which stores all the data that is entered
- The table below describes all the containers utilised in this assignment
Container Description frontend Nginx web server serving the frontend backend Node.js server handling API requests db PostgreSQL database storing application data adminer Web interface for managing the database
6. Application Control
Prepare Application: To prepare the application, the command ./prepare-app.sh is run in wsl which builds images and prepares the environment for execution.
Start Application: ./start-app.sh is run in the wsl command line to start all the 4 cointainers in detached mode.
Stop Application to stop all the currently running containers without deleting data, ./stop-app.sh is run on wsl
Remove Application ./remove-app.sh stops all containers and removes volumes, networks, and all resources.
7. Accessing the Application Main Web Application can be accessed on any browser locally running on http://localhost:8080
The database Interface (Adminer) can be accessed similarly at http://localhost:8081
Login credentials for Adminer are:
System: PostgreSQL Server: db Username: user Password: password Database: mydb
8. Used Resources Docker official documentation Docker Compose documentation Node.js documentation PostgreSQL documentation Nginx documentation
9. Use of Artificial Intelligence
Artificial intelligence tools such as chatGPT and Claude were used as a support tool during development for understanding docker concepts and debugging scripts. Some configuration issues were also fixed by referring to AI. All implementation, testing, and integration were performed independently.