Add: homelab: apprentissage à la dure

This commit is contained in:
DuN0z 2025-09-30 04:42:58 +02:00
parent fdb82f1f05
commit 79001a0cb6
2 changed files with 79 additions and 0 deletions

View file

@ -0,0 +1,39 @@
+++
date = '2025-09-29T20:13:40+02:00'
draft = false
tags = [ "nixos", "self-hosting" ]
title = 'Homelab: Learning the hard way'
+++
Spending the weekend with family, I took the chance to check whether I could still access my various sites and services from outside. Feeling pretty good after that success, I thought—why not set up rtorrent through ProtonVPN on the server?
## The Beginning of the Screw-ups
Naturally, it wasnt going to be straightforward. Natively, its already messy, but with NixOS? Utter chaos. So I turned to an AI, hoping for some explanations, and started blindly pasting random commands it spit out whenever an error showed up. Of course, nothing ever worked, and even worse, I had no clue what I was actually doing. In situations like that, you can smell disaster coming a mile away.
And sure enough—thats exactly what happened! Boom, the whole network broke. No more outside access, sites and services down, just the big blank page of doom.
No problem, I thought—lets just ssh in and fix the mess… except, nope, I had closed my session, and ssh was now dead too. And that was it. Game over for the weekend, Id have to wait until I got back home.
## NixOS to the Rescue
End of the weekend, I get back home, plug a screen into the server, and hook up a USB keyboard. And heres where NixOS really shows its magic.
- I reboot into an earlier generation with no issues.
- I remove rtorrent.nix and another imported file.
- I rebuild and reboot.
- Once it comes back up, services are running again. All thats left is a bit of cleanup in the Git repo.
## Lessons Learned
This whole thing could be a chapter of “self-hosting the hard way.” You always learn best the hard way, dont you? So, to sum up:
- Dont mess with configs on weekends—and absolutely not the networking part.
- Keep Git up to date so you can roll back easily; it makes git reset a lot simpler.
- NixOS is insanely useful when it comes to fixing your screw-ups in no time flat.
## Resolutions
Beyond the obvious—stop making critical changes when I dont have physical access to the machine—I think Ill set up a method to build NixOS VMs directly from my flake directories, just to test out some configurations. At the very least, Ill create separate branches for experiments, so I can always rebuild from master if needed. Way simpler in the long run.
In short, NixOS gives you huge flexibility. Might as well take full advantage of it, right?

View file

@ -0,0 +1,40 @@
+++
date = '2025-09-29T20:13:40+02:00'
draft = false
tags = [ "nixos", "auto-hébergement" ]
title = 'Homelab : apprentissage à la dure'
+++
En week end dans la famille, j'en ai profité pour vérifier que j'avais bien accès aux différents sites et services de l'extérieur, et galvanisé par cette réussite, je me suis dis, pourquoi ne pas configurer rtorrent au travers d'un VPN protonvpn sur le serveur ?
## Le début des conneries
Bien évidemment, c'est pas le truc le plus simple de prime abord. Nativement d'abord, mais via NixOs, je vous raconte pas le bordel. Donc go une IA, pour essayer d'avoir des explications, et je commence à partir à l'aveugle à taper en vrac ce que l'IA me donne au fil des bugs. Bien évidemment, à aucun moment ça fonctionne, et surtout à aucun moment je ne comprend ce que je fais ; et en général dans ces cas là, ça sent la connerie à la fin, c'est moi qui vous le dis.
Et bien vous savez quoi ? C'est exactement ce qu'il s'est passé !!! Et paf, réseau pété, plus d'accès via l'extérieur, site et services ne répondent plus, c'est la page blanche, la grosse tuile.
C'est pas grave ! Go ssh récupérer la connerie.... ha bah non, j'ai quitté la session, et ssh est devenu inaccessible aussi. Et bah voila. C'est mort
pour le week, faudra attendre de rentrer au bercail.
## NixOs le sauveur
Fin du week end, je rentres chez moi, je balance l'écran sur la sortie du serveur, je branche un clavier en usb. Et c'est la que ça devient bon, que NixOs dévoile tout son potentiel.
- je commences par rebooter sur une génération qui ne pose aucun problème ;
- Je vires rtorrent.nix et un autre fichier qu'il importe ;
- Je rebuild, et je reboot ;
- Une fois rebooté, les services sont en ligne, reste plus qu'a faire un peu le ménage supplémentaire dans le dépôt git.
## Leçon apprise
Tout ça est un peu un chapitre façon "self-hosting the hard way". On apprend toujours mieux à la dure, n'est ce pas ? Donc pour conclure :
- On ne tripote pas la config en week end, et **surtout pas** la partie réseau ;
- On maintien le *git* à jour pour pouvoir revenir en arrière facilement ; ça rend les *git reset* beaucoup plus simple.
- NixOs est quand même hyper pratique pour récuperer les conneries en 2 coups de cuillères à pot si vous me permettez l'expression.
## Résolutions
Hormis le fait que je vais arrêter de faire des trucs critiques quand je n'ai pas la main physiquement sur la machine, je pense que je vais mettre en place une méthode pour builder des vm NixOs à partir des répertoires flakes pour qualifier certaines configurations. Ou au minimum, créer des branches à part pour les test, pour si nécessaire, rebuild en branche master. Tellement plus simple au final.
Bref, NixOs permet une énorme souplesse. Autant l'utiliser non ?