This project demonstrates a simple distributed architecture using Docker Compose. It consists of a monitoring dashboard (Flask web app) and three worker nodes that communicate with the dashboard. Each node simulates a process and reports its status to the dashboard after a configurable delay.
┌────────────┐ ┌────────────┐
│ nodo_1 │ │ nodo_2 │ │ nodo_3 │
│ (worker) │ │ (worker) │ │ (worker) │
└─────┬──────┘ └─────┬──────┘ └─────┬──────┘
│ │ │
└────────────┬──────┴──────┬────────────┘
│ │
┌────▼─────────────▼─────┐
│ dashboard │
│ (Flask web app) │
└───────────────────────┘
- dashboard: Flask app that displays the status of all nodes and provides an API for workers to report their status.
- nodo_1, nodo_2, nodo_3: Worker containers that wait for a specified time, then notify the dashboard of their activation.
- Clone this repository and navigate to the project directory:
git clone https://github.com/RoBorregos/DockerArchWorkshop.git cd DockerArchWorkshop - Build and start all services:
docker-compose up --build
- Open your browser and go to http://localhost:5000 to view the dashboard.
You can adjust the activation delay and node names in docker-compose.yaml under each worker's environment section:
environment:
NAME: "nodo_1"
TIME: "10"app.py— Flask dashboard applicationdocker-compose.yaml— Multi-container orchestrationDockerfile— Dashboard build instructionsworkers/— Worker node code and Dockerfilerequest.py— Worker scriptDockerfile— Worker build instructionsrequirements.txt— Worker dependencies
templates/index.html— Dashboard UI
- The dashboard starts and listens on port 5000.
- Each worker node starts, waits for its configured time, then sends a request to the dashboard to mark itself as online.
- The dashboard updates the UI to reflect the status of each node.
python3 request.py <sleep_seconds> <node_value>
These arguments are set via environment variables in Docker Compose.
This project is licensed under the MIT License.