This repository contains the architecture and configuration of my local laboratory (Homelab). The objective of the project is to deploy a functional private cloud and a professional monitoring stack using containers, applying Infrastructure as Code (IaC) methodologies and security best practices.
The environment is completely contanerized with Docker Compose and segmented into isolated networks to mitigate the attack surface
-
Storage
- Nextcloud
- PostgreSQL15 (for the NextCloud backend)
-
Observability and Monitoring
- Node exporter (for hardware metrics)
- Prometheus (metric scraping)
- Grafana (Visual Dashboard for the Prometheus database)
-
Security Practices
- Network Isolation: Configured two bridge networks (
net-frontendandnet-backend). Database and metric collection components operate isolated in the backend network. - Secure Credential Injection: Sensitive configuration managed locally usin a (
.env) file. - Principle of Least Privilege: Monitoring containers have no access to or knowledge of the Nextcloud database credentials.
- Docker and Docker Compose installed on the host system.
- Local user permissions configured in the
dockergroup.
Clone the project and create your local credentials file from the provided template:
git clone [https://github.com/PedroSaavedraR/Homelab.git](https://github.com/PedroSaavedraR/Homelab.git)
cd Homelab
cp .env.example .envNote
Edit the (.env) file with your own passwords
For security reasons, the Grafana container runs under an unprivileged user (UID 472). It is necessary to grant ownership of the local persistence folder:
sudo chown -R 472:472 ./grafana_datadocker compose up -d| Service | Local URL |
|---|---|
| Nextcloud | http://localhost:8080 |
| Grafana | http://localhost:3000 |
Note
To view system metrics immediately, log into Grafana with the credentials configured in your .env file, navigate to Dashboards -> Import, enter ID 1860 (Node Exporter Full), and bind it to the internal Prometheus data source.
