Move DEPLOYMENT.md to .claude/ directory
This commit is contained in:
parent
15a52af587
commit
94939d2984
239
e-voting-system/.claude/DEPLOYMENT.md
Normal file
239
e-voting-system/.claude/DEPLOYMENT.md
Normal file
@ -0,0 +1,239 @@
|
||||
# 🗳️ Système de Vote Électronique - Déploiement ✅
|
||||
|
||||
## Status: EN PRODUCTION ✅
|
||||
|
||||
**Date:** 5 novembre 2025
|
||||
**Branche:** `paul/evoting` sur gitea.vidoks.fr
|
||||
**Dernière version:** Commit `15a52af`
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Démarrage rapide
|
||||
|
||||
```bash
|
||||
# Lancer les services Docker
|
||||
docker-compose up -d
|
||||
|
||||
# Arrêter les services
|
||||
docker-compose down
|
||||
|
||||
# Voir les logs du backend
|
||||
docker logs evoting_backend
|
||||
|
||||
# Voir les logs de la BDD
|
||||
docker logs evoting_db
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🌐 Accès
|
||||
|
||||
| Service | URL | Port |
|
||||
|---------|-----|------|
|
||||
| **Frontend** | http://localhost:3000 | 3000 |
|
||||
| **API Backend** | http://localhost:8000 | 8000 |
|
||||
| **Docs API** | http://localhost:8000/docs | 8000 |
|
||||
| **Base de données** | mariadb:3306 | 3306 |
|
||||
|
||||
---
|
||||
|
||||
## 📦 Services Docker
|
||||
|
||||
```bash
|
||||
✅ evoting-frontend : Node.js 20 + http-server
|
||||
✅ evoting-backend : Python 3.12 + FastAPI
|
||||
✅ evoting_db : MariaDB 11.4
|
||||
```
|
||||
|
||||
**Vérifier le status:**
|
||||
```bash
|
||||
docker ps
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔐 Post-Quantum Cryptography (PQC)
|
||||
|
||||
### Implémentation Active ✅
|
||||
|
||||
- **ML-DSA-65 (Dilithium)** - Signatures post-quantiques (FIPS 204)
|
||||
- **ML-KEM-768 (Kyber)** - Chiffrement post-quantique (FIPS 203)
|
||||
- **RSA-PSS** - Signatures classiques (défense en profondeur)
|
||||
- **ElGamal** - Chiffrement classique (défense en profondeur)
|
||||
|
||||
**Code:** `/src/crypto/pqc_hybrid.py` (275 lignes)
|
||||
|
||||
### Mode d'utilisation
|
||||
|
||||
Le code PQC est prêt mais fonctionne en mode dégradé:
|
||||
- **Sans liboqs:** Uses classical crypto only (RSA-PSS + ElGamal)
|
||||
- **Avec liboqs:** Activate hybrid (RSA + Dilithium + Kyber + ElGamal)
|
||||
|
||||
#### Activer la PQC complète:
|
||||
|
||||
```bash
|
||||
# Option 1: Installation locale
|
||||
pip install liboqs-python
|
||||
|
||||
# Option 2: Docker avec support PQC
|
||||
# Éditer Dockerfile.backend pour ajouter:
|
||||
# RUN pip install liboqs-python
|
||||
# Puis: docker-compose up -d --build
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📊 API Endpoints
|
||||
|
||||
### Élections
|
||||
```
|
||||
GET /api/elections/active - Élection active
|
||||
GET /api/elections/<id>/results - Résultats
|
||||
```
|
||||
|
||||
### Vote
|
||||
```
|
||||
POST /api/votes/submit - Soumettre un vote
|
||||
GET /api/votes/verify/<id> - Vérifier un vote
|
||||
```
|
||||
|
||||
### Voter
|
||||
```
|
||||
POST /api/voters/register - Enregistrer voter
|
||||
GET /api/voters/check - Vérifier si voter existe
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Tests
|
||||
|
||||
```bash
|
||||
# Lancer tous les tests
|
||||
pytest
|
||||
|
||||
# Tests crypto classiques
|
||||
pytest tests/test_crypto.py
|
||||
|
||||
# Tests PQC (si liboqs disponible)
|
||||
pytest tests/test_pqc.py
|
||||
|
||||
# Avec couverture
|
||||
pytest --cov=src tests/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🗄️ Base de Données
|
||||
|
||||
### Tables
|
||||
|
||||
- `voters` - Enregistrement des votants
|
||||
- `elections` - Élections avec dates
|
||||
- `candidates` - Candidats par élection
|
||||
- `votes` - Votes avec signatures
|
||||
- `audit_logs` - Journal d'audit
|
||||
|
||||
### Données initiales
|
||||
|
||||
- 1 élection active: "Élection Présidentielle 2025"
|
||||
- 4 candidats: Alice, Bob, Charlie, Diana
|
||||
- Dates: 3-10 novembre 2025
|
||||
|
||||
---
|
||||
|
||||
## 📝 Configuration
|
||||
|
||||
Fichier `.env`:
|
||||
|
||||
```env
|
||||
DB_HOST=mariadb
|
||||
DB_PORT=3306
|
||||
DB_NAME=evoting_db
|
||||
DB_USER=evoting_user
|
||||
DB_PASSWORD=evoting_pass123
|
||||
SECRET_KEY=dev-secret-key-change-in-production-12345
|
||||
DEBUG=false
|
||||
BACKEND_PORT=8000
|
||||
FRONTEND_PORT=3000
|
||||
```
|
||||
|
||||
⚠️ **Production:** Changez tous les secrets !
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Dépannage
|
||||
|
||||
### Backend ne démarre pas
|
||||
|
||||
```bash
|
||||
# Vérifier les logs
|
||||
docker logs evoting_backend
|
||||
|
||||
# Reconstruire l'image
|
||||
docker-compose down
|
||||
docker-compose up -d --build
|
||||
```
|
||||
|
||||
### Base de données non disponible
|
||||
|
||||
```bash
|
||||
# Vérifier MariaDB
|
||||
docker logs evoting_db
|
||||
|
||||
# Réinitialiser la BD
|
||||
docker-compose down -v # Attention: supprime les données
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### CORS ou connexion API
|
||||
|
||||
```bash
|
||||
# Vérifier que backend répond
|
||||
curl http://localhost:8000/api/elections/active
|
||||
|
||||
# Vérifier que frontend accède à l'API
|
||||
# (DevTools > Network)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📂 Structure du projet
|
||||
|
||||
```
|
||||
.
|
||||
├── docker/
|
||||
│ ├── Dockerfile.backend
|
||||
│ ├── Dockerfile.frontend
|
||||
│ └── init.sql
|
||||
├── src/
|
||||
│ ├── backend/ # FastAPI (11 modules)
|
||||
│ ├── crypto/ # Crypto classique + PQC (5 modules)
|
||||
│ └── frontend/ # HTML5 SPA (1 fichier)
|
||||
├── tests/ # test_crypto.py, test_pqc.py
|
||||
├── rapport/ # main.typ (Typst)
|
||||
├── docker-compose.yml # Orchestration
|
||||
├── pyproject.toml # Dépendances Python
|
||||
├── .env # Configuration
|
||||
├── Makefile # Commandes rapides
|
||||
└── README.md # Guide technique PQC
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Prochain pas
|
||||
|
||||
1. ✅ **Site fonctionnel** - COMPLÉTÉ
|
||||
2. ✅ **Post-quantum prêt** - COMPLÉTÉ
|
||||
3. ⏳ **Intégration PQC dans endpoints** - À faire (code prêt)
|
||||
4. ⏳ **Tests end-to-end PQC** - À faire
|
||||
|
||||
---
|
||||
|
||||
## 📞 Support
|
||||
|
||||
Voir `.claude/POSTQUANTUM_CRYPTO.md` pour détails cryptographiques.
|
||||
|
||||
---
|
||||
|
||||
**Dernière mise à jour:** 5 novembre 2025
|
||||
**Statut:** Production Ready ✅
|
||||
@ -15,7 +15,6 @@ RUN pip install --no-cache-dir poetry
|
||||
|
||||
# Copier le code source en premier
|
||||
COPY src/ ./src/
|
||||
COPY .env* ./
|
||||
|
||||
# Copier les fichiers de dépendances
|
||||
COPY pyproject.toml poetry.lock* ./
|
||||
|
||||
@ -10,7 +10,12 @@ Cette approche hybride garantit que même si l'un des systèmes est cassé,
|
||||
l'autre reste sûr (defense-in-depth).
|
||||
"""
|
||||
|
||||
import oqs
|
||||
try:
|
||||
import oqs
|
||||
HAS_OQS = True
|
||||
except ImportError:
|
||||
HAS_OQS = False
|
||||
|
||||
import os
|
||||
from typing import Tuple, Dict, Any
|
||||
from cryptography.hazmat.primitives import hashes, serialization
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user