initial commit
This commit is contained in:
347
MAINTENANCE.md
Normal file
347
MAINTENANCE.md
Normal file
@@ -0,0 +1,347 @@
|
||||
# 🔧 Maintenance et Administration
|
||||
|
||||
## Commandes de Base
|
||||
|
||||
### Démarrer l'application
|
||||
```bash
|
||||
cd WebNationsGlory_ServeurBuild_Red
|
||||
./start.sh
|
||||
```
|
||||
|
||||
### Arrêter l'application
|
||||
```bash
|
||||
# Ctrl+C dans le terminal
|
||||
```
|
||||
|
||||
### Redémarrer l'application
|
||||
```bash
|
||||
# 1. Arrêtez avec Ctrl+C
|
||||
# 2. Relancez avec ./start.sh
|
||||
```
|
||||
|
||||
## Dépannage
|
||||
|
||||
### Vérifier l'état de RCON
|
||||
```bash
|
||||
# Test simple
|
||||
echo "status" | timeout 2 bash -c 'exec 3<>/dev/tcp/localhost/25575; cat >&3; cat <&3' 2>/dev/null || echo "RCON non accessible"
|
||||
|
||||
# Avec nc (netcat)
|
||||
nc -w 2 localhost 25575 < /dev/null && echo "RCON OK" || echo "RCON KO"
|
||||
|
||||
# Avec telnet
|
||||
telnet localhost 25575
|
||||
```
|
||||
|
||||
### Vérifier les logs du serveur MC
|
||||
```bash
|
||||
# Dernières 50 lignes
|
||||
tail -50 /path/to/mc-server/latest.log
|
||||
|
||||
# Rechercher les erreurs
|
||||
grep ERROR /path/to/mc-server/latest.log
|
||||
|
||||
# Suivre en temps réel
|
||||
tail -f /path/to/mc-server/latest.log
|
||||
```
|
||||
|
||||
### Vérifier si le port 3000 est utilisé
|
||||
```bash
|
||||
# Linux/Mac
|
||||
lsof -i :3000
|
||||
|
||||
# Windows PowerShell
|
||||
Get-Process -Id (Get-NetTCPConnection -LocalPort 3000).OwningProcess
|
||||
|
||||
# Tuer le processus (Linux/Mac)
|
||||
kill -9 $(lsof -t -i :3000)
|
||||
```
|
||||
|
||||
### Réinitialiser Node.js
|
||||
```bash
|
||||
cd backend
|
||||
|
||||
# Supprimer node_modules
|
||||
rm -rf node_modules
|
||||
rm package-lock.json
|
||||
|
||||
# Réinstaller
|
||||
npm install
|
||||
|
||||
# Redémarrer
|
||||
npm start
|
||||
```
|
||||
|
||||
## Gestion des OPs
|
||||
|
||||
### Ajouter un OP sur le serveur MC
|
||||
```
|
||||
/op NomdujoueurMC
|
||||
```
|
||||
|
||||
### Vérifier les OPs
|
||||
```bash
|
||||
# Fichier ops.txt
|
||||
cat /path/to/mc-server/ops.txt
|
||||
|
||||
# Ou ops.json (Minecraft 1.8+)
|
||||
cat /path/to/mc-server/ops.json
|
||||
```
|
||||
|
||||
## Backups
|
||||
|
||||
### Créer un backup manuel
|
||||
```bash
|
||||
cd /path/to/mc-server
|
||||
|
||||
# Créer un tar.gz du serveur
|
||||
tar -czf ../backup-$(date +%Y%m%d-%H%M%S).tar.gz .
|
||||
|
||||
# Avec exclusion de certains fichiers
|
||||
tar -czf ../backup-$(date +%Y%m%d-%H%M%S).tar.gz \
|
||||
--exclude='*.log' \
|
||||
--exclude='cache' \
|
||||
--exclude='.web-admin' \
|
||||
.
|
||||
```
|
||||
|
||||
### Restaurer un backup
|
||||
```bash
|
||||
# Arrêter le serveur d'abord!
|
||||
./stop.sh
|
||||
|
||||
# Restaurer
|
||||
cd /backup/location
|
||||
tar -xzf backup-file.tar.gz -C /path/to/mc-server
|
||||
|
||||
# Redémarrer
|
||||
cd /path/to/mc-server
|
||||
./start.sh
|
||||
```
|
||||
|
||||
## Logs et Monitoring
|
||||
|
||||
### Voir les logs backend en temps réel
|
||||
```bash
|
||||
cd backend
|
||||
npm start
|
||||
```
|
||||
|
||||
### Voir les logs RCON (historique des commandes)
|
||||
```bash
|
||||
cat /path/to/mc-server/.web-admin/rcon-history.json
|
||||
```
|
||||
|
||||
### Nettoyer les vieux logs
|
||||
```bash
|
||||
# Supprimer les logs de plus de 30 jours
|
||||
find /path/to/mc-server -name "*.log" -mtime +30 -delete
|
||||
```
|
||||
|
||||
## Variables d'Environnement
|
||||
|
||||
### Changer le port
|
||||
```env
|
||||
# backend/.env
|
||||
PORT=8080
|
||||
```
|
||||
|
||||
### Changer le répertoire du serveur
|
||||
```env
|
||||
# backend/.env
|
||||
SERVER_DIR=/path/to/other/mc-server
|
||||
```
|
||||
|
||||
### Changer les identifiants RCON
|
||||
```env
|
||||
# backend/.env
|
||||
RCON_HOST=192.168.1.100
|
||||
RCON_PORT=25576
|
||||
```
|
||||
|
||||
## Mise à Jour des Dépendances
|
||||
|
||||
### Vérifier les mises à jour disponibles
|
||||
```bash
|
||||
cd backend
|
||||
npm outdated
|
||||
```
|
||||
|
||||
### Mettre à jour les dépendances
|
||||
```bash
|
||||
cd backend
|
||||
npm update
|
||||
```
|
||||
|
||||
### Mettre à jour une dépendance spécifique
|
||||
```bash
|
||||
cd backend
|
||||
npm install express@latest
|
||||
```
|
||||
|
||||
## Sécurité
|
||||
|
||||
### Changer le SESSION_SECRET
|
||||
```bash
|
||||
# Générer une nouvelle clé
|
||||
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
|
||||
|
||||
# Mettre à jour dans backend/.env
|
||||
SESSION_SECRET=<nouvelle-cle-generee>
|
||||
|
||||
# Redémarrer l'application
|
||||
```
|
||||
|
||||
### Changer le mot de passe RCON
|
||||
```bash
|
||||
# Via l'interface web: Dashboard → Changer RCON
|
||||
# Ou éditer manuellement server.properties:
|
||||
rcon.password=NewPassword123
|
||||
|
||||
# Redémarrer le serveur MC
|
||||
```
|
||||
|
||||
## Performance
|
||||
|
||||
### Vérifier l'utilisation mémoire Node.js
|
||||
```bash
|
||||
ps aux | grep node
|
||||
|
||||
# Linux avec plus de détails
|
||||
ps -eo pid,vsz,rss,comm | grep node
|
||||
```
|
||||
|
||||
### Nettoyer les fichiers temporaires
|
||||
```bash
|
||||
cd backend
|
||||
rm -rf node_modules
|
||||
npm install
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### L'application démarre mais l'interface ne charge pas
|
||||
```bash
|
||||
# Vérifier que le frontend est bien servi
|
||||
curl http://localhost:3000/
|
||||
# Doit retourner l'HTML
|
||||
|
||||
# Vérifier la console du navigateur (F12) pour les erreurs
|
||||
```
|
||||
|
||||
### Les commandes RCON n'exécutent pas
|
||||
```bash
|
||||
# Vérifier que RCON est activé
|
||||
grep "enable-rcon" /path/to/mc-server/server.properties
|
||||
# Doit être: enable-rcon=true
|
||||
|
||||
# Vérifier le mot de passe RCON
|
||||
grep "rcon.password" /path/to/mc-server/server.properties
|
||||
|
||||
# Tester RCON directement
|
||||
echo "say Test" | nc localhost 25575
|
||||
```
|
||||
|
||||
### Base de données de sessions corruptée
|
||||
```bash
|
||||
# Supprimer les sessions
|
||||
rm -rf backend/sessions/*
|
||||
|
||||
# Redémarrer l'application
|
||||
./start.sh
|
||||
```
|
||||
|
||||
## Commandes Minecraft Utiles
|
||||
|
||||
### Via la console web
|
||||
|
||||
```
|
||||
/list # Liste les joueurs
|
||||
/say @a Message # Message à tous
|
||||
/tp @p @s # Téléporter
|
||||
/weather clear # Météo
|
||||
/time set day # Heure
|
||||
/gamerule <règle> # Game rules
|
||||
/difficulty 3 # Difficulté
|
||||
/seed # Seed du monde
|
||||
/spawnpoint @p 0 100 0 # Spawnpoint
|
||||
```
|
||||
|
||||
## Scripts Automatisés
|
||||
|
||||
### Script de backup automatique
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# save-mc-backup.sh
|
||||
|
||||
SERVER_DIR="/path/to/mc-server"
|
||||
BACKUP_DIR="$SERVER_DIR/backups"
|
||||
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
DATE=$(date +%Y%m%d_%H%M%S)
|
||||
BACKUP_FILE="$BACKUP_DIR/backup_$DATE.tar.gz"
|
||||
|
||||
cd "$SERVER_DIR"
|
||||
tar -czf "$BACKUP_FILE" \
|
||||
--exclude='*.log' \
|
||||
--exclude='cache' \
|
||||
--exclude='.web-admin' \
|
||||
.
|
||||
|
||||
echo "Backup créé: $BACKUP_FILE"
|
||||
|
||||
# À ajouter à crontab:
|
||||
# 0 2 * * * /path/to/save-mc-backup.sh
|
||||
```
|
||||
|
||||
### Script de redémarrage programmé
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# restart-mc-server.sh
|
||||
|
||||
echo "Redémarrage du serveur MC dans 1 minute..."
|
||||
|
||||
# Via RCON
|
||||
echo "say Redémarrage dans 1 minute!" | nc localhost 25575
|
||||
sleep 30
|
||||
echo "say 30 secondes!" | nc localhost 25575
|
||||
sleep 20
|
||||
echo "say 10 secondes!" | nc localhost 25575
|
||||
sleep 10
|
||||
echo "stop" | nc localhost 25575
|
||||
|
||||
sleep 5
|
||||
|
||||
# Redémarrer
|
||||
cd /path/to/mc-server
|
||||
./start.sh
|
||||
```
|
||||
|
||||
## Monitoring
|
||||
|
||||
### Vérifier l'espace disque
|
||||
```bash
|
||||
# Espace utilisé par le serveur
|
||||
du -sh /path/to/mc-server
|
||||
|
||||
# Espace libre
|
||||
df -h /path/to/mc-server
|
||||
```
|
||||
|
||||
### Vérifier les processus Node.js
|
||||
```bash
|
||||
ps aux | grep node
|
||||
# Ou
|
||||
ps aux | grep npm
|
||||
```
|
||||
|
||||
### Vérifier les ports en écoute
|
||||
```bash
|
||||
netstat -tlnp | grep 3000 # Node.js
|
||||
netstat -tlnp | grep 25575 # RCON
|
||||
netstat -tlnp | grep 25565 # Serveur MC
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**💡 Astuce**: Sauvegardez ces commandes pour un accès rapide!
|
||||
Reference in New Issue
Block a user