📝 Consolidation documentation : suppression redondances, config centralisée
This commit is contained in:
111
MODIFICATIONS.md
111
MODIFICATIONS.md
@@ -1,83 +1,66 @@
|
|||||||
# 📝 Résumé des Modifications - Configuration Portable
|
# 📝 Modifications Techniques
|
||||||
|
|
||||||
Ce document résume les modifications apportées pour rendre le déploiement portable et simplifié.
|
Résumé des changements pour portabilité et simplification.
|
||||||
|
|
||||||
## 🎯 Objectifs Atteints
|
## ✅ Objectifs Atteints
|
||||||
|
|
||||||
✅ **Chemins relatifs** : Plus de chemins absolus du type `/home/innotex/...`
|
- ✅ Chemins relatifs (100% portable)
|
||||||
✅ **Variables d'environnement** : Configuration centralisée via fichiers `.env`
|
- ✅ Configuration centralisée (shared.env)
|
||||||
✅ **Détection automatique de l'hôte** : L'API fonctionne avec localhost, IP ou domaine
|
- ✅ Détection automatique API
|
||||||
✅ **Déploiement unifié** : Un seul script pour tout démarrer
|
- ✅ Synchronisation Git automatique
|
||||||
✅ **Portabilité totale** : Fonctionne sur n'importe quelle machine Linux
|
- ✅ Déploiement unifié
|
||||||
|
|
||||||
## 📁 Fichiers Créés
|
## 🔑 Changements Clés
|
||||||
|
|
||||||
### Dossier racine (`Serveur NationsGlory/`)
|
### 1. Configuration Centralisée
|
||||||
- **`deploy.sh`** : Script principal de déploiement (démarre MC + Web)
|
|
||||||
- **`stop.sh`** : Script d'arrêt de tous les services
|
|
||||||
- **`check-config.sh`** : Script de vérification de configuration
|
|
||||||
- **`README.md`** : Documentation principale du projet
|
|
||||||
- **`QUICKSTART.md`** : Guide de démarrage rapide
|
|
||||||
|
|
||||||
### Application Web (`WebNationsGlory_ServeurBuild_Red/`)
|
**Avant** : Fichiers `.env` distincts dans chaque service
|
||||||
- **`.env.example`** : Template de configuration avec toutes les variables
|
**Après** : `shared.env` appliquée aux deux services via docker-compose.yml
|
||||||
- **`nginx.conf.example`** : Configuration nginx pour production avec SSL
|
|
||||||
|
|
||||||
## 🔧 Fichiers Modifiés
|
|
||||||
|
|
||||||
### Application Web
|
|
||||||
|
|
||||||
#### `docker-compose.yml`
|
|
||||||
**Avant** :
|
|
||||||
```yaml
|
|
||||||
environment:
|
|
||||||
SERVER_DIR: /home/innotex/NationsGloryRED/NationsGlory_ServeurBuild_Red
|
|
||||||
volumes:
|
|
||||||
- /home/innotex/NationsGloryRED/NationsGlory_ServeurBuild_Red:/mc-server
|
|
||||||
```
|
|
||||||
|
|
||||||
**Après** :
|
|
||||||
```yaml
|
```yaml
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- ../shared.env # Configuration commune (priorité basse)
|
||||||
environment:
|
- .env # Surcharges locales (priorité haute)
|
||||||
SERVER_DIR: /mc-server
|
|
||||||
RCON_HOST: ${RCON_HOST:-localhost}
|
|
||||||
# ... autres variables
|
|
||||||
volumes:
|
|
||||||
- ${MC_SERVER_PATH:-../NationsGlory_ServeurBuild_Red}:/mc-server:ro
|
|
||||||
network_mode: host # Pour accès depuis l'extérieur
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `backend/src/server.js`
|
### 2. Chemins Relatifs
|
||||||
**Modification** : CORS dynamique pour supporter toutes les origines
|
|
||||||
```javascript
|
|
||||||
// Avant
|
|
||||||
app.use(cors({ origin: true, credentials: true }));
|
|
||||||
|
|
||||||
// Après
|
**Avant** : `/home/innotex/NationsGloryRED/NationsGlory_ServeurBuild_Red`
|
||||||
app.use(cors({
|
**Après** : `${MC_SERVER_PATH:-../NationsGlory_ServeurBuild_Red}`
|
||||||
origin: (origin, callback) => {
|
|
||||||
const allowedOrigin = process.env.CORS_ORIGIN || true;
|
### 3. Détection Automatique API
|
||||||
callback(null, allowedOrigin);
|
|
||||||
},
|
**Avant** : API URL codée en dur (localhost seulement)
|
||||||
credentials: true
|
**Après** : Détection via `window.location.protocol` + `window.location.hostname`
|
||||||
}));
|
|
||||||
|
```javascript
|
||||||
|
const API_URL = `${window.location.protocol}//${window.location.hostname}:4001/api`;
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `frontend/public/js/app.js`
|
### 4. CORS Dynamique
|
||||||
**Avant** :
|
|
||||||
```javascript
|
**Avant** : Accepter tous origins (security flaw)
|
||||||
const API_URL = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'
|
**Après** : CORS configurable par variable d'environnement
|
||||||
? 'http://localhost:4001/api'
|
|
||||||
: `http://${window.location.hostname}:4001/api`;
|
### 5. npm Install Fix
|
||||||
|
|
||||||
|
**Avant** : `RUN npm install --production` (oubliait devDependencies)
|
||||||
|
**Après** : `RUN npm install` + vérification express
|
||||||
|
|
||||||
|
## 📋 Fichiers de Configuration
|
||||||
|
|
||||||
|
```
|
||||||
|
shared.env.example # Template centralisé
|
||||||
|
shared.env # Configuration réelle (non versionné)
|
||||||
|
NationsGlory_ServeurBuild_Red/.env
|
||||||
|
WebNationsGlory_ServeurBuild_Red/.env
|
||||||
```
|
```
|
||||||
|
|
||||||
**Après** :
|
## 🔄 Scripts d'Automatisation
|
||||||
```javascript
|
|
||||||
const API_URL = (() => {
|
- `deploy.sh` - Déploiement complet
|
||||||
const protocol = window.location.protocol; // http: ou https:
|
- `stop.sh` - Arrêt des services
|
||||||
const hostname = window.location.hostname; // IP ou domaine
|
- `check-config.sh` - Vérification + Git sync
|
||||||
const port = '4001';
|
const port = '4001';
|
||||||
|
|
||||||
if (window.location.port === port) {
|
if (window.location.port === port) {
|
||||||
|
|||||||
@@ -1,44 +1,48 @@
|
|||||||
# 🚀 Guide de Démarrage Rapide - NationsGlory
|
# 🚀 Démarrage Rapide - 5 Minutes
|
||||||
|
|
||||||
## Installation en 5 minutes
|
## Avant de commencer
|
||||||
|
|
||||||
### 1️⃣ Configuration du serveur Minecraft
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd NationsGlory_ServeurBuild_Red
|
# Prérequis
|
||||||
cp .env.example .env
|
- Git installé
|
||||||
nano .env # Modifiez RCON_PASSWORD
|
- Docker + Docker Compose
|
||||||
|
- Ports 25565, 25575, 4001 disponibles
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2️⃣ Configuration de l'application web
|
## Installation
|
||||||
|
|
||||||
|
### Étape 1 : Synchroniser les repositories
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ../WebNationsGlory_ServeurBuild_Red
|
./check-config.sh
|
||||||
cp .env.example .env
|
|
||||||
nano .env
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Modifiez au minimum :**
|
### Étape 2 : Configuration centralisée
|
||||||
- `SESSION_SECRET` : Générez avec `openssl rand -base64 32`
|
|
||||||
- `RCON_PASSWORD` : **Même valeur** que dans le serveur MC
|
```bash
|
||||||
|
# Copier le template
|
||||||
### 3️⃣ Déploiement
|
cp shared.env.example shared.env
|
||||||
|
|
||||||
|
# Éditer les valeurs sensibles
|
||||||
|
nano shared.env
|
||||||
|
```
|
||||||
|
|
||||||
|
Changez au minimum :
|
||||||
|
- `RCON_PASSWORD` → Nouveau mot de passe RCON
|
||||||
|
- `SESSION_SECRET` → Générez : `openssl rand -base64 32`
|
||||||
|
|
||||||
|
### Étape 3 : Déployer
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ..
|
|
||||||
./deploy.sh
|
./deploy.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4️⃣ Accès
|
### Étape 4 : Accès
|
||||||
|
|
||||||
**Serveur Minecraft :**
|
- **Minecraft** : `votre-ip:25565`
|
||||||
- Adresse : `votre-ip:25565`
|
- **Web Admin** : `http://votre-ip:4001`
|
||||||
|
|
||||||
**Interface Web :**
|
## Commandes Essentielles
|
||||||
- URL : `http://votre-ip:4001`
|
|
||||||
- Créez votre compte admin au premier accès
|
|
||||||
|
|
||||||
## ⚡ Commandes Rapides
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Démarrer
|
# Démarrer
|
||||||
@@ -47,42 +51,16 @@ cd ..
|
|||||||
# Arrêter
|
# Arrêter
|
||||||
./stop.sh
|
./stop.sh
|
||||||
|
|
||||||
# Logs du serveur MC
|
# Vérifier
|
||||||
cd NationsGlory_ServeurBuild_Red && docker-compose logs -f
|
./check-config.sh
|
||||||
|
|
||||||
# Logs de l'application web
|
# Logs
|
||||||
cd WebNationsGlory_ServeurBuild_Red && docker-compose logs -f
|
docker logs -f mc-nationsglory # Minecraft
|
||||||
|
docker logs -f webnationsglory-admin # Web
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🔧 Configuration Minimale Requise
|
## 🔗 Liens Utiles
|
||||||
|
|
||||||
- **Docker** : version 20.10+
|
- Configuration avancée : [SHARED_ENV.md](SHARED_ENV.md)
|
||||||
- **Docker Compose** : version 2.0+
|
- Dépannage : [README.md](README.md)
|
||||||
- **RAM** : 4 GB minimum (2 GB pour Minecraft + 1 GB pour l'app web)
|
- Git automatique : [GIT_SYNC.md](GIT_SYNC.md)
|
||||||
- **Ports** : 25565, 25575, 4001
|
|
||||||
|
|
||||||
## ✅ Vérification
|
|
||||||
|
|
||||||
1. Testez l'API web : `curl http://localhost:4001/api/health`
|
|
||||||
2. Connectez-vous au serveur Minecraft avec un client 1.6.4
|
|
||||||
3. Accédez à l'interface web et créez un compte admin
|
|
||||||
|
|
||||||
## 🐛 Problèmes Courants
|
|
||||||
|
|
||||||
**Le serveur ne démarre pas**
|
|
||||||
```bash
|
|
||||||
cd NationsGlory_ServeurBuild_Red
|
|
||||||
docker-compose logs
|
|
||||||
```
|
|
||||||
|
|
||||||
**L'application web ne se connecte pas au serveur**
|
|
||||||
- Vérifiez que `RCON_PASSWORD` est identique dans les deux `.env`
|
|
||||||
- Attendez que le serveur MC soit complètement démarré (30-60 secondes)
|
|
||||||
|
|
||||||
**Erreur de connexion API depuis l'extérieur**
|
|
||||||
- Ouvrez le port 4001 dans votre pare-feu
|
|
||||||
- Vérifiez que Docker utilise `network_mode: host`
|
|
||||||
|
|
||||||
## 📖 Documentation Complète
|
|
||||||
|
|
||||||
Consultez [README.md](README.md) pour plus de détails.
|
|
||||||
|
|||||||
394
README.md
394
README.md
@@ -1,369 +1,153 @@
|
|||||||
# 🎮 NationsGlory - Déploiement Unifié
|
# 🎮 NationsGlory - Infrastructure Unifié
|
||||||
|
|
||||||
Ce dossier contient le serveur Minecraft NationsGlory modé et son interface web d'administration.
|
Serveur Minecraft 1.6.4 modé + Interface Web Admin en déploiement centralisé.
|
||||||
|
|
||||||
## 📁 Structure
|
## 📁 Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
Serveur NationsGlory/
|
Serveur NationsGlory/
|
||||||
├── NationsGlory_ServeurBuild_Red/ # Serveur Minecraft 1.6.4 (repo Git)
|
├── NationsGlory_ServeurBuild_Red/ # Serveur Minecraft (repo Git)
|
||||||
├── WebNationsGlory_ServeurBuild_Red/ # Application web admin (repo Git)
|
├── WebNationsGlory_ServeurBuild_Red/ # App Web Admin (repo Git)
|
||||||
├── deploy.sh # Script de déploiement
|
├── deploy.sh # Démarrer les services
|
||||||
├── stop.sh # Script d'arrêt
|
├── stop.sh # Arrêter les services
|
||||||
├── check-config.sh # Vérification et sync Git
|
├── check-config.sh # Vérifier + sync Git
|
||||||
└── repos.conf # Configuration des repos Git
|
├── shared.env # Config centralisée
|
||||||
|
└── repos.conf # URLs Git
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🚀 Déploiement Rapide
|
## 🚀 Démarrage Rapide
|
||||||
|
|
||||||
### Prérequis
|
### Prérequis
|
||||||
|
- Git, Docker, Docker Compose
|
||||||
|
- Ports: 25565, 25575, 4001
|
||||||
|
|
||||||
- Git installé
|
### Installation (5 min)
|
||||||
- Docker et Docker Compose installés
|
|
||||||
- Ports disponibles: 25565 (Minecraft), 25575 (RCON), 4001 (Web Admin)
|
|
||||||
|
|
||||||
### Installation en 4 étapes
|
|
||||||
|
|
||||||
#### 0. Configuration Git (première fois uniquement)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Copier et configurer les URLs des repositories
|
|
||||||
cp repos.conf.example repos.conf
|
|
||||||
nano repos.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
Configurez les URLs de vos repositories Git :
|
|
||||||
- `MC_SERVER_REPO` : URL du repository du serveur Minecraft
|
|
||||||
- `WEB_ADMIN_REPO` : URL du repository de l'application web
|
|
||||||
|
|
||||||
**Exemples d'URLs :**
|
|
||||||
```bash
|
|
||||||
# Git local (SSH)
|
|
||||||
MC_SERVER_REPO="git@192.168.1.195:/srv/git/NationsGlory_ServeurBuild_Red.git"
|
|
||||||
|
|
||||||
# GitHub
|
|
||||||
MC_SERVER_REPO="git@github.com:username/NationsGlory_ServeurBuild_Red.git"
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 1. Synchronisation et vérification
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# 1. Synchroniser les repositories
|
||||||
./check-config.sh
|
./check-config.sh
|
||||||
```
|
|
||||||
|
|
||||||
Ce script va automatiquement :
|
# 2. Configurer les secrets
|
||||||
- ✅ Cloner les repositories s'ils n'existent pas
|
cp shared.env.example shared.env
|
||||||
- ✅ Mettre à jour les repositories existants
|
nano shared.env # Modifiez RCON_PASSWORD et SESSION_SECRET
|
||||||
- ✅ Vérifier Docker, les ports, et la configuration
|
|
||||||
- ✅ Détecter les problèmes de configuration
|
|
||||||
|
|
||||||
#### 2. Configuration initiale
|
# 3. Déployer
|
||||||
|
|
||||||
```bash
|
|
||||||
cd WebNationsGlory_ServeurBuild_Red
|
|
||||||
cp .env.example .env
|
|
||||||
nano .env
|
|
||||||
```
|
|
||||||
|
|
||||||
Modifiez au minimum :
|
|
||||||
- `SESSION_SECRET` : Générez avec `openssl rand -base64 32`
|
|
||||||
- `RCON_PASSWORD` : Mot de passe pour RCON (doit correspondre au serveur MC)
|
|
||||||
|
|
||||||
#### 3. Déploiement
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd .. # Retour au dossier parent
|
|
||||||
./deploy.sh
|
./deploy.sh
|
||||||
|
|
||||||
|
# 4. Accès
|
||||||
|
# Minecraft: votre-ip:25565
|
||||||
|
# Web Admin: http://votre-ip:4001
|
||||||
```
|
```
|
||||||
|
|
||||||
Le script va automatiquement :
|
## 🛠️ Commandes Courantes
|
||||||
- ✅ Vérifier les dépendances (Docker, Docker Compose)
|
|
||||||
- ✅ Configurer les chemins relatifs entre les projets
|
|
||||||
- ✅ Démarrer le serveur Minecraft
|
|
||||||
- ✅ Démarrer l'application web admin
|
|
||||||
- ✅ Afficher les URLs d'accès
|
|
||||||
|
|
||||||
#### 4. Accès
|
|
||||||
|
|
||||||
**Serveur Minecraft:**
|
|
||||||
- Adresse: `votre-ip:25565`
|
|
||||||
- Version: 1.6.4 (Forge modé)
|
|
||||||
|
|
||||||
**Interface Web Admin:**
|
|
||||||
- Local: `http://localhost:4001`
|
|
||||||
- Réseau: `http://votre-ip:4001`
|
|
||||||
- Premier accès: Créez le compte admin
|
|
||||||
|
|
||||||
## 🛠️ Gestion
|
|
||||||
|
|
||||||
### Arrêter les services
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./stop.sh
|
# Déployer
|
||||||
```
|
|
||||||
|
|
||||||
### Voir les logs
|
|
||||||
|
|
||||||
**Serveur Minecraft:**
|
|
||||||
```bash
|
|
||||||
cd NationsGlory_ServeurBuild_Red
|
|
||||||
docker-compose logs -f
|
|
||||||
```
|
|
||||||
|
|
||||||
**Application web:**
|
|
||||||
```bash
|
|
||||||
cd WebNationsGlory_ServeurBuild_Red
|
|
||||||
docker-compose logs -f
|
|
||||||
```
|
|
||||||
|
|
||||||
### Redémarrer
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./stop.sh
|
|
||||||
./deploy.sh
|
./deploy.sh
|
||||||
|
|
||||||
|
# Arrêter
|
||||||
|
./stop.sh
|
||||||
|
|
||||||
|
# Vérifier config + sync Git
|
||||||
|
./check-config.sh
|
||||||
|
|
||||||
|
# Logs Minecraft
|
||||||
|
docker logs -f mc-nationsglory
|
||||||
|
|
||||||
|
# Logs Web Admin
|
||||||
|
docker logs -f webnationsglory-admin
|
||||||
|
|
||||||
|
# Redémarrer tout
|
||||||
|
./stop.sh && ./deploy.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🔧 Configuration Avancée
|
## 📋 Configuration
|
||||||
|
|
||||||
### Variables d'environnement (WebNationsGlory_ServeurBuild_Red/.env)
|
## 📋 Configuration
|
||||||
|
|
||||||
|
### shared.env (Configuration centralisée)
|
||||||
|
|
||||||
|
Variables appliquées aux deux services automatiquement :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Environnement
|
RCON_PASSWORD=minecraft # Mot de passe RCON
|
||||||
NODE_ENV=production
|
SESSION_SECRET=votre-secret # Clé session web
|
||||||
PORT=4001
|
SERVER_PORT=25565 # Port Minecraft
|
||||||
|
RCON_PORT=25575 # Port RCON
|
||||||
# Chemin relatif vers le serveur MC
|
PORT=4001 # Port Web Admin
|
||||||
MC_SERVER_PATH=../NationsGlory_ServeurBuild_Red
|
MEMORY=2G # RAM Minecraft
|
||||||
|
ONLINE_MODE=false # Mode online
|
||||||
# RCON (doit correspondre au serveur MC)
|
NODE_ENV=production # Environnement
|
||||||
RCON_HOST=localhost
|
|
||||||
RCON_PORT=25575
|
|
||||||
RCON_PASSWORD=minecraft
|
|
||||||
|
|
||||||
# Sécurité (IMPORTANT!)
|
|
||||||
SESSION_SECRET=votre-secret-genere
|
|
||||||
|
|
||||||
# Optionnel: Domaine public
|
|
||||||
# PUBLIC_HOST=votre-domaine.com
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Personnalisation du serveur Minecraft
|
Voir [SHARED_ENV.md](SHARED_ENV.md) pour documentation complète.
|
||||||
|
|
||||||
Éditez `NationsGlory_ServeurBuild_Red/server.properties` selon vos besoins.
|
|
||||||
|
|
||||||
Redémarrez ensuite :
|
|
||||||
```bash
|
|
||||||
cd NationsGlory_ServeurBuild_Red
|
|
||||||
docker-compose restart
|
|
||||||
```
|
|
||||||
|
|
||||||
## 📡 Accès à Distance
|
## 📡 Accès à Distance
|
||||||
|
|
||||||
L'application est conçue pour fonctionner nativement avec n'importe quelle adresse :
|
L'application fonctionne nativement avec :
|
||||||
|
|
||||||
- **Localhost**: `http://localhost:4001`
|
- Localhost : `http://localhost:4001`
|
||||||
- **IP locale**: `http://192.168.1.X:4001`
|
- IP locale : `http://192.168.1.X:4001`
|
||||||
- **IP publique**: `http://votre-ip-publique:4001`
|
- IP publique : `http://votre-ip-publique:4001`
|
||||||
- **Nom de domaine**: `http://votre-domaine.com:4001`
|
- Domaine : `http://votre-domaine.com:4001`
|
||||||
|
|
||||||
Le frontend détecte automatiquement l'hôte et configure les appels API en conséquence.
|
Le frontend détecte automatiquement l'hôte et configure l'API.
|
||||||
|
|
||||||
### Configuration du pare-feu
|
|
||||||
|
|
||||||
Si vous déployez sur un serveur distant, ouvrez les ports :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# UFW (Ubuntu/Debian)
|
|
||||||
sudo ufw allow 25565/tcp # Minecraft
|
|
||||||
sudo ufw allow 25575/tcp # RCON
|
|
||||||
sudo ufw allow 4001/tcp # Web Admin
|
|
||||||
|
|
||||||
# Firewalld (CentOS/RHEL)
|
|
||||||
sudo firewall-cmd --permanent --add-port=25565/tcp
|
|
||||||
sudo firewall-cmd --permanent --add-port=25575/tcp
|
|
||||||
sudo firewall-cmd --permanent --add-port=4001/tcp
|
|
||||||
sudo firewall-cmd --reload
|
|
||||||
```
|
|
||||||
|
|
||||||
## 🔐 Sécurité
|
## 🔐 Sécurité
|
||||||
|
|
||||||
### Recommandations
|
### À faire pour la production
|
||||||
|
|
||||||
1. **Changez le SESSION_SECRET** : Utilisez une valeur aléatoire forte
|
1. **Changez RCON_PASSWORD** dans shared.env
|
||||||
|
2. **Générez SESSION_SECRET** :
|
||||||
```bash
|
```bash
|
||||||
openssl rand -base64 32
|
openssl rand -base64 32
|
||||||
```
|
```
|
||||||
|
3. **Ouvrez les ports** dans le pare-feu :
|
||||||
2. **Changez le RCON_PASSWORD** : Ne laissez pas "minecraft" par défaut
|
|
||||||
|
|
||||||
3. **Utilisez HTTPS** : Pour la production, configurez un reverse proxy (nginx, Caddy) avec SSL
|
|
||||||
|
|
||||||
4. **Restreignez l'accès** : Utilisez un pare-feu ou VPN pour l'interface admin
|
|
||||||
|
|
||||||
### Exemple de configuration nginx avec SSL
|
|
||||||
|
|
||||||
```nginx
|
|
||||||
server {
|
|
||||||
listen 443 ssl http2;
|
|
||||||
server_name votre-domaine.com;
|
|
||||||
|
|
||||||
ssl_certificate /path/to/cert.pem;
|
|
||||||
ssl_certificate_key /path/to/key.pem;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass http://localhost:4001;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## 📦 Portabilité
|
|
||||||
|
|
||||||
Cette configuration est entièrement portable :
|
|
||||||
|
|
||||||
✅ **Pas de chemins absolus** : Tout est relatif au dossier parent
|
|
||||||
✅ **Configuration par variables d'environnement** : Facile à adapter
|
|
||||||
✅ **Détection automatique de l'hôte** : Fonctionne sur n'importe quelle machine
|
|
||||||
✅ **Scripts de déploiement** : Installation simplifiée
|
|
||||||
✅ **Synchronisation Git automatique** : Clonage et mises à jour gérés par check-config.sh
|
|
||||||
|
|
||||||
### Déployer sur une nouvelle machine
|
|
||||||
|
|
||||||
1. Clonez le repository parent :
|
|
||||||
```bash
|
```bash
|
||||||
git clone <url-du-repo-parent> NationsGlory
|
sudo ufw allow 25565/tcp # Minecraft
|
||||||
cd NationsGlory
|
sudo ufw allow 25575/tcp # RCON
|
||||||
|
sudo ufw allow 4001/tcp # Web
|
||||||
```
|
```
|
||||||
|
4. **(Recommandé) HTTPS** : Configurez nginx/Caddy avec SSL
|
||||||
|
|
||||||
2. Configurez les repositories :
|
## 🔄 Mises à Jour
|
||||||
```bash
|
|
||||||
cp repos.conf.example repos.conf
|
|
||||||
nano repos.conf # Configurez les URLs Git
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Synchronisez et déployez :
|
|
||||||
```bash
|
|
||||||
./check-config.sh # Clone les repos si nécessaire
|
|
||||||
./deploy.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
C'est tout ! 🎉
|
|
||||||
|
|
||||||
## 🔄 Mises à jour
|
|
||||||
|
|
||||||
### Mettre à jour les projets
|
|
||||||
|
|
||||||
Le script `check-config.sh` gère automatiquement les mises à jour :
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./check-config.sh
|
# Vérifier et appliquer les mises à jour
|
||||||
```
|
|
||||||
|
|
||||||
Le script va :
|
|
||||||
- ✅ Vérifier si des mises à jour sont disponibles sur les repositories
|
|
||||||
- ✅ Vous avertir si vous avez des modifications locales non commitées
|
|
||||||
- ✅ Mettre à jour automatiquement si aucun conflit n'est détecté
|
|
||||||
|
|
||||||
### Workflow de mise à jour complet
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 1. Vérifier et mettre à jour les repositories
|
|
||||||
./check-config.sh
|
./check-config.sh
|
||||||
|
|
||||||
# 2. Arrêter les services
|
# Redéployer
|
||||||
./stop.sh
|
./stop.sh
|
||||||
|
|
||||||
# 3. Redémarrer avec les nouvelles versions
|
|
||||||
./deploy.sh
|
./deploy.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### Forcer une mise à jour manuelle
|
|
||||||
|
|
||||||
Si vous avez des modifications locales et voulez les abandonner :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd NationsGlory_ServeurBuild_Red
|
|
||||||
git reset --hard origin/main
|
|
||||||
git pull
|
|
||||||
|
|
||||||
cd ../WebNationsGlory_ServeurBuild_Red
|
|
||||||
git reset --hard origin/main
|
|
||||||
git pull
|
|
||||||
```
|
|
||||||
|
|
||||||
## 🐛 Dépannage
|
## 🐛 Dépannage
|
||||||
|
|
||||||
### Le serveur Minecraft ne démarre pas
|
### Problème : "Cannot connect to API"
|
||||||
|
- Vérifiez le port 4001 ouvert
|
||||||
|
- Vérifiez RCON_PASSWORD identique dans shared.env
|
||||||
|
- Testez : `curl http://localhost:4001/api/health`
|
||||||
|
|
||||||
|
### Problème : "Minecraft ne démarre pas"
|
||||||
```bash
|
```bash
|
||||||
cd NationsGlory_ServeurBuild_Red
|
docker logs mc-nationsglory
|
||||||
docker-compose logs
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Vérifiez que le fichier `mcpc.jar` est présent.
|
### Problème : Git ne synchronise pas
|
||||||
|
|
||||||
### L'application web ne se connecte pas au serveur MC
|
|
||||||
|
|
||||||
1. Vérifiez que `RCON_PASSWORD` est identique dans les deux configurations
|
|
||||||
2. Vérifiez que le serveur MC a démarré complètement
|
|
||||||
3. Testez RCON manuellement :
|
|
||||||
```bash
|
|
||||||
docker exec -it mc-nationsglory rcon-cli
|
|
||||||
```
|
|
||||||
|
|
||||||
### Erreur "SERVER_DIR not found"
|
|
||||||
|
|
||||||
Vérifiez que `MC_SERVER_PATH` dans `.env` pointe correctement vers le serveur MC.
|
|
||||||
|
|
||||||
### L'API ne répond pas depuis une machine distante
|
|
||||||
|
|
||||||
1. Vérifiez que le port 4001 est ouvert
|
|
||||||
2. Vérifiez que Docker utilise `network_mode: host` dans le docker-compose.yml
|
|
||||||
3. Testez l'accès : `curl http://votre-ip:4001/api/health`
|
|
||||||
|
|
||||||
## 📚 Documentation
|
|
||||||
|
|
||||||
- [QUICKSTART.md](WebNationsGlory_ServeurBuild_Red/QUICKSTART.md) - Guide rapide
|
|
||||||
- [DEPLOYMENT.md](WebNationsGlory_ServeurBuild_Red/DEPLOYMENT.md) - Guide de déploiement détaillé
|
|
||||||
- [CONFIGURATION.md](WebNationsGlory_ServeurBuild_Red/CONFIGURATION.md) - Configuration avancée
|
|
||||||
|
|
||||||
## 🔄 Mises à jour
|
|
||||||
|
|
||||||
Pour mettre à jour le projet :
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./stop.sh
|
./check-config.sh
|
||||||
git pull # Si vous utilisez git
|
|
||||||
./deploy.sh
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 💾 Sauvegardes
|
## 📚 Documentation Complète
|
||||||
|
|
||||||
Les sauvegardes sont gérées via l'interface web admin.
|
- [SHARED_ENV.md](SHARED_ENV.md) - Configuration centralisée
|
||||||
|
- [GIT_SYNC.md](GIT_SYNC.md) - Synchronisation automatique Git
|
||||||
|
- [CHEATSHEET.txt](CHEATSHEET.txt) - Commandes rapides
|
||||||
|
|
||||||
Pour une sauvegarde manuelle :
|
## ✅ Caractéristiques
|
||||||
```bash
|
|
||||||
cd NationsGlory_ServeurBuild_Red
|
|
||||||
tar -czf backup-$(date +%Y%m%d-%H%M%S).tar.gz \
|
|
||||||
--exclude='*.log' \
|
|
||||||
--exclude='*.log.lck' \
|
|
||||||
world/ config/ mods/ plugins/
|
|
||||||
```
|
|
||||||
|
|
||||||
## 🤝 Support
|
- ✅ Chemins 100% relatifs (portable)
|
||||||
|
- ✅ Config centralisée (shared.env)
|
||||||
Pour toute question ou problème :
|
- ✅ Détection auto IP/domaine
|
||||||
1. Consultez les logs Docker
|
- ✅ Sync Git automatique
|
||||||
2. Vérifiez les fichiers de configuration
|
- ✅ Déploiement en une commande
|
||||||
3. Assurez-vous que tous les ports sont ouverts
|
|
||||||
|
|
||||||
## 📄 Licence
|
|
||||||
|
|
||||||
Projet NationsGlory - Administration serveur Minecraft
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Note**: Ce README est généré pour faciliter le déploiement sur n'importe quel serveur. Les chemins sont relatifs et s'adaptent automatiquement à l'environnement.
|
|
||||||
|
|||||||
@@ -1,153 +1,22 @@
|
|||||||
# ✅ Configuration Terminée !
|
# ✅ Prêt à Déployer !
|
||||||
|
|
||||||
Votre configuration a été optimisée pour un déploiement portable et simplifié.
|
Configuration terminée. Consultez les docs :
|
||||||
|
|
||||||
## 📝 Ce qui a été fait
|
- **[README.md](README.md)** - Documentation complète
|
||||||
|
- **[QUICKSTART.md](QUICKSTART.md)** - Démarrage en 5 min
|
||||||
|
- **[SHARED_ENV.md](SHARED_ENV.md)** - Configuration centralisée
|
||||||
|
|
||||||
### ✅ Fichiers créés
|
## 🚀 Pour démarrer
|
||||||
- Scripts de déploiement (`deploy.sh`, `stop.sh`, `check-config.sh`)
|
|
||||||
- Fichiers de configuration `.env.example` pour les deux projets
|
|
||||||
- Documentation complète (README.md, QUICKSTART.md, MODIFICATIONS.md)
|
|
||||||
- Configuration nginx exemple pour production
|
|
||||||
- Fichiers `.env` initiaux avec SESSION_SECRET sécurisé
|
|
||||||
|
|
||||||
### ✅ Fichiers modifiés
|
|
||||||
- `WebNationsGlory_ServeurBuild_Red/docker-compose.yml` : Chemins relatifs et variables d'environnement
|
|
||||||
- `WebNationsGlory_ServeurBuild_Red/backend/src/server.js` : CORS dynamique
|
|
||||||
- `WebNationsGlory_ServeurBuild_Red/frontend/public/js/app.js` : Détection automatique de l'API
|
|
||||||
- `NationsGlory_ServeurBuild_Red/docker-compose.yml` : Support des variables d'environnement
|
|
||||||
- README des deux projets mis à jour
|
|
||||||
|
|
||||||
## 🚀 Prochaines étapes
|
|
||||||
|
|
||||||
### 1. Vérifier la configuration
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./check-config.sh
|
# Copier et configurer shared.env
|
||||||
```
|
cp shared.env.example shared.env
|
||||||
|
nano shared.env # Modifiez RCON_PASSWORD et SESSION_SECRET
|
||||||
|
|
||||||
### 2. (Optionnel) Modifier les mots de passe
|
# Déployer
|
||||||
|
|
||||||
Si vous souhaitez changer le mot de passe RCON par défaut :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Éditer les deux fichiers .env
|
|
||||||
nano NationsGlory_ServeurBuild_Red/.env
|
|
||||||
nano WebNationsGlory_ServeurBuild_Red/.env
|
|
||||||
|
|
||||||
# Assurez-vous que RCON_PASSWORD est identique dans les deux fichiers
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Déployer
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./deploy.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
Le script va automatiquement :
|
|
||||||
- Démarrer le serveur Minecraft
|
|
||||||
- Démarrer l'application web admin
|
|
||||||
- Afficher les URLs d'accès
|
|
||||||
|
|
||||||
### 4. Accéder aux services
|
|
||||||
|
|
||||||
**Serveur Minecraft :**
|
|
||||||
- Adresse : `votre-ip:25565`
|
|
||||||
- Version : 1.6.4 (Forge modé)
|
|
||||||
|
|
||||||
**Interface Web Admin :**
|
|
||||||
- Localhost : `http://localhost:4001`
|
|
||||||
- Réseau : `http://votre-ip:4001`
|
|
||||||
|
|
||||||
Au premier accès, créez votre compte admin (votre pseudo Minecraft doit être OP sur le serveur).
|
|
||||||
|
|
||||||
## 📦 Portabilité
|
|
||||||
|
|
||||||
Votre configuration est maintenant **100% portable** :
|
|
||||||
|
|
||||||
✅ **Aucun chemin absolu** - Tout est relatif
|
|
||||||
✅ **Configuration centralisée** - Fichiers `.env`
|
|
||||||
✅ **Détection automatique de l'hôte** - Fonctionne avec localhost, IP, domaine
|
|
||||||
✅ **Scripts de déploiement** - Installation en une commande
|
|
||||||
|
|
||||||
### Pour déployer sur une autre machine :
|
|
||||||
|
|
||||||
1. Copiez tout le dossier `Serveur NationsGlory`
|
|
||||||
2. Copiez les fichiers `.env` ou reconfigurez-les
|
|
||||||
3. Exécutez `./deploy.sh`
|
|
||||||
|
|
||||||
C'est tout ! 🎉
|
|
||||||
|
|
||||||
## 🔒 Sécurité
|
|
||||||
|
|
||||||
### ✅ Déjà configuré
|
|
||||||
- SESSION_SECRET unique généré automatiquement
|
|
||||||
- Montage read-only du serveur MC depuis l'app web
|
|
||||||
- CORS configuré correctement
|
|
||||||
|
|
||||||
### ⚠️ À faire pour la production
|
|
||||||
1. **Changez RCON_PASSWORD** dans les deux fichiers `.env`
|
|
||||||
2. **Ouvrez les ports** dans votre pare-feu :
|
|
||||||
```bash
|
|
||||||
sudo ufw allow 25565/tcp # Minecraft
|
|
||||||
sudo ufw allow 25575/tcp # RCON
|
|
||||||
sudo ufw allow 4001/tcp # Web Admin
|
|
||||||
```
|
|
||||||
3. **(Recommandé) Configurez HTTPS** avec nginx (voir `WebNationsGlory_ServeurBuild_Red/nginx.conf.example`)
|
|
||||||
|
|
||||||
## 📚 Documentation
|
|
||||||
|
|
||||||
- **[README.md](README.md)** : Documentation principale
|
|
||||||
- **[QUICKSTART.md](QUICKSTART.md)** : Guide de démarrage rapide
|
|
||||||
- **[MODIFICATIONS.md](MODIFICATIONS.md)** : Détails techniques des modifications
|
|
||||||
- **[WebNationsGlory_ServeurBuild_Red/nginx.conf.example](WebNationsGlory_ServeurBuild_Red/nginx.conf.example)** : Configuration nginx pour SSL
|
|
||||||
|
|
||||||
## 🛠️ Commandes utiles
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Vérifier la configuration
|
|
||||||
./check-config.sh
|
|
||||||
|
|
||||||
# Démarrer tous les services
|
|
||||||
./deploy.sh
|
./deploy.sh
|
||||||
|
|
||||||
# Arrêter tous les services
|
# Accès
|
||||||
./stop.sh
|
# Minecraft: votre-ip:25565
|
||||||
|
# Web Admin: http://votre-ip:4001
|
||||||
# Voir les logs du serveur Minecraft
|
|
||||||
cd NationsGlory_ServeurBuild_Red && docker compose logs -f
|
|
||||||
|
|
||||||
# Voir les logs de l'application web
|
|
||||||
cd WebNationsGlory_ServeurBuild_Red && docker compose logs -f
|
|
||||||
|
|
||||||
# Redémarrer tout
|
|
||||||
./stop.sh && ./deploy.sh
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🎯 Résumé des avantages
|
|
||||||
|
|
||||||
### Avant
|
|
||||||
❌ Chemins absolus `/home/innotex/...`
|
|
||||||
❌ IP hardcodée dans le code
|
|
||||||
❌ Configuration dispersée
|
|
||||||
❌ Déploiement complexe
|
|
||||||
❌ Non portable entre machines
|
|
||||||
|
|
||||||
### Maintenant
|
|
||||||
✅ Chemins relatifs
|
|
||||||
✅ Détection automatique de l'hôte
|
|
||||||
✅ Configuration centralisée (`.env`)
|
|
||||||
✅ Déploiement en une commande
|
|
||||||
✅ Portable sur n'importe quelle machine
|
|
||||||
|
|
||||||
## 🐛 Support
|
|
||||||
|
|
||||||
Si vous rencontrez un problème :
|
|
||||||
|
|
||||||
1. Vérifiez les logs Docker
|
|
||||||
2. Exécutez `./check-config.sh`
|
|
||||||
3. Consultez [MODIFICATIONS.md](MODIFICATIONS.md) pour les détails techniques
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Bon déploiement ! 🚀**
|
|
||||||
|
|||||||
Reference in New Issue
Block a user