Infratech is a containerized, production-ready system monitoring platform. It connects to a target remote Linux server via SSH at regular intervals, gathers telemetry data (CPU, RAM, Disk usage, and Uptime), processes analytics, and displays performance history on a premium dark-themed dashboard.
This project is deployed as a secure Three-Tier Architecture using Docker Compose, utilizing Nginx as a reverse proxy, Gunicorn + Django as the application server, and MySQL as the relational datastore.
graph TD
Client([User Web Browser]) -->|HTTP Port 80| Nginx[Nginx Gateway Container]
subgraph Presentation & Edge Tier
Nginx
end
subgraph Application & Logic Tier
Nginx -->|Proxy dynamic views| Django[Django Container - Gunicorn]
Scheduler[Metric Scheduler Container] -->|Collects Telemetry| Target(Remote Linux VM)
end
subgraph Data Tier
Django -->|SQL Queries| DB[(MySQL Database Container)]
Scheduler -->|Writes Logs| DB
end
subgraph Shared Storage
Django -->|collectstatic| StaticVol[(Shared Static Files Volume)]
Nginx -->|Serves CSS/JS directly| StaticVol
end
- Presentation Tier (Nginx):
Runs
nginx:alpineon port80. It intercepts incoming requests, serves static CSS/JS files directly from a shared Docker volume (offloading static serving from Python), and reverse-proxies dynamic requests back to Gunicorn. - Application Tier (Django & Gunicorn):
Django backend logic and background metrics scheduler. Django runs on a production WSGI HTTP server (
gunicorn) bound internally on port8000. The scheduler daemon polls target metrics over SSH via Paramiko. - Data Tier (MySQL):
Relational MySQL database persisting historical metrics telemetry. Port
3306is bound with volume storage to prevent data loss on container rebuilds.
- Docker & Docker Compose installed on your laptop.
- A Target Linux Server (AWS EC2, Azure VM, DigitalOcean Droplet, Raspberry Pi, etc.) running SSH.
- SSH Key Access: An SSH private key (
.pemfile) configured on your laptop that has access to your server.
When you provision a virtual machine on cloud providers like Azure (Azure VM), AWS (EC2), or Google Cloud (GCE), you are prompted to generate or upload an SSH key pair.
- Download the private key (typically a
.pemfile, e.g.,infratech_key.pem) provided by your provider during VM creation. - Move or copy this private key file into the ssh_keys/ directory in this project.
- Set strict file permissions: On Unix-like systems (Linux, macOS), SSH requires private keys to have restricted access permissions. If permissions are too open, connection attempts will be rejected. Run the following command:
(Note: If you are running Docker on Windows, the Docker host will generally handle access control, but make sure the file is not publicly writable.)
chmod 400 ssh_keys/your_key_name.pem
- Ensure your cloud provider's network security group (NSG) or firewall rules allow inbound TCP traffic on port 22 (SSH) to the VM.
Copy the template environment file to create your own configuration:
cp .env.example .envOpen the newly created .env file and customize the variables for your target server:
SSH_VM_HOST=your_server_ip_or_domain
SSH_VM_USERNAME=your_ssh_username
SSH_VM_KEY_NAME=your_pem_file_name_inside_ssh_keys_folderDeploy the application with Docker Compose:
docker compose up --buildThis automatically:
- Waits for the MySQL database to boot and completes schema migrations.
- Runs Django's asset compiler
collectstaticto populate the shared volume. - Starts the Gunicorn web app server.
- Launches Nginx to serve requests on http://localhost:8080.
- Starts the scheduler to fetch remote metrics every 60 seconds.
My objective for this project was to learn docker and containerization, and deploy a 3-tier architecture on a remote server. I'll add multiple VM management, improved UI and alert mechanism in future.
The image shown below is only a visual interpretation. Future updates might coincide within the dashboard.