commit 568231ceba3833acc5abc9a88b0f0298a84f231b Author: Mathieu Vergez Date: Fri Apr 17 16:55:36 2026 +0200 init: documentation serveur diff --git a/SERVER.md b/SERVER.md new file mode 100644 index 0000000..548ef68 --- /dev/null +++ b/SERVER.md @@ -0,0 +1,161 @@ +# 🖥️ SERVER.md — Documentation du serveur `lespotitschats` + +> Dernière mise à jour : Avril 2026 +> À maintenir à jour après chaque modification majeure. + +--- + +## 📡 Accès + +| Champ | Valeur | +|--------------|-------------------------------| +| IP locale | 192.168.1.54 | +| Hostname | lespotitschats | +| User SSH | vohorgeez | + +```bash +ssh vohorgeez@192.168.1.54 +``` + +--- + +## 🐳 Services Docker (état réel) + +| Service | Image | Port exposé | URL locale | Notes | +|----------------|----------------------------|-------------|----------------------------- |------------------------------| +| Jellyfin | jellyfin/jellyfin | :8096 | http://192.168.1.54:8096 | Media server, healthy | +| Nextcloud | nextcloud | :8080 | http://192.168.1.54:8080 | Cloud perso | +| Nextcloud DB | mariadb:10.6 | interne | — | Ne pas exposer | +| Gitea | gitea/gitea | :3000 / :222| http://192.168.1.54:3000 | :222 = SSH Git | +| Portainer | portainer/portainer-ce:sts | :9443 | https://192.168.1.54:9443 | ⚠️ HTTPS uniquement | +| PostgreSQL | postgres:17 | :5432 | — | ⚠️ Exposé — à restreindre | +| mnist-app | mnist-app (local) | :8501 | http://192.168.1.54:8501 | App ML perso | + +--- + +## ⚙️ Services système actifs + +| Service | Rôle | +|-------------------|---------------------------------------| +| nginx | Reverse proxy | +| fail2ban | Protection brute-force SSH | +| netdata | Monitoring infra (interface web) | +| ssh | Accès distant | +| docker | Runtime containers | +| unattended-upgrades | MAJ sécurité automatiques | + +--- + +## 📁 Dossiers importants + +``` +/data/media → Fichiers Jellyfin (films, séries, musique) +/data/cloud → Données Nextcloud +/data/backups → Sauvegardes +/data/projects → Projets perso / code +``` + +--- + +## 🔄 Procédures + +### Redémarrer un service Docker + +```bash +docker restart + +# Exemples : +docker restart jellyfin +docker restart nextcloud +docker restart gitea +``` + +### Voir les logs d'un container + +```bash +docker logs --tail 50 -f +``` + +### Arrêter / relancer tous les containers + +```bash +docker stop $(docker ps -q) +docker start $(docker ps -a -q) +``` + +--- + +### Ajouter un nouveau service Docker + +1. Crée un dossier dans `/data/projects/nom_service/` +2. Ajoute un `docker-compose.yml` +3. Lance : + +```bash +cd /data/projects/nom_service +docker compose up -d +``` + +4. Configure nginx si tu veux un reverse proxy : + +```bash +sudo nano /etc/nginx/sites-available/nom_service +sudo ln -s /etc/nginx/sites-available/nom_service /etc/nginx/sites-enabled/ +sudo nginx -t && sudo systemctl reload nginx +``` + +5. **Documente le service dans ce fichier.** + +--- + +### Sauvegarder manuellement + +```bash +# Nextcloud +docker exec nextcloud php occ maintenance:mode --on +tar -czf /data/backups/nextcloud_$(date +%F).tar.gz /data/cloud +docker exec nextcloud php occ maintenance:mode --off + +# Gitea +docker exec gitea gitea dump -c /data/gitea/conf/app.ini +``` + +--- + +### Redémarrer le serveur proprement + +```bash +# Vérifier que tout est propre avant +docker ps +sudo systemctl status nginx + +# Reboot +sudo reboot +``` + +**Après reboot, vérifier :** + +```bash +docker ps # tous les containers sont up ? +curl http://localhost:8096 # Jellyfin +curl http://localhost:8080 # Nextcloud +curl http://localhost:3000 # Gitea +``` + +--- + +## ⚠️ Points de vigilance + +- `postgres` est exposé sur `:5432` → restreindre avec un firewall ou le mettre en réseau Docker interne uniquement +- `Portainer` est en HTTPS sur `:9443` (pas `:9000`) +- `fail2ban` est actif → 3 échecs SSH = bannissement + +--- + +## 📌 TODO / Améliorations futures + +- [ ] Restreindre PostgreSQL au réseau Docker interne +- [ ] Mettre en place des sauvegardes automatiques (cron) +- [ ] Configurer les sous-domaines nginx pour chaque service +- [ ] Ajouter monitoring des volumes disque +