Portfolio de mon homelab.
Find a file
2026-11-22 23:55:23 +01:00
ansible Initial commit 2026-11-22 23:55:23 +01:00
monitoring Initial commit 2026-11-22 23:55:23 +01:00
README.md Initial commit 2026-11-22 23:55:23 +01:00

🇫🇷 Français | 🇬🇧 English


Homelab — Infrastructure as Code de bout en bout

Infrastructure personnelle auto-hébergée, entièrement pilotée par code : provisionnement, configuration, sécurité et applications. Elle remplace une installation montée à la main par une infra reproductible, versionnée et automatisée.

Ce dépôt est une vitrine : chaque brique reflète un vrai choix, avec ses compromis assumés plutôt que cachés. Il présente l'architecture, la pile technique et des extraits de code ; la configuration réelle n'y figure pas.


Vue d'ensemble

Internet
   │
   ▼
Traefik (reverse proxy, HTTPS via DNS-01)
   │
   ├── Authelia (SSO, 2FA TOTP, OIDC pour certaines apps) ──> LLDAP (annuaire)
   │
   ├── Forge Git (Forgejo)
   ├── Grafana + Prometheus + Alertmanager (monitoring, alertes email)
   ├── Gestionnaire de mots de passe (Vaultwarden)
   ├── Gestion de tâches (Vikunja, SSO OIDC)
   ├── Portail applicatif maison (catalogue dynamique + admin LDAP)
   ├── Serveur multimédia (Jellyfin, LXC, transcodage matériel iGPU)
   └── Cloud personnel (Nextcloud, LXC, stockage sur pool mergerfs, LDAP)

Orchestrateur Ansible (Semaphore, secrets via SOPS, accessible uniquement en LAN)

Deux VM applicatives sur le même hyperviseur (dev / prod), même code, valeurs différentes : la VM dev sert de terrain de validation avant chaque bascule en production.


Stack technique

Couche Outil Pourquoi ce choix
Hyperviseur Proxmox VE Standard du homelab, gratuit, mature
IaC infra OpenTofu (fork libre de Terraform) Cohérence avec la philosophie open source du projet
Config management Ansible Rôle générique deploy_stack réutilisé pour tous les services
Secrets SOPS + age Secrets chiffrés versionnés dans Git, pas de service tiers à opérer
Stockage SnapRAID + mergerfs Protection contre la panne disque sans les risques de reconstruction du RAID 5
Sauvegarde vzdump (natif Proxmox) Snapshots VM/LXC à chaud, planifiés
Reverse proxy Traefik Découverte automatique via labels Docker, HTTPS natif DNS-01
Identité LLDAP + Authelia Annuaire léger + SSO (2FA, contrôle d'accès fin, OIDC natif pour les apps qui le supportent)
Automatisation Semaphore UI Alternative légère à AWX, jamais exposé publiquement
Forge Git Forgejo Fork communautaire de Gitea, gouvernance non lucrative
Monitoring Prometheus + Grafana + Alertmanager Observabilité VM/LXC/hôte, alertes email (SMART, conteneurs, tâches planifiées)
Multimédia Jellyfin (LXC, iGPU) Transcodage matériel Intel Quick Sync
Cloud personnel Nextcloud (LXC) Stockage utilisateurs adossé au pool mergerfs, LDAP natif
Tâches Vikunja SSO OIDC via Authelia

Choix d'architecture notables

Docker en VM, pas en LXC, pour l'infra principale. Un LXC partage le kernel de l'hôte, ce qui introduit des restrictions de namespace peu compatibles avec le fonctionnement normal de Docker (overlayfs, cgroups). En pratique, cela impose d'activer nesting et d'accepter des effets de bord (décalage d'UID sur les bind mounts, interactions avec systemd-logind). Les VM n'ont pas ces contraintes.

Authelia plutôt que Tinyauth. Le projet a démarré avec Tinyauth (minimaliste), puis migré vers Authelia pour le 2FA, le contrôle d'accès fin et l'OIDC natif — ce dernier permettant un vrai SSO sans double authentification pour les apps qui le supportent, sans la lourdeur d'Authentik.

Portail applicatif fait maison. Aucun outil existant ne propose un catalogue d'applications filtré par groupe LDAP avec la légèreté voulue. Le portail interroge dynamiquement l'API Traefik pour découvrir les services déployés et croise avec les groupes LDAP transmis par Authelia — aucune liste statique à maintenir. Une section d'administration permet la gestion des utilisateurs et groupes via l'API GraphQL de LLDAP.

Exposition minimale, même en interne. Chaque service est évalué individuellement : exposition publique uniquement si un vrai besoin existe, 2FA uniquement si l'enjeu de sécurité le justifie. L'orchestrateur d'automatisation, qui peut exécuter du code sur toute l'infra, reste volontairement inaccessible depuis l'extérieur.

Services exclus du forward-auth. Le gestionnaire de mots de passe et le serveur multimédia s'appuient sur leur propre authentification : leurs clients (extensions navigateur, apps mobiles) s'authentifient via API et ne peuvent pas suivre une redirection web classique.

Mises à jour automatiques, avec contrôle. Les correctifs système sont appliqués par des tâches planifiées (dev d'abord, prod ensuite), suivis d'une vérification que les services sont revenus sains. On n'alerte que sur échec.

Tests SMART robustes aux changements matériels. Le rôle Ansible lit dynamiquement la configuration SnapRAID plutôt qu'une liste de disques codée en dur : il résout les vrais périphériques via findmnt, résistant au renommage /dev/sdX comme à l'ajout d'un disque au pool.


Sécurité

  • HTTPS réel (Let's Encrypt via DNS-01) sur tous les services exposés, y compris en LAN
  • Rate limiting Traefik + fail2ban
  • Authelia : 2FA TOTP, contrôle d'accès par groupe, OIDC pour les apps compatibles
  • Secrets chiffrés (SOPS/age) versionnés, jamais en clair dans Git
  • Principe de moindre privilège (tokens API scopés, comptes de service dédiés en lecture seule)
  • Annuaire LDAP jamais exposé publiquement
  • Sauvegardes VM/LXC régulières (vzdump), sur stockage dédié
  • Alertes email automatiques : dégradation SMART des disques, conteneurs défaillants, tâches planifiées en échec

Dette technique assumée

  • Passthrough GPU et bind mount d'un LXC : Proxmox restreint ces opérations à root@pam, incompatible avec un token API scopé. Gestes manuels documentés, à rejouer après toute recréation du conteneur.
  • Export/montage NFS : configuré manuellement, pas encore en rôle Ansible.
  • Réseau Docker initial de Traefik : à créer avant le premier déploiement sur une nouvelle VM, pas encore automatisé.
  • Statut par conteneur dans Grafana : aucune solution d'exporter mature identifiée (écosystème fragmenté de petits projets peu maintenus).
  • pve_exporter : bug connu, l'usage disque des VM QEMU reste à 0 ; contournement via node_exporter installé dans les VM.

Contenu de ce dépôt

homelab-portfolio/
├── ansible/
│   ├── adddatadisk.yaml            # playbook d'ajout d'un disque de données
│   └── roles/
│       ├── apt_patch/              # mises à jour système non interactives
│       ├── post_reboot_check/      # vérification de l'hôte et des conteneurs après mise à jour
│       ├── snapraid_maintenance/   # sync et scrub planifiés
│       └── pve_data_disk/          # ajout d'un disque (identification par n° de série, formatage confirmé, fstab, SnapRAID, mergerfs)
└── monitoring/
    └── alert_rules.yml.j2          # règles d'alerte Prometheus (SMART, conteneurs, tâches planifiées)

Feuille de route

  • Pipeline CI/CD : webhooks Forgejo vers l'orchestrateur
  • Home Assistant (VM) avec passthrough d'un dongle Zigbee/Z-Wave
  • Déploiement de node_exporter sur tous les hôtes
  • Automatisation des dernières étapes manuelles (réseau Docker initial, montage NFS)
  • Collecte de logs centralisée (Loki + Grafana Alloy)


Homelab — End-to-end Infrastructure as Code

Jump back to the French version ↑

Self-hosted personal infrastructure, entirely driven by code: provisioning, configuration, security and applications. It replaces a hand-built setup with a reproducible, version-controlled, automated infrastructure.

This repository is a showcase: every component reflects an actual decision, with its trade-offs stated rather than hidden. It presents the architecture, the tech stack and code extracts; real configuration is not included.

Overview

Internet
   │
   ▼
Traefik (reverse proxy, HTTPS via DNS-01)
   │
   ├── Authelia (SSO, TOTP 2FA, OIDC for select apps) ──> LLDAP (directory)
   │
   ├── Git forge (Forgejo)
   ├── Grafana + Prometheus + Alertmanager (monitoring, email alerts)
   ├── Password manager (Vaultwarden)
   ├── Task management (Vikunja, OIDC SSO)
   ├── Custom app portal (dynamic catalog + LDAP admin)
   ├── Media server (Jellyfin, LXC, iGPU hardware transcoding)
   └── Personal cloud (Nextcloud, LXC, storage on the mergerfs pool, LDAP)

Ansible orchestrator (Semaphore, SOPS-encrypted secrets, LAN only)

Two application VMs on the same hypervisor (dev / prod), same code, different values: the dev VM is the testing ground before any production rollout.

Tech stack

Layer Tool Why this choice
Hypervisor Proxmox VE Homelab standard, free, mature
Infra IaC OpenTofu (open-source Terraform fork) Consistent with the project's open-source philosophy
Config management Ansible Generic deploy_stack role reused across every service
Secrets SOPS + age Encrypted secrets versioned in Git, no third-party service to run
Storage SnapRAID + mergerfs Disk failure protection without the risks of RAID 5 rebuilds
Backups vzdump (native Proxmox) Live VM/LXC snapshots, scheduled
Reverse proxy Traefik Automatic discovery via Docker labels, native DNS-01 HTTPS
Identity LLDAP + Authelia Lightweight directory + SSO (2FA, fine-grained access control, native OIDC for apps that support it)
Automation Semaphore UI Lightweight AWX alternative, never exposed publicly
Git forge Forgejo Community fork of Gitea, non-profit governance
Monitoring Prometheus + Grafana + Alertmanager VM/LXC/host observability, email alerts (SMART, containers, scheduled jobs)
Media Jellyfin (LXC, iGPU) Intel Quick Sync hardware transcoding
Personal cloud Nextcloud (LXC) User storage backed by the mergerfs pool, native LDAP
Tasks Vikunja OIDC SSO via Authelia

Notable architecture decisions

Docker on a VM, not an LXC, for the core infrastructure. An LXC shares the host's kernel, which brings namespace restrictions that sit poorly with Docker's normal operation (overlayfs, cgroups). In practice it requires enabling nesting and living with side effects (UID offsets on bind mounts, interactions with systemd-logind). VMs don't have these constraints.

Authelia over Tinyauth. The project started with Tinyauth (minimal), then moved to Authelia for 2FA, fine-grained access control and native OIDC — the latter enabling true SSO without double authentication for apps that support it, without the overhead of Authentik.

A homegrown app portal. No existing tool offers an application catalog filtered by LDAP group with the lightness wanted here. The portal dynamically queries the Traefik API to discover deployed services and cross-references them with the LDAP groups forwarded by Authelia — no static list to maintain. An admin section handles user and group management through LLDAP's GraphQL API.

Minimal exposure, even internally. Every service is evaluated individually: public exposure only when there is a real need, 2FA only when the security stakes justify it. The automation orchestrator, which can run code across the whole infrastructure, stays deliberately unreachable from the outside.

Services excluded from forward-auth. The password manager and the media server rely on their own authentication: their clients (browser extensions, mobile apps) authenticate via API and cannot follow a standard web redirect.

Automatic updates, with verification. System patches are applied by scheduled jobs (dev first, then prod), followed by a check that services came back healthy. Alerts fire only on failure.

SMART tests resilient to hardware changes. The Ansible role reads the SnapRAID configuration dynamically rather than a hardcoded disk list: it resolves real devices via findmnt, surviving /dev/sdX renaming as well as new disks being added to the pool.

Security

  • Real HTTPS (Let's Encrypt via DNS-01) on every exposed service, LAN-only ones included
  • Traefik rate limiting + fail2ban
  • Authelia: TOTP 2FA, group-based access control, OIDC for compatible apps
  • Encrypted secrets (SOPS/age) versioned, never in plaintext in Git
  • Least privilege (scoped API tokens, dedicated read-only service accounts)
  • LDAP directory never publicly exposed
  • Regular VM/LXC backups (vzdump), on dedicated storage
  • Automatic email alerts: disk SMART degradation, failing containers, failed scheduled jobs

Acknowledged technical debt

  • GPU passthrough and bind mount on an LXC: Proxmox restricts these operations to root@pam, incompatible with a scoped API token. Manual steps documented, to be replayed after any container recreation.
  • NFS export/mount: configured manually, not yet an Ansible role.
  • Traefik's initial Docker network: must exist before the first deployment on a new VM, not yet automated.
  • Per-container status in Grafana: no mature exporter identified (fragmented ecosystem of small, poorly maintained projects).
  • pve_exporter: known bug, QEMU VM disk usage stays at 0; worked around with node_exporter installed inside the VMs.

Contents of this repository

homelab-portfolio/
├── ansible/
│   ├── adddatadisk.yaml            # playbook to add a data disk
│   └── roles/
│       ├── apt_patch/              # non-interactive system updates
│       ├── post_reboot_check/      # host and container checks after an update
│       ├── snapraid_maintenance/   # scheduled sync and scrub
│       └── pve_data_disk/          # add a disk (serial-number identification, confirmed format, fstab, SnapRAID, mergerfs)
└── monitoring/
    └── alert_rules.yml.j2          # Prometheus alert rules (SMART, containers, scheduled jobs)

Roadmap

  • CI/CD pipeline: Forgejo webhooks to the orchestrator
  • Home Assistant (VM) with Zigbee/Z-Wave dongle passthrough
  • Roll out node_exporter on every host
  • Automate the remaining manual steps (initial Docker network, NFS mount)
  • Centralized log collection (Loki + Grafana Alloy)