🚀 Release v1.1.0 - Application en Production avec Monitoring
✨ Nouvelles fonctionnalités: - 🌐 Application déployée et accessible en ligne (http://141.253.118.141:3000) - 📊 Dashboard Grafana complet avec métriques en temps réel - 🚀 Configuration de production avec docker-compose.prod.yml - 🏗️ Infrastructure robuste avec monitoring Prometheus + Grafana - 📈 Métriques personnalisées (CPU, mémoire, requêtes, réservations) 🔧 Améliorations techniques: - Backend FastAPI avec métriques Prometheus intégrées - Configuration Docker optimisée pour la production - Health checks pour tous les services - Variables d'environnement sécurisées - Configuration Ansible pour déploiement automatisé 📚 Documentation: - README complet mis à jour avec liens de production - CHANGELOG détaillé pour la version 1.1.0 - Notes de release complètes - Guide de déploiement en production 🎯 Statut: Stable, déployé et accessible en ligne
This commit is contained in:
+14
-6
@@ -8,25 +8,33 @@ et ce projet adhère au [Semantic Versioning](https://semver.org/lang/fr/).
|
||||
## [1.1.0] - 2025-10-16
|
||||
|
||||
### Ajouté
|
||||
- **Monitoring et Observabilité** : Intégration complète Prometheus + Grafana
|
||||
- **🌐 Application en Production** : Déploiement complet sur serveur Oracle Cloud
|
||||
- Application accessible en ligne : http://141.253.118.141:3000
|
||||
- Backend API : http://141.253.118.141:8001
|
||||
- Monitoring Grafana : http://141.253.118.141:3001
|
||||
- Prometheus : http://141.253.118.141:9090
|
||||
|
||||
- **📊 Monitoring et Observabilité** : Intégration complète Prometheus + Grafana
|
||||
- Dashboard Grafana "Dockezr - Monitoring Complet" avec métriques en temps réel
|
||||
- Métriques automatiques pour le backend FastAPI
|
||||
- Tableaux de bord Grafana pour la surveillance
|
||||
- Endpoint `/metrics` pour la collecte de métriques
|
||||
- Surveillance des performances (CPU, mémoire, requêtes)
|
||||
- Métriques personnalisées (réservations, accès aux salles)
|
||||
- Endpoint `/metrics` pour la collecte de métriques
|
||||
|
||||
- **Déploiement en Production** : Configuration pour serveur Linux
|
||||
- **🚀 Déploiement en Production** : Configuration pour serveur Linux
|
||||
- Configuration de production avec docker-compose.prod.yml
|
||||
- Variables d'environnement pour la production
|
||||
- Variables d'environnement sécurisées pour la production
|
||||
- Guide de déploiement manuel sur serveur Linux
|
||||
- Support Docker Compose pour déploiement simplifié
|
||||
- Configuration Ansible pour déploiement automatisé
|
||||
|
||||
- **Infrastructure de Production** :
|
||||
- **🏗️ Infrastructure de Production** :
|
||||
- Images Docker optimisées pour la production
|
||||
- Configuration de santé (healthchecks) pour tous les services
|
||||
- Réseaux Docker dédiés pour la production
|
||||
- Volumes persistants pour les données
|
||||
- Configuration sécurisée des mots de passe
|
||||
- Node Exporter pour métriques système
|
||||
|
||||
### Modifié
|
||||
- **Backend FastAPI** : Ajout des métriques Prometheus
|
||||
|
||||
@@ -1,28 +1,39 @@
|
||||
# Expernet - Système de Réservation de Salles
|
||||
# 🏢 Dockezr - Système de Réservation de Salles
|
||||
|
||||
Système complet de réservation de salles pour le centre de formation **Expernet**, développé avec **FastAPI** (Backend), **Next.js** (Frontend) et **PostgreSQL** (Base de données), orchestré avec Docker Compose.
|
||||
|
||||
[](https://github.com/SarTron-NorthBlue/dockezr/releases/tag/v1.0.0)
|
||||
[](https://github.com/SarTron-NorthBlue/dockezr/actions)
|
||||
[](https://github.com/SarTron-NorthBlue/dockezr/releases/tag/v1.1.0)
|
||||
[](https://docs.docker.com/compose/)
|
||||
[](https://prometheus.io/)
|
||||
[](http://141.253.118.141:3000)
|
||||
|
||||
## Stack Technique
|
||||
Système complet de réservation de salles pour le centre de formation **Expernet**, développé avec **FastAPI** (Backend), **Next.js** (Frontend), **PostgreSQL** (Base de données) et **Prometheus + Grafana** (Monitoring), orchestré avec Docker Compose.
|
||||
|
||||
- **Backend**: FastAPI (Python) avec AsyncPG
|
||||
- **Frontend**: Next.js 14 + TypeScript + Tailwind CSS
|
||||
- **Base de données**: PostgreSQL 16
|
||||
- **Containerisation**: Docker & Docker Compose
|
||||
- **Tests**: Pytest avec GitHub Actions CI/CD
|
||||
- **Versioning**: Git tags avec releases GitHub
|
||||
## 🌐 **Application en Production**
|
||||
|
||||
## Fonctionnalités
|
||||
**🚀 Accès direct à l'application :**
|
||||
- **Frontend (Interface utilisateur)** : http://141.253.118.141:3000
|
||||
- **Backend API** : http://141.253.118.141:8001
|
||||
- **Documentation API** : http://141.253.118.141:8001/docs
|
||||
- **Monitoring Grafana** : http://141.253.118.141:3001 (admin/Grafana2025!Secure)
|
||||
- **Prometheus** : http://141.253.118.141:9090
|
||||
|
||||
### Gestion des Salles
|
||||
## 🛠️ **Stack Technique**
|
||||
|
||||
- **Backend** : FastAPI (Python 3.11) avec AsyncPG
|
||||
- **Frontend** : Next.js 14 + TypeScript + Tailwind CSS
|
||||
- **Base de données** : PostgreSQL 16
|
||||
- **Monitoring** : Prometheus + Grafana + Node Exporter
|
||||
- **Containerisation** : Docker & Docker Compose
|
||||
- **Tests** : Pytest avec GitHub Actions CI/CD
|
||||
- **Déploiement** : Production sur serveur Oracle Cloud
|
||||
|
||||
## ✨ **Fonctionnalités**
|
||||
|
||||
### 🏛️ **Gestion des Salles**
|
||||
- 5 salles pré-configurées (Atlas, Horizon, Innovation, Connect, Digital)
|
||||
- Affichage des capacités et équipements
|
||||
- Interface intuitive de sélection
|
||||
|
||||
### Réservations
|
||||
### 📅 **Réservations**
|
||||
- Formulaire de réservation complet
|
||||
- Champ email optionnel
|
||||
- Sélection de date et horaires
|
||||
@@ -32,7 +43,7 @@ Système complet de réservation de salles pour le centre de formation **Experne
|
||||
- Validation des créneaux disponibles
|
||||
- Annulation de réservations
|
||||
|
||||
### Planning Visuel
|
||||
### 📊 **Planning Visuel**
|
||||
- **Grille de planning par jour** (8h-22h)
|
||||
- Vue d'ensemble de toutes les salles
|
||||
- Code couleur : ✅ Disponible / ❌ Réservé
|
||||
@@ -40,27 +51,28 @@ Système complet de réservation de salles pour le centre de formation **Experne
|
||||
- Navigation par date
|
||||
- Liste détaillée des réservations du jour
|
||||
|
||||
### Suivi
|
||||
- Vue d'ensemble de toutes les réservations
|
||||
- Filtrage par salle et par date
|
||||
- Historique complet
|
||||
### 📈 **Monitoring et Observabilité**
|
||||
- **Dashboard Grafana** complet avec métriques en temps réel
|
||||
- **Métriques Prometheus** : CPU, mémoire, requêtes HTTP
|
||||
- **Surveillance des performances** : temps de réponse, taux d'erreur
|
||||
- **Métriques personnalisées** : réservations, accès aux salles
|
||||
- **Alertes automatiques** en cas de problème
|
||||
|
||||
## Démarrage Rapide
|
||||
## 🚀 **Démarrage Rapide**
|
||||
|
||||
### Prérequis
|
||||
### **Prérequis**
|
||||
- Docker et Docker Compose installés
|
||||
- Ports 3000, 8001, 5432, 9090, 3001 disponibles
|
||||
|
||||
- Docker et Docker Compose installés sur votre machine
|
||||
- Ports 3000, 8000 et 5432 disponibles
|
||||
### **Installation et lancement**
|
||||
|
||||
### Installation et lancement
|
||||
|
||||
1. **Cloner le projet** (si applicable)
|
||||
1. **Cloner le projet**
|
||||
```bash
|
||||
git clone <votre-repo>
|
||||
git clone https://github.com/SarTron-NorthBlue/dockezr.git
|
||||
cd dockezr
|
||||
```
|
||||
|
||||
2. **Lancer tous les services avec Docker Compose**
|
||||
2. **Lancer tous les services**
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
@@ -70,29 +82,22 @@ ou utilisez le script Windows :
|
||||
scripts/start.bat
|
||||
```
|
||||
|
||||
Cette commande va :
|
||||
- Créer le réseau Docker `dockezr_network`
|
||||
- Démarrer PostgreSQL sur le port 5432
|
||||
- Créer automatiquement les tables et les 5 salles par défaut
|
||||
- Démarrer le backend FastAPI sur le port 8000
|
||||
- Démarrer le frontend Next.js sur le port 3000
|
||||
|
||||
3. **Accéder à l'application**
|
||||
- **Frontend (Interface de réservation)**: http://localhost:3000
|
||||
- **Backend API**: http://localhost:8000
|
||||
- **Documentation API (Swagger)**: http://localhost:8000/docs
|
||||
- **Documentation API (ReDoc)**: http://localhost:8000/redoc
|
||||
- **Prometheus (Monitoring)**: http://localhost:9090
|
||||
- **Grafana (Tableaux de bord)**: http://localhost:3001 (admin/admin123)
|
||||
- **Frontend** : http://localhost:3000
|
||||
- **Backend API** : http://localhost:8001
|
||||
- **Documentation API** : http://localhost:8001/docs
|
||||
- **Prometheus** : http://localhost:9090
|
||||
- **Grafana** : http://localhost:3001 (admin/Grafana2025!Secure)
|
||||
|
||||
## 📁 Structure du Projet
|
||||
## 📁 **Structure du Projet**
|
||||
|
||||
```
|
||||
dockezr/
|
||||
├── backend/ # API FastAPI
|
||||
│ ├── main.py # Point d'entrée de l'API
|
||||
│ ├── main.py # Point d'entrée avec métriques Prometheus
|
||||
│ ├── requirements.txt # Dépendances Python
|
||||
│ └── Dockerfile # Configuration Docker
|
||||
│ ├── Dockerfile # Configuration Docker
|
||||
│ └── test_*.py # Tests automatisés
|
||||
│
|
||||
├── frontend/ # Application Next.js
|
||||
│ ├── app/ # Pages et composants Next.js 14
|
||||
@@ -110,67 +115,23 @@ dockezr/
|
||||
│ ├── provisioning/ # Datasources et dashboards
|
||||
│ └── dashboards/ # Tableaux de bord
|
||||
│
|
||||
├── ansible/ # Déploiement automatisé
|
||||
│ ├── deploy.yml # Playbook Ansible
|
||||
│ ├── inventory.ini # Inventaire des serveurs
|
||||
│ └── group_vars/ # Variables de configuration
|
||||
│
|
||||
├── scripts/ # Scripts d'administration
|
||||
│ ├── start.bat # Démarrage
|
||||
│ ├── stop.bat # Arrêt
|
||||
│ └── test.bat # Tests
|
||||
│
|
||||
├── docker-compose.yml # Orchestration des services
|
||||
├── .dockerignore # Fichiers ignorés par Docker
|
||||
├── .gitignore # Fichiers ignorés par Git
|
||||
├── docker-compose.prod.yml # Configuration production
|
||||
├── CHANGELOG.md # Historique des versions
|
||||
└── README.md # Ce fichier
|
||||
```
|
||||
|
||||
## 🔧 Commandes Utiles
|
||||
|
||||
### Démarrer les services
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Arrêter les services
|
||||
```bash
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
ou utilisez le script Windows :
|
||||
```bash
|
||||
scripts/stop.bat
|
||||
```
|
||||
|
||||
### Voir les logs
|
||||
```bash
|
||||
# Tous les services
|
||||
docker-compose logs -f
|
||||
|
||||
# Service spécifique
|
||||
docker-compose logs -f backend
|
||||
docker-compose logs -f frontend
|
||||
docker-compose logs -f db
|
||||
docker-compose logs -f prometheus
|
||||
docker-compose logs -f grafana
|
||||
```
|
||||
|
||||
### Reconstruire les images
|
||||
```bash
|
||||
docker-compose up -d --build
|
||||
```
|
||||
|
||||
### Arrêter et supprimer les volumes (⚠️ supprime les données)
|
||||
```bash
|
||||
docker-compose down -v
|
||||
```
|
||||
|
||||
### Accéder à un conteneur
|
||||
```bash
|
||||
# Backend
|
||||
docker exec -it dockezr_backend sh
|
||||
|
||||
# Frontend
|
||||
docker exec -it dockezr_frontend sh
|
||||
|
||||
# Base de données
|
||||
docker exec -it dockezr_db psql -U user -d dockezr
|
||||
```
|
||||
|
||||
## 🏛️ Salles Pré-configurées
|
||||
|
||||
Le système est livré avec 5 salles de formation :
|
||||
## 🏛️ **Salles Pré-configurées**
|
||||
|
||||
| Salle | Capacité | Équipements |
|
||||
|-------|----------|-------------|
|
||||
@@ -180,45 +141,137 @@ Le système est livré avec 5 salles de formation :
|
||||
| **Salle Connect** | 8 personnes | Écran TV, Visioconférence, WiFi |
|
||||
| **Salle Digital** | 20 personnes | 20 postes informatiques, Vidéoprojecteur, WiFi |
|
||||
|
||||
## 🌐 API Endpoints
|
||||
|
||||
### Routes des Salles
|
||||
## 🌐 **API Endpoints**
|
||||
|
||||
### **Routes des Salles**
|
||||
- `GET /rooms` - Liste toutes les salles
|
||||
- `GET /rooms/{room_id}` - Récupère une salle spécifique
|
||||
- `POST /rooms` - Crée une nouvelle salle
|
||||
- `DELETE /rooms/{room_id}` - Supprime une salle
|
||||
|
||||
### Routes des Réservations
|
||||
|
||||
### **Routes des Réservations**
|
||||
- `GET /reservations` - Liste toutes les réservations
|
||||
- `GET /reservations/room/{room_id}` - Réservations d'une salle spécifique
|
||||
- `GET /reservations/date/{date}` - Réservations pour une date donnée
|
||||
- `POST /reservations` - Crée une nouvelle réservation
|
||||
- `DELETE /reservations/{reservation_id}` - Annule une réservation
|
||||
|
||||
### Validation automatique
|
||||
### **Monitoring**
|
||||
- `GET /health` - Vérification de l'état de l'API
|
||||
- `GET /metrics` - Métriques Prometheus
|
||||
|
||||
L'API vérifie automatiquement :
|
||||
- ✅ La disponibilité de la salle
|
||||
- ✅ Les conflits d'horaires
|
||||
- ✅ La cohérence des horaires (début < fin)
|
||||
- ✅ L'existence de la salle
|
||||
### **Documentation interactive**
|
||||
- **Swagger UI** : http://localhost:8001/docs
|
||||
- **ReDoc** : http://localhost:8001/redoc
|
||||
|
||||
### Documentation interactive
|
||||
- **Swagger UI**: http://localhost:8000/docs
|
||||
- **ReDoc**: http://localhost:8000/redoc
|
||||
## 📊 **Monitoring et Observabilité**
|
||||
|
||||
## 🗄️ Base de Données
|
||||
### **Dashboard Grafana**
|
||||
Le système inclut un dashboard Grafana complet avec :
|
||||
|
||||
### Configuration
|
||||
- **Host**: localhost (ou `db` depuis les conteneurs)
|
||||
- **Port**: 5432
|
||||
- **Utilisateur**: user
|
||||
- **Mot de passe**: password
|
||||
- **Base de données**: dockezr
|
||||
- **Status des Services** : Backend, Prometheus, Node Exporter
|
||||
- **Métriques CPU** : Utilisation CPU du processus backend
|
||||
- **Métriques Mémoire** : Utilisation mémoire en temps réel
|
||||
- **Performance HTTP** : Requêtes par seconde, temps de réponse
|
||||
- **Métriques Métier** : Nombre de réservations, accès aux salles
|
||||
|
||||
### Structure des tables
|
||||
### **Métriques Prometheus**
|
||||
- `http_requests_total` : Nombre total de requêtes HTTP
|
||||
- `http_request_duration_seconds` : Durée des requêtes
|
||||
- `reservations_total` : Nombre de réservations créées
|
||||
- `room_access_total` : Nombre d'accès aux salles
|
||||
- `process_cpu_seconds_total` : Utilisation CPU
|
||||
- `process_resident_memory_bytes` : Utilisation mémoire
|
||||
|
||||
### **Accès au Monitoring**
|
||||
- **Grafana** : http://141.253.118.141:3001
|
||||
- **Identifiants** : `admin` / `Grafana2025!Secure`
|
||||
- **Dashboard** : "Dockezr - Monitoring Complet"
|
||||
|
||||
## 🔧 **Commandes Utiles**
|
||||
|
||||
### **Démarrer les services**
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### **Arrêter les services**
|
||||
```bash
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
### **Voir les logs**
|
||||
```bash
|
||||
# Tous les services
|
||||
docker-compose logs -f
|
||||
|
||||
# Service spécifique
|
||||
docker-compose logs -f backend
|
||||
docker-compose logs -f frontend
|
||||
docker-compose logs -f prometheus
|
||||
docker-compose logs -f grafana
|
||||
```
|
||||
|
||||
### **Reconstruire les images**
|
||||
```bash
|
||||
docker-compose up -d --build
|
||||
```
|
||||
|
||||
### **Tests automatisés**
|
||||
```bash
|
||||
scripts/test.bat
|
||||
```
|
||||
|
||||
## 🚀 **Déploiement en Production**
|
||||
|
||||
### **Déploiement Automatisé avec Ansible**
|
||||
|
||||
Le projet inclut une configuration Ansible complète pour le déploiement automatisé :
|
||||
|
||||
```bash
|
||||
# Déploiement automatique
|
||||
cd ansible
|
||||
./deploy-auto.ps1
|
||||
|
||||
# Déploiement manuel
|
||||
./deploy-manuel.ps1
|
||||
```
|
||||
|
||||
### **Configuration de Production**
|
||||
|
||||
Le fichier `docker-compose.prod.yml` est configuré pour la production avec :
|
||||
- Variables d'environnement sécurisées
|
||||
- Health checks pour tous les services
|
||||
- Volumes persistants pour les données
|
||||
- Réseaux Docker dédiés
|
||||
- Configuration monitoring complète
|
||||
|
||||
### **Variables d'environnement de production**
|
||||
|
||||
```bash
|
||||
# Base de données
|
||||
POSTGRES_USER=dockezr_user
|
||||
POSTGRES_PASSWORD=Dockezr2025!Secure
|
||||
POSTGRES_DB=dockezr_prod
|
||||
|
||||
# Frontend
|
||||
NEXT_PUBLIC_API_URL=http://141.253.118.141:8001
|
||||
|
||||
# Grafana
|
||||
GF_SECURITY_ADMIN_USER=admin
|
||||
GF_SECURITY_ADMIN_PASSWORD=Grafana2025!Secure
|
||||
```
|
||||
|
||||
## 🗄️ **Base de Données**
|
||||
|
||||
### **Configuration**
|
||||
- **Host** : localhost (ou `db` depuis les conteneurs)
|
||||
- **Port** : 5432
|
||||
- **Utilisateur** : `dockezr_user`
|
||||
- **Mot de passe** : `Dockezr2025!Secure`
|
||||
- **Base de données** : `dockezr_prod`
|
||||
|
||||
### **Structure des tables**
|
||||
|
||||
**Table `rooms`**
|
||||
- id (SERIAL PRIMARY KEY)
|
||||
@@ -238,12 +291,7 @@ L'API vérifie automatiquement :
|
||||
- purpose (TEXT)
|
||||
- created_at (TIMESTAMP)
|
||||
|
||||
### Connexion à PostgreSQL
|
||||
```bash
|
||||
docker exec -it dockezr_db psql -U user -d dockezr
|
||||
```
|
||||
|
||||
## 🎨 Frontend
|
||||
## 🎨 **Frontend**
|
||||
|
||||
L'interface utilise :
|
||||
- **Next.js 14** avec App Router
|
||||
@@ -251,7 +299,7 @@ L'interface utilise :
|
||||
- **Tailwind CSS** pour le styling moderne et responsive
|
||||
- **Axios** pour les requêtes HTTP vers l'API
|
||||
|
||||
### Fonctionnalités de l'interface
|
||||
### **Fonctionnalités de l'interface**
|
||||
|
||||
**Onglet Planning (par défaut)**
|
||||
- 📊 Grille de planning visuelle (8h-22h)
|
||||
@@ -259,7 +307,6 @@ L'interface utilise :
|
||||
- 📅 Sélecteur de date
|
||||
- 👤 Affichage du nom de l'utilisateur sur les créneaux
|
||||
- 📋 Liste détaillée des réservations du jour sélectionné
|
||||
- 🖱️ Info-bulle au survol des créneaux réservés
|
||||
|
||||
**Onglet Réservation**
|
||||
- Liste visuelle des salles disponibles avec détails
|
||||
@@ -275,52 +322,46 @@ L'interface utilise :
|
||||
- Informations détaillées (salle, date, horaire, objet)
|
||||
- Possibilité d'annuler une réservation
|
||||
|
||||
## 🔄 Développement
|
||||
## 🧪 **Tests et Qualité**
|
||||
|
||||
### Mode développement avec hot-reload
|
||||
### **Tests automatisés**
|
||||
- **Tests API** : Validation des endpoints avec Pytest
|
||||
- **Tests de connectivité** : Simulation d'erreurs pour validation
|
||||
- **CI/CD** : GitHub Actions avec tests automatiques
|
||||
- **Couverture** : Tests de performance et de régression
|
||||
|
||||
Les deux services (backend et frontend) sont configurés en mode développement avec rechargement automatique :
|
||||
|
||||
- **Backend**: Uvicorn avec `--reload`
|
||||
- **Frontend**: Next.js avec `npm run dev`
|
||||
|
||||
Les modifications de code sont automatiquement détectées et appliquées.
|
||||
|
||||
### Variables d'environnement
|
||||
|
||||
#### Backend
|
||||
- `DATABASE_URL`: URL de connexion PostgreSQL
|
||||
|
||||
#### Frontend
|
||||
- `NEXT_PUBLIC_API_URL`: URL de l'API backend
|
||||
|
||||
## 🐛 Dépannage
|
||||
|
||||
### Les conteneurs ne démarrent pas
|
||||
### **Exécution des tests**
|
||||
```bash
|
||||
# Vérifier les logs
|
||||
docker-compose logs
|
||||
# Tests complets
|
||||
scripts/test.bat
|
||||
|
||||
# Reconstruire les images
|
||||
docker-compose up -d --build
|
||||
# Tests de simulation d'erreur
|
||||
scripts/test-connectivity.bat
|
||||
```
|
||||
|
||||
### La base de données n'est pas prête
|
||||
Le backend attend que PostgreSQL soit complètement démarré grâce au healthcheck.
|
||||
## 🔒 **Sécurité**
|
||||
|
||||
### Erreurs de connexion à l'API
|
||||
Vérifiez que :
|
||||
- Le backend est démarré : `docker-compose ps`
|
||||
- L'URL de l'API est correcte dans le frontend
|
||||
- Le réseau Docker fonctionne : `docker network ls`
|
||||
### **Configuration de production**
|
||||
- Mots de passe sécurisés pour tous les services
|
||||
- Configuration CORS appropriée
|
||||
- Health checks pour la surveillance
|
||||
- Volumes persistants pour les données
|
||||
- Réseaux Docker isolés
|
||||
|
||||
## 📝 Personnalisation
|
||||
### **Recommandations de sécurité**
|
||||
- Changez les mots de passe par défaut en production
|
||||
- Configurez HTTPS/SSL avec un reverse proxy
|
||||
- Activez l'authentification utilisateur
|
||||
- Configurez les sauvegardes de la base de données
|
||||
- Limitez l'accès aux ports de monitoring
|
||||
|
||||
### Ajouter de nouvelles salles
|
||||
## 📝 **Personnalisation**
|
||||
|
||||
### **Ajouter de nouvelles salles**
|
||||
|
||||
Via l'API :
|
||||
```bash
|
||||
curl -X POST http://localhost:8000/rooms \
|
||||
curl -X POST http://141.253.118.141:8001/rooms \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"name": "Salle Formation",
|
||||
@@ -330,30 +371,14 @@ curl -X POST http://localhost:8000/rooms \
|
||||
}'
|
||||
```
|
||||
|
||||
Ou directement dans la base de données :
|
||||
```sql
|
||||
INSERT INTO rooms (name, capacity, equipment, description)
|
||||
VALUES ('Ma Salle', 40, 'Équipements', 'Description');
|
||||
```
|
||||
|
||||
### Modifier les ports
|
||||
Éditez le fichier `docker-compose.yml` et changez les mappings de ports :
|
||||
### **Modifier les ports**
|
||||
Éditez le fichier `docker-compose.prod.yml` et changez les mappings de ports :
|
||||
```yaml
|
||||
ports:
|
||||
- "VOTRE_PORT:PORT_INTERNE"
|
||||
```
|
||||
|
||||
### Ajouter des dépendances
|
||||
|
||||
**Backend (Python)**:
|
||||
1. Ajoutez la dépendance dans `backend/requirements.txt`
|
||||
2. Reconstruisez : `docker-compose up -d --build backend`
|
||||
|
||||
**Frontend (Node.js)**:
|
||||
1. Ajoutez la dépendance dans `frontend/package.json`
|
||||
2. Reconstruisez : `docker-compose up -d --build frontend`
|
||||
|
||||
## 🎯 Cas d'Usage
|
||||
## 🎯 **Cas d'Usage**
|
||||
|
||||
Ce système est idéal pour :
|
||||
- ✅ Centres de formation
|
||||
@@ -362,131 +387,41 @@ Ce système est idéal pour :
|
||||
- ✅ Universités et écoles
|
||||
- ✅ Bibliothèques avec salles d'étude
|
||||
|
||||
## Tests et Qualité
|
||||
## 📋 **Versions et Releases**
|
||||
|
||||
### Tests automatisés
|
||||
- **Tests API** : Validation des endpoints avec Pytest
|
||||
- **Tests de connectivité** : Simulation d'erreurs pour validation
|
||||
- **CI/CD** : GitHub Actions avec tests automatiques
|
||||
- **Couverture** : Tests de performance et de régression
|
||||
### **Version actuelle : v1.1.0**
|
||||
- **Date de release** : 16 octobre 2025
|
||||
- **Type** : Release avec monitoring
|
||||
- **Statut** : Stable, déployé en production
|
||||
- **Compatibilité** : Windows, Linux, macOS
|
||||
- **Dépendances** : Docker, Docker Compose
|
||||
|
||||
### Exécution des tests
|
||||
```bash
|
||||
# Tests complets
|
||||
scripts/test.bat
|
||||
### **Changelog**
|
||||
Voir [CHANGELOG.md](CHANGELOG.md) pour l'historique complet des versions.
|
||||
|
||||
# Tests de simulation d'erreur
|
||||
scripts/test-connectivity.bat
|
||||
```
|
||||
### **Releases GitHub**
|
||||
- [v1.1.0](https://github.com/SarTron-NorthBlue/dockezr/releases/tag/v1.1.0) - Version avec monitoring
|
||||
- [v1.0.0](https://github.com/SarTron-NorthBlue/dockezr/releases/tag/v1.0.0) - Version initiale
|
||||
|
||||
## 🚀 Déploiement en Production
|
||||
## 📞 **Support et Documentation**
|
||||
|
||||
### Déploiement sur Serveur Linux
|
||||
### **Documentation**
|
||||
- **Guide d'utilisation** : [GUIDE_UTILISATION.md](GUIDE_UTILISATION.md)
|
||||
- **Guide de déploiement** : [DEPLOYMENT.md](DEPLOYMENT.md)
|
||||
- **Dépannage** : [DEPANNAGE.md](DEPANNAGE.md)
|
||||
- **API** : Documentation interactive sur http://141.253.118.141:8001/docs
|
||||
|
||||
Le projet est configuré pour un déploiement manuel sur serveur Linux avec Docker Compose.
|
||||
### **Monitoring**
|
||||
- **Grafana** : http://141.253.118.141:3001
|
||||
- **Prometheus** : http://141.253.118.141:9090
|
||||
- **Dashboard** : "Dockezr - Monitoring Complet"
|
||||
|
||||
#### 1. **Préparation du serveur**
|
||||
|
||||
```bash
|
||||
# Sur votre serveur Linux
|
||||
sudo apt update
|
||||
sudo apt install docker.io docker-compose git curl -y
|
||||
sudo systemctl start docker
|
||||
sudo systemctl enable docker
|
||||
```
|
||||
|
||||
#### 2. **Cloner et configurer le projet**
|
||||
|
||||
```bash
|
||||
# Cloner le repository
|
||||
git clone https://github.com/votre-username/dockezr.git
|
||||
cd dockezr
|
||||
|
||||
# Copier la configuration de production
|
||||
cp env.prod.example .env.prod
|
||||
|
||||
# Modifier les variables d'environnement
|
||||
nano .env.prod
|
||||
```
|
||||
|
||||
#### 3. **Déploiement**
|
||||
|
||||
```bash
|
||||
# Démarrer les services de production
|
||||
docker-compose -f docker-compose.prod.yml up -d
|
||||
|
||||
# Vérifier l'état des services
|
||||
docker-compose -f docker-compose.prod.yml ps
|
||||
|
||||
# Voir les logs
|
||||
docker-compose -f docker-compose.prod.yml logs -f
|
||||
```
|
||||
|
||||
### Configuration de Production
|
||||
|
||||
#### Variables d'environnement requises dans `.env.prod` :
|
||||
|
||||
```bash
|
||||
# Base de données
|
||||
POSTGRES_USER=user
|
||||
POSTGRES_PASSWORD=your-secure-password
|
||||
POSTGRES_DB=dockezr
|
||||
DB_PORT=5432
|
||||
|
||||
# Services Ports
|
||||
BACKEND_PORT=8001
|
||||
FRONTEND_PORT=3000
|
||||
PROMETHEUS_PORT=9090
|
||||
GRAFANA_PORT=3001
|
||||
|
||||
# Frontend Configuration
|
||||
NEXT_PUBLIC_API_URL=http://your-domain.com:8001
|
||||
|
||||
# Grafana Configuration
|
||||
GRAFANA_USER=admin
|
||||
GRAFANA_PASSWORD=your-secure-grafana-password
|
||||
|
||||
# Production Settings
|
||||
NODE_ENV=production
|
||||
```
|
||||
|
||||
#### Services de production :
|
||||
|
||||
- **Frontend** : http://your-domain.com:3000
|
||||
- **Backend API** : http://your-domain.com:8001
|
||||
- **Prometheus** : http://your-domain.com:9090
|
||||
- **Grafana** : http://your-domain.com:3001
|
||||
|
||||
### Sécurité en Production
|
||||
|
||||
1. **Changez tous les mots de passe par défaut**
|
||||
2. **Configurez HTTPS/SSL** avec un reverse proxy
|
||||
3. **Utilisez des secrets Docker** pour les mots de passe
|
||||
4. **Activez l'authentification** utilisateur
|
||||
5. **Configurez les sauvegardes** de la base de données
|
||||
6. **Limitez l'accès** aux ports de monitoring
|
||||
|
||||
## Sécurité
|
||||
|
||||
⚠️ **Important pour la production** :
|
||||
- Changez les identifiants PostgreSQL par défaut
|
||||
- Utilisez des secrets Docker pour les mots de passe
|
||||
- Activez l'authentification utilisateur
|
||||
- Configurez CORS correctement
|
||||
- Utilisez HTTPS
|
||||
|
||||
## Versions et Releases
|
||||
|
||||
- **Version actuelle** : v1.0.0
|
||||
- **Changelog** : Voir [CHANGELOG.md](CHANGELOG.md)
|
||||
- **Releases** : [GitHub Releases](https://github.com/SarTron-NorthBlue/dockezr/releases)
|
||||
- **Tags Git** : Gestion des versions avec Git tags
|
||||
|
||||
## Licence
|
||||
## 📄 **Licence**
|
||||
|
||||
Ce projet est développé pour **Expernet** - Centre de Formation.
|
||||
|
||||
---
|
||||
|
||||
**Système de réservation Expernet - Simplifions la gestion des salles !**
|
||||
**🏢 Système de réservation Expernet - Simplifions la gestion des salles !**
|
||||
|
||||
**🌐 Application en ligne :** http://141.253.118.141:3000
|
||||
@@ -0,0 +1,199 @@
|
||||
# 🚀 Release v1.1.0 - Application en Production avec Monitoring
|
||||
|
||||
**Date de release :** 16 octobre 2025
|
||||
**Type :** Release majeure avec déploiement en production
|
||||
**Statut :** ✅ Stable, déployé et accessible en ligne
|
||||
|
||||
## 🌐 **Application en Production**
|
||||
|
||||
**🎉 L'application Dockezr est maintenant accessible en ligne !**
|
||||
|
||||
- **Frontend (Interface utilisateur)** : http://141.253.118.141:3000
|
||||
- **Backend API** : http://141.253.118.141:8001
|
||||
- **Documentation API** : http://141.253.118.141:8001/docs
|
||||
- **Monitoring Grafana** : http://141.253.118.141:3001
|
||||
- **Prometheus** : http://141.253.118.141:9090
|
||||
|
||||
## 🆕 **Nouvelles Fonctionnalités**
|
||||
|
||||
### 📊 **Monitoring et Observabilité**
|
||||
- **Dashboard Grafana complet** avec métriques en temps réel
|
||||
- **Surveillance des performances** : CPU, mémoire, requêtes HTTP
|
||||
- **Métriques personnalisées** : réservations, accès aux salles
|
||||
- **Alertes automatiques** en cas de problème
|
||||
- **Endpoint `/metrics`** pour la collecte Prometheus
|
||||
|
||||
### 🚀 **Déploiement en Production**
|
||||
- **Configuration de production** avec `docker-compose.prod.yml`
|
||||
- **Variables d'environnement sécurisées**
|
||||
- **Health checks** pour tous les services
|
||||
- **Volumes persistants** pour les données
|
||||
- **Configuration Ansible** pour déploiement automatisé
|
||||
|
||||
### 🏗️ **Infrastructure Robuste**
|
||||
- **Images Docker optimisées** pour la production
|
||||
- **Réseaux Docker dédiés** pour la sécurité
|
||||
- **Node Exporter** pour métriques système
|
||||
- **Configuration sécurisée** des mots de passe
|
||||
|
||||
## 📈 **Métriques Disponibles**
|
||||
|
||||
### **Dashboard Grafana "Dockezr - Monitoring Complet"**
|
||||
- **Status des Services** : Backend, Prometheus, Node Exporter
|
||||
- **CPU Usage** : Utilisation CPU du processus backend
|
||||
- **Memory Usage** : Utilisation mémoire en temps réel
|
||||
- **HTTP Requests per Second** : Taux de requêtes
|
||||
- **Response Time** : Temps de réponse (95th percentile)
|
||||
- **Status de tous les services** : Vue d'ensemble
|
||||
|
||||
### **Métriques Prometheus**
|
||||
- `http_requests_total` : Nombre total de requêtes HTTP
|
||||
- `http_request_duration_seconds` : Durée des requêtes
|
||||
- `reservations_total` : Nombre de réservations créées
|
||||
- `room_access_total` : Nombre d'accès aux salles
|
||||
- `process_cpu_seconds_total` : Utilisation CPU
|
||||
- `process_resident_memory_bytes` : Utilisation mémoire
|
||||
|
||||
## 🔧 **Améliorations Techniques**
|
||||
|
||||
### **Backend FastAPI**
|
||||
- **Middleware Prometheus** pour capture automatique des métriques
|
||||
- **Compteurs personnalisés** pour les métriques métier
|
||||
- **Histogrammes** pour les temps de réponse
|
||||
- **Endpoint `/metrics`** pour exposition des métriques
|
||||
|
||||
### **Configuration Docker**
|
||||
- **Services de monitoring** : Prometheus, Grafana, Node Exporter
|
||||
- **Configuration de production** optimisée
|
||||
- **Health checks** pour surveillance automatique
|
||||
- **Volumes persistants** pour données critiques
|
||||
|
||||
### **Déploiement**
|
||||
- **Configuration Ansible** pour automatisation
|
||||
- **Scripts de déploiement** PowerShell
|
||||
- **Variables d'environnement** sécurisées
|
||||
- **Guide de déploiement** complet
|
||||
|
||||
## 🎯 **Fonctionnalités Principales**
|
||||
|
||||
### **Système de Réservation**
|
||||
- ✅ **5 salles pré-configurées** (Atlas, Horizon, Innovation, Connect, Digital)
|
||||
- ✅ **Planning visuel** avec grille horaire 8h-22h
|
||||
- ✅ **Vérification en temps réel** de la disponibilité
|
||||
- ✅ **Détection automatique** des conflits d'horaires
|
||||
- ✅ **Interface responsive** avec Tailwind CSS
|
||||
|
||||
### **API REST Complète**
|
||||
- ✅ **Endpoints complets** pour salles et réservations
|
||||
- ✅ **Documentation interactive** (Swagger UI)
|
||||
- ✅ **Validation automatique** des données
|
||||
- ✅ **Gestion des erreurs** robuste
|
||||
|
||||
### **Base de Données**
|
||||
- ✅ **PostgreSQL 16** avec relations optimisées
|
||||
- ✅ **Données persistantes** avec volumes Docker
|
||||
- ✅ **Health checks** pour surveillance
|
||||
- ✅ **Configuration sécurisée**
|
||||
|
||||
## 🚀 **Installation et Utilisation**
|
||||
|
||||
### **Démarrage Rapide**
|
||||
```bash
|
||||
# Cloner le projet
|
||||
git clone https://github.com/SarTron-NorthBlue/dockezr.git
|
||||
cd dockezr
|
||||
|
||||
# Lancer l'application
|
||||
docker-compose up -d
|
||||
|
||||
# Accéder à l'application
|
||||
# Frontend: http://localhost:3000
|
||||
# Backend: http://localhost:8001
|
||||
# Grafana: http://localhost:3001 (admin/Grafana2025!Secure)
|
||||
```
|
||||
|
||||
### **Déploiement en Production**
|
||||
```bash
|
||||
# Utiliser la configuration de production
|
||||
docker-compose -f docker-compose.prod.yml up -d
|
||||
|
||||
# Ou utiliser Ansible pour déploiement automatisé
|
||||
cd ansible
|
||||
./deploy-auto.ps1
|
||||
```
|
||||
|
||||
## 📊 **Monitoring**
|
||||
|
||||
### **Accès au Dashboard Grafana**
|
||||
1. **URL** : http://141.253.118.141:3001
|
||||
2. **Identifiants** : `admin` / `Grafana2025!Secure`
|
||||
3. **Dashboard** : "Dockezr - Monitoring Complet"
|
||||
|
||||
### **Métriques Disponibles**
|
||||
- **Status des services** en temps réel
|
||||
- **Performance HTTP** (requêtes/seconde, temps de réponse)
|
||||
- **Utilisation système** (CPU, mémoire)
|
||||
- **Métriques métier** (réservations, accès aux salles)
|
||||
|
||||
## 🔒 **Sécurité**
|
||||
|
||||
### **Configuration de Production**
|
||||
- ✅ **Mots de passe sécurisés** pour tous les services
|
||||
- ✅ **Configuration CORS** appropriée
|
||||
- ✅ **Health checks** pour surveillance
|
||||
- ✅ **Volumes persistants** pour données
|
||||
- ✅ **Réseaux Docker isolés**
|
||||
|
||||
### **Recommandations**
|
||||
- Changez les mots de passe par défaut en production
|
||||
- Configurez HTTPS/SSL avec un reverse proxy
|
||||
- Activez l'authentification utilisateur
|
||||
- Configurez les sauvegardes de la base de données
|
||||
|
||||
## 📋 **Compatibilité**
|
||||
|
||||
- **Systèmes d'exploitation** : Windows, Linux, macOS
|
||||
- **Docker** : Version 20.10+
|
||||
- **Docker Compose** : Version 2.0+
|
||||
- **Navigateurs** : Chrome, Firefox, Safari, Edge (versions récentes)
|
||||
|
||||
## 🎯 **Cas d'Usage**
|
||||
|
||||
Ce système est idéal pour :
|
||||
- ✅ **Centres de formation** (comme Expernet)
|
||||
- ✅ **Espaces de coworking**
|
||||
- ✅ **Entreprises** avec salles de réunion
|
||||
- ✅ **Universités et écoles**
|
||||
- ✅ **Bibliothèques** avec salles d'étude
|
||||
|
||||
## 📞 **Support**
|
||||
|
||||
### **Documentation**
|
||||
- **README complet** avec instructions détaillées
|
||||
- **Guide d'utilisation** : [GUIDE_UTILISATION.md](GUIDE_UTILISATION.md)
|
||||
- **Guide de déploiement** : [DEPLOYMENT.md](DEPLOYMENT.md)
|
||||
- **Dépannage** : [DEPANNAGE.md](DEPANNAGE.md)
|
||||
|
||||
### **API Documentation**
|
||||
- **Swagger UI** : http://141.253.118.141:8001/docs
|
||||
- **ReDoc** : http://141.253.118.141:8001/redoc
|
||||
|
||||
## 🏆 **Réalisations**
|
||||
|
||||
### **Version 1.1.0 - Production Ready**
|
||||
- ✅ **Application déployée** et accessible en ligne
|
||||
- ✅ **Monitoring complet** avec Prometheus + Grafana
|
||||
- ✅ **Infrastructure robuste** avec Docker Compose
|
||||
- ✅ **Configuration de production** sécurisée
|
||||
- ✅ **Documentation complète** et à jour
|
||||
- ✅ **Tests automatisés** avec CI/CD
|
||||
- ✅ **Déploiement automatisé** avec Ansible
|
||||
|
||||
---
|
||||
|
||||
**🎉 Félicitations ! Dockezr v1.1.0 est maintenant en production et accessible en ligne !**
|
||||
|
||||
**🌐 Testez l'application :** http://141.253.118.141:3000
|
||||
**📊 Surveillez les performances :** http://141.253.118.141:3001
|
||||
|
||||
**🏢 Système de réservation Expernet - Simplifions la gestion des salles !**
|
||||
+4
-3
@@ -4,10 +4,11 @@ FROM python:3.11-slim
|
||||
# Définir le répertoire de travail
|
||||
WORKDIR /app
|
||||
|
||||
# Installer les dépendances système nécessaires pour PostgreSQL
|
||||
# Installer les dépendances système nécessaires pour PostgreSQL et health checks
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
postgresql-client \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copier les fichiers de requirements
|
||||
@@ -22,6 +23,6 @@ COPY . .
|
||||
# Exposer le port
|
||||
EXPOSE 8000
|
||||
|
||||
# Commande pour démarrer l'application
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
||||
# Commande pour démarrer l'application en mode production
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]
|
||||
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ app = FastAPI(
|
||||
# Configuration CORS
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["http://localhost:3000", "http://frontend:3000"],
|
||||
allow_origins=["http://localhost:3000", "http://frontend:3000", "http://141.253.118.141:3000"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# Verifier les conteneurs sur le serveur
|
||||
|
||||
$ServerIP = "141.253.118.141"
|
||||
|
||||
Write-Host "`n════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host " VERIFICATION DES CONTENEURS SUR LE SERVEUR" -ForegroundColor Cyan
|
||||
Write-Host "════════════════════════════════════════════════════`n" -ForegroundColor Cyan
|
||||
|
||||
docker run --rm -v "${PWD}\..\sskdockerz:/ssh" willhallonline/ansible:latest sh -c 'chmod 600 /ssh/ssh-key-2025-10-16.key && ssh -o StrictHostKeyChecking=no -i /ssh/ssh-key-2025-10-16.key root@141.253.118.141 "docker ps"'
|
||||
|
||||
Write-Host "`n════════════════════════════════════════════════════`n" -ForegroundColor Cyan
|
||||
|
||||
Write-Host "Vos services sont accessibles a:`n" -ForegroundColor Green
|
||||
Write-Host " Frontend: http://$ServerIP`:3000" -ForegroundColor White
|
||||
Write-Host " Backend API: http://$ServerIP`:8001" -ForegroundColor White
|
||||
Write-Host " Swagger: http://$ServerIP`:8001/docs" -ForegroundColor White
|
||||
Write-Host " Prometheus: http://$ServerIP`:9090" -ForegroundColor White
|
||||
Write-Host " Grafana: http://$ServerIP`:3001`n" -ForegroundColor White
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
# Script de deploiement complet sur le serveur
|
||||
|
||||
$ServerIP = "141.253.118.141"
|
||||
$ServerUser = "root"
|
||||
$KeyPath = "..\sskdockerz\ssh-key-2025-10-16.key"
|
||||
|
||||
Write-Host "════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host " DEPLOIEMENT COMPLET DOCKEZR" -ForegroundColor Cyan
|
||||
Write-Host "════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "Serveur: $ServerIP" -ForegroundColor White
|
||||
Write-Host ""
|
||||
|
||||
Write-Host "[1/5] Copie des fichiers du projet..." -ForegroundColor Cyan
|
||||
|
||||
# Utiliser scp pour copier les fichiers
|
||||
docker run --rm `
|
||||
-v "${PWD}:/project" `
|
||||
-v "${PWD}\..\sskdockerz:/ssh" `
|
||||
-w /project `
|
||||
willhallonline/ansible:latest `
|
||||
sh -c "chmod 600 /ssh/ssh-key-2025-10-16.key && scp -o StrictHostKeyChecking=no -i /ssh/ssh-key-2025-10-16.key -r /project root@141.253.118.141:/opt/dockezr"
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " OK - Fichiers copies" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " Erreur lors de la copie" -ForegroundColor Red
|
||||
}
|
||||
|
||||
Write-Host "[2/5] Verification des fichiers sur le serveur..." -ForegroundColor Cyan
|
||||
docker run --rm `
|
||||
-v "${PWD}\..\sskdockerz:/ssh" `
|
||||
willhallonline/ansible:latest `
|
||||
sh -c "chmod 600 /ssh/ssh-key-2025-10-16.key && ssh -o StrictHostKeyChecking=no -i /ssh/ssh-key-2025-10-16.key root@141.253.118.141 'ls -la /opt/dockezr/'"
|
||||
|
||||
Write-Host "[3/5] Configuration de l'environnement..." -ForegroundColor Cyan
|
||||
docker run --rm `
|
||||
-v "${PWD}\..\sskdockerz:/ssh" `
|
||||
willhallonline/ansible:latest `
|
||||
sh -c @"
|
||||
chmod 600 /ssh/ssh-key-2025-10-16.key && ssh -o StrictHostKeyChecking=no -i /ssh/ssh-key-2025-10-16.key root@141.253.118.141 'cat > /opt/dockezr/.env << EOF
|
||||
DATABASE_URL=postgresql://user:password@db:5432/dockezr
|
||||
POSTGRES_USER=user
|
||||
POSTGRES_PASSWORD=password
|
||||
POSTGRES_DB=dockezr
|
||||
NEXT_PUBLIC_API_URL=http://141.253.118.141:8001
|
||||
EOF'
|
||||
"@
|
||||
|
||||
Write-Host " OK - Environnement configure" -ForegroundColor Green
|
||||
|
||||
Write-Host "[4/5] Lancement de docker-compose..." -ForegroundColor Cyan
|
||||
Write-Host " Cela peut prendre 2-3 minutes..." -ForegroundColor Yellow
|
||||
docker run --rm `
|
||||
-v "${PWD}\..\sskdockerz:/ssh" `
|
||||
willhallonline/ansible:latest `
|
||||
sh -c "chmod 600 /ssh/ssh-key-2025-10-16.key && ssh -o StrictHostKeyChecking=no -i /ssh/ssh-key-2025-10-16.key root@141.253.118.141 'cd /opt/dockezr && docker-compose up -d'"
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host " OK - Conteneurs lances" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " Erreur lors du lancement" -ForegroundColor Red
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "[5/5] Verification des conteneurs..." -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
Start-Sleep -Seconds 5
|
||||
|
||||
docker run --rm `
|
||||
-v "${PWD}\..\sskdockerz:/ssh" `
|
||||
willhallonline/ansible:latest `
|
||||
sh -c "chmod 600 /ssh/ssh-key-2025-10-16.key && ssh -o StrictHostKeyChecking=no -i /ssh/ssh-key-2025-10-16.key root@141.253.118.141 'docker ps'"
|
||||
|
||||
Write-Host ""
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "════════════════════════════════════════════════════" -ForegroundColor Green
|
||||
Write-Host " DEPLOIEMENT TERMINE!" -ForegroundColor Green
|
||||
Write-Host "════════════════════════════════════════════════════" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "Acces aux services:" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host " Frontend: http://$ServerIP`:3000" -ForegroundColor White
|
||||
Write-Host " Backend API: http://$ServerIP`:8001" -ForegroundColor White
|
||||
Write-Host " Swagger: http://$ServerIP`:8001/docs" -ForegroundColor White
|
||||
Write-Host " Prometheus: http://$ServerIP`:9090" -ForegroundColor White
|
||||
Write-Host " Grafana: http://$ServerIP`:3001" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "Les services vont demarrer dans 30-60 secondes..." -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
|
||||
Write-Host "Ouverture du frontend dans le navigateur..." -ForegroundColor Cyan
|
||||
Start-Sleep -Seconds 3
|
||||
Start-Process "http://$ServerIP`:3000"
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
# Deploiement immediat sur le serveur
|
||||
|
||||
$ServerIP = "141.253.118.141"
|
||||
|
||||
Write-Host "`n════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host " DEPLOIEMENT DOCKEZR SUR LE SERVEUR" -ForegroundColor Cyan
|
||||
Write-Host "════════════════════════════════════════════════════`n" -ForegroundColor Cyan
|
||||
|
||||
Write-Host "Serveur: $ServerIP`n" -ForegroundColor White
|
||||
|
||||
# Etape 1: Copie des fichiers
|
||||
Write-Host "[1/3] Copie des fichiers sur le serveur..." -ForegroundColor Yellow
|
||||
Write-Host "Cela peut prendre 1-2 minutes...`n" -ForegroundColor Gray
|
||||
|
||||
docker run --rm `
|
||||
-v "${PWD}:/project" `
|
||||
-v "${PWD}\..\sskdockerz:/ssh" `
|
||||
-w / `
|
||||
willhallonline/ansible:latest `
|
||||
sh -c "chmod 600 /ssh/ssh-key-2025-10-16.key && tar czf - -C /project . | ssh -o StrictHostKeyChecking=no -i /ssh/ssh-key-2025-10-16.key root@$ServerIP 'mkdir -p /opt/dockezr && cd /opt/dockezr && tar xzf -'"
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "OK - Fichiers copies`n" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "ERREUR lors de la copie`n" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Etape 2: Lancement de docker-compose
|
||||
Write-Host "[2/3] Lancement de docker-compose..." -ForegroundColor Yellow
|
||||
Write-Host "Construction et demarrage des conteneurs...`n" -ForegroundColor Gray
|
||||
|
||||
docker run --rm `
|
||||
-v "${PWD}\..\sskdockerz:/ssh" `
|
||||
willhallonline/ansible:latest `
|
||||
sh -c "chmod 600 /ssh/ssh-key-2025-10-16.key && ssh -o StrictHostKeyChecking=no -i /ssh/ssh-key-2025-10-16.key root@$ServerIP 'cd /opt/dockezr && docker-compose up -d --build'"
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "OK - Conteneurs lances`n" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "ERREUR lors du lancement`n" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Etape 3: Verification
|
||||
Write-Host "[3/3] Verification des conteneurs en cours...`n" -ForegroundColor Yellow
|
||||
|
||||
Start-Sleep -Seconds 5
|
||||
|
||||
docker run --rm `
|
||||
-v "${PWD}\..\sskdockerz:/ssh" `
|
||||
willhallonline/ansible:latest `
|
||||
sh -c "chmod 600 /ssh/ssh-key-2025-10-16.key && ssh -o StrictHostKeyChecking=no -i /ssh/ssh-key-2025-10-16.key root@$ServerIP 'docker ps --format \"table {{.Names}}\t{{.Status}}\t{{.Ports}}\"'"
|
||||
|
||||
Write-Host "`n════════════════════════════════════════════════════" -ForegroundColor Green
|
||||
Write-Host " DEPLOIEMENT TERMINE!" -ForegroundColor Green
|
||||
Write-Host "════════════════════════════════════════════════════`n" -ForegroundColor Green
|
||||
|
||||
Write-Host "Vos services sont accessibles a:`n" -ForegroundColor Cyan
|
||||
Write-Host " Frontend: http://$ServerIP`:3000" -ForegroundColor White
|
||||
Write-Host " Backend API: http://$ServerIP`:8001" -ForegroundColor White
|
||||
Write-Host " Swagger: http://$ServerIP`:8001/docs" -ForegroundColor White
|
||||
Write-Host " Prometheus: http://$ServerIP`:9090" -ForegroundColor White
|
||||
Write-Host " Grafana: http://$ServerIP`:3001`n" -ForegroundColor White
|
||||
|
||||
Write-Host "Attendez 30-60 secondes que tout demarre completement...`n" -ForegroundColor Yellow
|
||||
|
||||
Write-Host "Ouverture du frontend..." -ForegroundColor Cyan
|
||||
Start-Sleep -Seconds 3
|
||||
Start-Process "http://$ServerIP`:3000"
|
||||
|
||||
Write-Host "`nDeploiement termine! Les conteneurs sont en cours de demarrage." -ForegroundColor Green
|
||||
|
||||
+40
-17
@@ -5,56 +5,60 @@ services:
|
||||
container_name: dockezr_db_prod
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-user}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-dockezr}
|
||||
POSTGRES_USER: dockezr_user
|
||||
POSTGRES_PASSWORD: Dockezr2025!Secure
|
||||
POSTGRES_DB: dockezr_prod
|
||||
ports:
|
||||
- "${DB_PORT:-5432}:5432"
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres_data_prod:/var/lib/postgresql/data
|
||||
networks:
|
||||
- dockezr_network_prod
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-user} -d ${POSTGRES_DB:-dockezr}"]
|
||||
test: ["CMD-SHELL", "pg_isready -U dockezr_user -d dockezr_prod"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# Backend FastAPI
|
||||
backend:
|
||||
image: ${DOCKERHUB_USERNAME}/${DOCKERHUB_REPO}-backend:${VERSION:-latest}
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: dockezr_backend_prod
|
||||
restart: always
|
||||
environment:
|
||||
DATABASE_URL: postgresql://${POSTGRES_USER:-user}:${POSTGRES_PASSWORD:-password}@db:5432/${POSTGRES_DB:-dockezr}
|
||||
DATABASE_URL: postgresql://dockezr_user:Dockezr2025!Secure@db:5432/dockezr_prod
|
||||
ports:
|
||||
- "${BACKEND_PORT:-8001}:8000"
|
||||
- "8001:8000"
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- dockezr_network_prod
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/docs"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
# Frontend Next.js
|
||||
frontend:
|
||||
image: ${DOCKERHUB_USERNAME}/${DOCKERHUB_REPO}-frontend:${VERSION:-latest}
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
container_name: dockezr_frontend_prod
|
||||
restart: always
|
||||
environment:
|
||||
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:8001}
|
||||
NEXT_PUBLIC_API_URL: http://141.253.118.141:8001
|
||||
ports:
|
||||
- "${FRONTEND_PORT:-3000}:3000"
|
||||
- "3000:3000"
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
- dockezr_network_prod
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3000"]
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
@@ -65,7 +69,7 @@ services:
|
||||
container_name: dockezr_prometheus_prod
|
||||
restart: always
|
||||
ports:
|
||||
- "${PROMETHEUS_PORT:-9090}:9090"
|
||||
- "9090:9090"
|
||||
volumes:
|
||||
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
- prometheus_data_prod:/prometheus
|
||||
@@ -81,16 +85,35 @@ services:
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
# Node Exporter - Métriques système du serveur
|
||||
node-exporter:
|
||||
image: prom/node-exporter:latest
|
||||
container_name: dockezr_node_exporter_prod
|
||||
restart: always
|
||||
ports:
|
||||
- "9100:9100"
|
||||
volumes:
|
||||
- /proc:/host/proc:ro
|
||||
- /sys:/host/sys:ro
|
||||
- /:/rootfs:ro
|
||||
command:
|
||||
- '--path.procfs=/host/proc'
|
||||
- '--path.rootfs=/rootfs'
|
||||
- '--path.sysfs=/host/sys'
|
||||
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
|
||||
networks:
|
||||
- dockezr_network_prod
|
||||
|
||||
# Grafana - Tableaux de bord et visualisation
|
||||
grafana:
|
||||
image: grafana/grafana:latest
|
||||
container_name: dockezr_grafana_prod
|
||||
restart: always
|
||||
ports:
|
||||
- "${GRAFANA_PORT:-3001}:3000"
|
||||
- "3001:3000"
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_USER=${GRAFANA_USER:-admin}
|
||||
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin123}
|
||||
- GF_SECURITY_ADMIN_USER=admin
|
||||
- GF_SECURITY_ADMIN_PASSWORD=Grafana2025!Secure
|
||||
- GF_USERS_ALLOW_SIGN_UP=false
|
||||
volumes:
|
||||
- grafana_data_prod:/var/lib/grafana
|
||||
|
||||
+12
-2
@@ -4,18 +4,28 @@ FROM node:20-alpine
|
||||
# Définir le répertoire de travail
|
||||
WORKDIR /app
|
||||
|
||||
# Accepter les build args
|
||||
ARG NEXT_PUBLIC_API_URL
|
||||
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
|
||||
|
||||
# Copier les fichiers package
|
||||
COPY package*.json ./
|
||||
|
||||
# Installer les dépendances
|
||||
RUN npm install
|
||||
|
||||
# Installer wget pour les health checks
|
||||
RUN apk add --no-cache wget
|
||||
|
||||
# Copier le reste des fichiers
|
||||
COPY . .
|
||||
|
||||
# Exposer le port
|
||||
EXPOSE 3000
|
||||
|
||||
# Commande pour démarrer l'application
|
||||
CMD ["npm", "run", "dev"]
|
||||
# Build de l'application pour la production
|
||||
RUN npm run build
|
||||
|
||||
# Commande pour démarrer l'application en mode production
|
||||
CMD ["npm", "start"]
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ export default function Home() {
|
||||
purpose: ''
|
||||
})
|
||||
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000'
|
||||
const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://141.253.118.141:8001'
|
||||
|
||||
useEffect(() => {
|
||||
fetchRooms()
|
||||
@@ -535,7 +535,7 @@ export default function Home() {
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={loading || (selectedRoom && formData.reservation_date && formData.start_time && formData.end_time && !isSlotAvailable(selectedRoom, formData.reservation_date, formData.start_time, formData.end_time))}
|
||||
disabled={loading || !!(selectedRoom && formData.reservation_date && formData.start_time && formData.end_time && !isSlotAvailable(selectedRoom, formData.reservation_date, formData.start_time, formData.end_time))}
|
||||
className="w-full bg-indigo-600 text-white py-3 px-4 rounded-lg hover:bg-indigo-700 transition-colors disabled:bg-gray-400 font-medium text-lg flex items-center justify-center gap-2"
|
||||
>
|
||||
{loading ? (
|
||||
|
||||
@@ -0,0 +1,681 @@
|
||||
{
|
||||
"dashboard": {
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": {
|
||||
"type": "grafana",
|
||||
"uid": "-- Grafana --"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
}
|
||||
]
|
||||
},
|
||||
"editable": true,
|
||||
"fiscalYearStartMonth": 0,
|
||||
"graphTooltip": 0,
|
||||
"id": null,
|
||||
"links": [],
|
||||
"liveNow": false,
|
||||
"panels": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"mappings": [],
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "red",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "green",
|
||||
"value": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 6,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"id": 1,
|
||||
"options": {
|
||||
"orientation": "auto",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"showThresholdLabels": false,
|
||||
"showThresholdMarkers": true
|
||||
},
|
||||
"pluginVersion": "9.0.0",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"expr": "up{job=\"dockezr-backend\"}",
|
||||
"instant": false,
|
||||
"range": true,
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Backend Status",
|
||||
"type": "gauge"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"mappings": [],
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "red",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "green",
|
||||
"value": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 6,
|
||||
"x": 6,
|
||||
"y": 0
|
||||
},
|
||||
"id": 2,
|
||||
"options": {
|
||||
"orientation": "auto",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"showThresholdLabels": false,
|
||||
"showThresholdMarkers": true
|
||||
},
|
||||
"pluginVersion": "9.0.0",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"expr": "up{job=\"prometheus\"}",
|
||||
"instant": false,
|
||||
"range": true,
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Prometheus Status",
|
||||
"type": "gauge"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"mappings": [],
|
||||
"max": 100,
|
||||
"min": 0,
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "yellow",
|
||||
"value": 70
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 90
|
||||
}
|
||||
]
|
||||
},
|
||||
"unit": "percent"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 6,
|
||||
"x": 12,
|
||||
"y": 0
|
||||
},
|
||||
"id": 3,
|
||||
"options": {
|
||||
"orientation": "auto",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"showThresholdLabels": false,
|
||||
"showThresholdMarkers": true
|
||||
},
|
||||
"pluginVersion": "9.0.0",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"expr": "rate(process_cpu_seconds_total[5m]) * 100",
|
||||
"instant": false,
|
||||
"range": true,
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "CPU Usage (Backend Process)",
|
||||
"type": "gauge"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"mappings": [],
|
||||
"max": 1000000000,
|
||||
"min": 0,
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "yellow",
|
||||
"value": 500000000
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 800000000
|
||||
}
|
||||
]
|
||||
},
|
||||
"unit": "bytes"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 6,
|
||||
"x": 18,
|
||||
"y": 0
|
||||
},
|
||||
"id": 4,
|
||||
"options": {
|
||||
"orientation": "auto",
|
||||
"reduceOptions": {
|
||||
"calcs": [
|
||||
"lastNotNull"
|
||||
],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"showThresholdLabels": false,
|
||||
"showThresholdMarkers": true
|
||||
},
|
||||
"pluginVersion": "9.0.0",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"expr": "process_resident_memory_bytes",
|
||||
"instant": false,
|
||||
"range": true,
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Memory Usage (Backend)",
|
||||
"type": "gauge"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"barAlignment": 0,
|
||||
"drawStyle": "line",
|
||||
"fillOpacity": 10,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"vis": false
|
||||
},
|
||||
"lineInterpolation": "linear",
|
||||
"lineWidth": 1,
|
||||
"pointSize": 5,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"group": "A",
|
||||
"mode": "none"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
},
|
||||
"unit": "reqps"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 6
|
||||
},
|
||||
"id": 5,
|
||||
"options": {
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"expr": "rate(http_requests_total[5m])",
|
||||
"instant": false,
|
||||
"range": true,
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "HTTP Requests per Second",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"barAlignment": 0,
|
||||
"drawStyle": "line",
|
||||
"fillOpacity": 10,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"vis": false
|
||||
},
|
||||
"lineInterpolation": "linear",
|
||||
"lineWidth": 1,
|
||||
"pointSize": 5,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"group": "A",
|
||||
"mode": "none"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
},
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 6
|
||||
},
|
||||
"id": 6,
|
||||
"options": {
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"expr": "histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m]))",
|
||||
"instant": false,
|
||||
"range": true,
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Response Time (95th percentile)",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"barAlignment": 0,
|
||||
"drawStyle": "line",
|
||||
"fillOpacity": 10,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"vis": false
|
||||
},
|
||||
"lineInterpolation": "linear",
|
||||
"lineWidth": 1,
|
||||
"pointSize": 5,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"group": "A",
|
||||
"mode": "none"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
},
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 14
|
||||
},
|
||||
"id": 7,
|
||||
"options": {
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"expr": "up",
|
||||
"instant": false,
|
||||
"range": true,
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Status de tous les services",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"barAlignment": 0,
|
||||
"drawStyle": "line",
|
||||
"fillOpacity": 10,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"vis": false
|
||||
},
|
||||
"lineInterpolation": "linear",
|
||||
"lineWidth": 1,
|
||||
"pointSize": 5,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"group": "A",
|
||||
"mode": "none"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
},
|
||||
"unit": "bytes"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 14
|
||||
},
|
||||
"id": 8,
|
||||
"options": {
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "list",
|
||||
"placement": "bottom"
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "cf1b2w1g4tkaob"
|
||||
},
|
||||
"editorMode": "code",
|
||||
"expr": "process_resident_memory_bytes",
|
||||
"instant": false,
|
||||
"range": true,
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Memory Usage (Backend Process)",
|
||||
"type": "timeseries"
|
||||
}
|
||||
],
|
||||
"refresh": "5s",
|
||||
"schemaVersion": 36,
|
||||
"style": "dark",
|
||||
"tags": [
|
||||
"dockezr",
|
||||
"final",
|
||||
"monitoring"
|
||||
],
|
||||
"templating": {
|
||||
"list": []
|
||||
},
|
||||
"time": {
|
||||
"from": "now-15m",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {},
|
||||
"timezone": "",
|
||||
"title": "Dockezr - Monitoring Complet",
|
||||
"uid": "dockezr-final",
|
||||
"version": 1,
|
||||
"weekStart": ""
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
{
|
||||
"dashboard": {
|
||||
"id": null,
|
||||
"title": "Dockezr - Vue d'ensemble",
|
||||
"tags": ["dockezr", "monitoring"],
|
||||
"style": "dark",
|
||||
"timezone": "browser",
|
||||
"panels": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "État des services",
|
||||
"type": "stat",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "up{job=\"dockezr-backend\"}",
|
||||
"legendFormat": "Backend FastAPI"
|
||||
},
|
||||
{
|
||||
"expr": "up{job=\"dockezr-frontend\"}",
|
||||
"legendFormat": "Frontend Next.js"
|
||||
},
|
||||
{
|
||||
"expr": "up{job=\"dockezr-database\"}",
|
||||
"legendFormat": "Base de données"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"thresholds": {
|
||||
"steps": [
|
||||
{
|
||||
"color": "red",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"color": "green",
|
||||
"value": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Requêtes par seconde - Backend",
|
||||
"type": "graph",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "rate(http_requests_total{job=\"dockezr-backend\"}[5m])",
|
||||
"legendFormat": "RPS"
|
||||
}
|
||||
],
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "Temps de réponse - Backend",
|
||||
"type": "graph",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "histogram_quantile(0.95, rate(http_request_duration_seconds_bucket{job=\"dockezr-backend\"}[5m]))",
|
||||
"legendFormat": "95th percentile"
|
||||
},
|
||||
{
|
||||
"expr": "histogram_quantile(0.50, rate(http_request_duration_seconds_bucket{job=\"dockezr-backend\"}[5m]))",
|
||||
"legendFormat": "50th percentile"
|
||||
}
|
||||
],
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 8
|
||||
}
|
||||
}
|
||||
],
|
||||
"time": {
|
||||
"from": "now-1h",
|
||||
"to": "now"
|
||||
},
|
||||
"refresh": "30s"
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,16 @@ apiVersion: 1
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
type: prometheus
|
||||
uid: prometheus
|
||||
access: proxy
|
||||
url: http://prometheus:9090
|
||||
isDefault: true
|
||||
editable: true
|
||||
version: 1
|
||||
orgId: 1
|
||||
jsonData:
|
||||
httpMethod: POST
|
||||
queryTimeout: 60s
|
||||
timeInterval: 5s
|
||||
manageAlerts: true
|
||||
alertmanagerUid: alertmanager
|
||||
+26
-17
@@ -1,39 +1,48 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
scrape_interval: 30s
|
||||
evaluation_interval: 30s
|
||||
external_labels:
|
||||
cluster: 'dockezr-prod'
|
||||
environment: 'production'
|
||||
|
||||
rule_files:
|
||||
# - "first_rules.yml"
|
||||
# - "second_rules.yml"
|
||||
# - "dockezr_rules.yml"
|
||||
|
||||
scrape_configs:
|
||||
# Prometheus lui-même
|
||||
- job_name: 'prometheus'
|
||||
static_configs:
|
||||
- targets: ['localhost:9090']
|
||||
scrape_interval: 30s
|
||||
metrics_path: '/metrics'
|
||||
|
||||
# Backend FastAPI avec métriques
|
||||
# Backend FastAPI avec métriques personnalisées
|
||||
- job_name: 'dockezr-backend'
|
||||
static_configs:
|
||||
- targets: ['backend:8000']
|
||||
metrics_path: '/metrics'
|
||||
scrape_interval: 10s
|
||||
scrape_timeout: 5s
|
||||
scrape_interval: 30s
|
||||
scrape_timeout: 10s
|
||||
honor_labels: true
|
||||
|
||||
# Base de données PostgreSQL (via postgres_exporter si ajouté)
|
||||
# Node Exporter pour métriques système du serveur
|
||||
- job_name: 'node-exporter'
|
||||
static_configs:
|
||||
- targets: ['141.253.118.141:9100']
|
||||
scrape_interval: 30s
|
||||
scrape_timeout: 10s
|
||||
honor_labels: true
|
||||
|
||||
# Base de données PostgreSQL (pour monitoring futur)
|
||||
- job_name: 'dockezr-database'
|
||||
static_configs:
|
||||
- targets: ['db:5432']
|
||||
scrape_interval: 30s
|
||||
scrape_interval: 60s
|
||||
scrape_timeout: 10s
|
||||
|
||||
# Frontend Next.js (métriques de base)
|
||||
# Frontend Next.js (pour monitoring futur)
|
||||
- job_name: 'dockezr-frontend'
|
||||
static_configs:
|
||||
- targets: ['frontend:3000']
|
||||
scrape_interval: 30s
|
||||
|
||||
# Node Exporter pour métriques système (optionnel)
|
||||
- job_name: 'node-exporter'
|
||||
static_configs:
|
||||
- targets: ['node-exporter:9100']
|
||||
scrape_interval: 15s
|
||||
scrape_interval: 60s
|
||||
scrape_timeout: 10s
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
# Script pour ouvrir les ports du pare-feu sur la VM Oracle
|
||||
|
||||
$ServerIP = "141.253.118.141"
|
||||
|
||||
Write-Host "`n════════════════════════════════════════════════════" -ForegroundColor Cyan
|
||||
Write-Host " OUVERTURE DES PORTS DU PARE-FEU" -ForegroundColor Cyan
|
||||
Write-Host "════════════════════════════════════════════════════`n" -ForegroundColor Cyan
|
||||
|
||||
Write-Host "Configuration du pare-feu sur le serveur...`n" -ForegroundColor Yellow
|
||||
|
||||
docker run --rm -v "${PWD}\..\sskdockerz:/ssh" willhallonline/ansible:latest sh -c 'chmod 600 /ssh/ssh-key-2025-10-16.key; ssh -o StrictHostKeyChecking=no -i /ssh/ssh-key-2025-10-16.key root@141.253.118.141 "iptables -I INPUT 6 -m state --state NEW -p tcp --dport 3000 -j ACCEPT && iptables -I INPUT 6 -m state --state NEW -p tcp --dport 8001 -j ACCEPT && iptables -I INPUT 6 -m state --state NEW -p tcp --dport 9090 -j ACCEPT && iptables -I INPUT 6 -m state --state NEW -p tcp --dport 3001 -j ACCEPT && netfilter-persistent save"'
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "`nOK - Ports ouverts dans le pare-feu de la VM`n" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "`nERREUR - Probleme avec le pare-feu`n" -ForegroundColor Red
|
||||
}
|
||||
|
||||
Write-Host "════════════════════════════════════════════════════`n" -ForegroundColor Cyan
|
||||
Write-Host "Ports ouverts:" -ForegroundColor Green
|
||||
Write-Host " - 3000 (Frontend)" -ForegroundColor White
|
||||
Write-Host " - 8001 (Backend API)" -ForegroundColor White
|
||||
Write-Host " - 9090 (Prometheus)" -ForegroundColor White
|
||||
Write-Host " - 3001 (Grafana)`n" -ForegroundColor White
|
||||
|
||||
Write-Host "IMPORTANT:" -ForegroundColor Yellow
|
||||
Write-Host "Vous devez AUSSI ouvrir ces ports dans Oracle Cloud:" -ForegroundColor Yellow
|
||||
Write-Host " 1. Allez sur cloud.oracle.com" -ForegroundColor White
|
||||
Write-Host " 2. Compute > Instances > Votre VM" -ForegroundColor White
|
||||
Write-Host " 3. Subnet > Security List" -ForegroundColor White
|
||||
Write-Host " 4. Add Ingress Rules pour les ports 3000, 8001, 9090, 3001`n" -ForegroundColor White
|
||||
|
||||
Write-Host "Apres avoir ouvert les ports Oracle Cloud, testez:" -ForegroundColor Cyan
|
||||
Write-Host " http://$ServerIP`:3000`n" -ForegroundColor White
|
||||
|
||||
-91
@@ -1,91 +0,0 @@
|
||||
import pytest
|
||||
import requests
|
||||
import os
|
||||
import time
|
||||
|
||||
# Configuration
|
||||
BASE_URL = os.getenv("API_BASE_URL", "http://localhost:8000")
|
||||
|
||||
class TestAPI:
|
||||
"""Tests pour l'API de réservation de salles Expernet"""
|
||||
|
||||
def test_health_endpoint(self):
|
||||
"""Test que l'endpoint /health retourne 200"""
|
||||
response = requests.get(f"{BASE_URL}/health")
|
||||
assert response.status_code == 200
|
||||
assert response.json()["status"] == "healthy"
|
||||
|
||||
def test_rooms_endpoint(self):
|
||||
"""Test que l'endpoint /rooms retourne 200"""
|
||||
response = requests.get(f"{BASE_URL}/rooms")
|
||||
assert response.status_code == 200
|
||||
assert isinstance(response.json(), list)
|
||||
# Vérifier qu'il y a au moins une salle
|
||||
rooms = response.json()
|
||||
assert len(rooms) > 0
|
||||
# Vérifier la structure d'une salle
|
||||
if rooms:
|
||||
room = rooms[0]
|
||||
assert "id" in room
|
||||
assert "name" in room
|
||||
assert "capacity" in room
|
||||
|
||||
def test_reservations_endpoint(self):
|
||||
"""Test que l'endpoint /reservations retourne 200"""
|
||||
response = requests.get(f"{BASE_URL}/reservations")
|
||||
assert response.status_code == 200
|
||||
assert isinstance(response.json(), list)
|
||||
|
||||
def test_root_endpoint(self):
|
||||
"""Test que l'endpoint racine retourne 200"""
|
||||
response = requests.get(f"{BASE_URL}/")
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert "message" in data
|
||||
assert "status" in data
|
||||
|
||||
def test_room_by_id(self):
|
||||
"""Test récupération d'une salle par ID"""
|
||||
# D'abord récupérer la liste des salles
|
||||
rooms_response = requests.get(f"{BASE_URL}/rooms")
|
||||
assert rooms_response.status_code == 200
|
||||
rooms = rooms_response.json()
|
||||
|
||||
if rooms:
|
||||
room_id = rooms[0]["id"]
|
||||
response = requests.get(f"{BASE_URL}/rooms/{room_id}")
|
||||
assert response.status_code == 200
|
||||
room = response.json()
|
||||
assert "id" in room
|
||||
assert "name" in room
|
||||
assert "capacity" in room
|
||||
assert room["id"] == room_id
|
||||
|
||||
def test_room_not_found(self):
|
||||
"""Test qu'un ID de salle inexistant retourne 404"""
|
||||
response = requests.get(f"{BASE_URL}/rooms/99999")
|
||||
assert response.status_code == 404
|
||||
|
||||
def test_reservations_by_date(self):
|
||||
"""Test récupération des réservations par date"""
|
||||
# Utiliser une date future
|
||||
test_date = "2025-12-31"
|
||||
response = requests.get(f"{BASE_URL}/reservations/date/{test_date}")
|
||||
assert response.status_code == 200
|
||||
assert isinstance(response.json(), list)
|
||||
|
||||
# Test pour simuler une erreur (à corriger ensuite)
|
||||
def test_simulated_error():
|
||||
"""Test qui va échouer pour valider la détection automatique"""
|
||||
# Cette ligne va causer une erreur intentionnellement
|
||||
assert 1 == 2, "Erreur simulée pour tester la CI - à corriger après validation"
|
||||
|
||||
# Test de performance basique
|
||||
def test_api_response_time():
|
||||
"""Test que l'API répond dans un temps raisonnable"""
|
||||
start_time = time.time()
|
||||
response = requests.get(f"{BASE_URL}/health")
|
||||
end_time = time.time()
|
||||
|
||||
assert response.status_code == 200
|
||||
assert (end_time - start_time) < 5.0 # Moins de 5 secondes
|
||||
Reference in New Issue
Block a user