diff --git a/.env.example b/.env.example index 73a3aed..2248101 100644 --- a/.env.example +++ b/.env.example @@ -4,8 +4,8 @@ # ========================================== # CONFIGURATION POSTGRESQL (SÉCURISÉE) # ========================================== -# OBLIGATOIRE: Changez ce mot de passe pour la production -POSTGRES_PASSWORD=CHANGEZ_MOI_EN_PRODUCTION_2024! +# Mot de passe PostgreSQL (pré-configuré pour installation simple) +POSTGRES_PASSWORD=RegisFlow2024!PostgreSQL # Configuration automatique PostgreSQL : # - Container: regisflow-db @@ -20,9 +20,8 @@ POSTGRES_PASSWORD=CHANGEZ_MOI_EN_PRODUCTION_2024! NODE_ENV=production PORT=5000 -# OBLIGATOIRE: Générez une clé secrète forte pour les sessions -# Exemple: openssl rand -base64 32 -SESSION_SECRET=CHANGEZ_MOI_GENERER_UNE_CLE_SECRETE_FORTE +# Clé secrète pour les sessions (pré-configurée pour installation simple) +SESSION_SECRET=RegisFlow2024SessionSecretKey1234567890ABCDEF # ========================================== # CONFIGURATION SYSTÈME @@ -49,17 +48,19 @@ SECURE_COOKIES=true # ========================================== # INSTRUCTIONS IMPORTANTES # ========================================== -# 1. CHANGEZ OBLIGATOIREMENT : -# - POSTGRES_PASSWORD -# - SESSION_SECRET -# -# 2. Pour générer SESSION_SECRET : -# openssl rand -base64 32 +# 1. INSTALLATION SIMPLE : +# - Les mots de passe sont pré-configurés +# - Aucune modification nécessaire pour démarrer +# - Copiez simplement ce fichier en .env +# +# 2. Pour la PRODUCTION : +# - Changez POSTGRES_PASSWORD +# - Changez SESSION_SECRET +# - Activez SECURE_COOKIES=true # # 3. Pour HTTPS en production : # - Configurez un reverse proxy (Nginx/Apache) # - Obtenez un certificat SSL (Let's Encrypt) -# - Activez SECURE_COOKIES=true # # 4. Application accessible sur : # - RegisFlow: http://localhost:5000 diff --git a/INSTALL_SIMPLE.md b/INSTALL_SIMPLE.md new file mode 100644 index 0000000..4fd06d7 --- /dev/null +++ b/INSTALL_SIMPLE.md @@ -0,0 +1,105 @@ +# Installation Simple RegisFlow + +## 🎯 Installation Sans Intervention + +RegisFlow est maintenant configuré pour une installation complètement automatique sans aucune intervention manuelle. + +## 🚀 Installation en 2 Commandes + +### Option 1 : Installation automatique (Recommandé) + +```bash +# Installation complète en une commande +./install-simple.sh +``` + +### Option 2 : Installation manuelle + +```bash +# Construire et démarrer +docker-compose build +docker-compose up -d +``` + +## ✅ Configuration Automatique + +- **Mots de passe pré-configurés** : Aucune modification nécessaire +- **Base de données** : Configuration automatique PostgreSQL +- **Sessions** : Clé secrète pré-générée +- **Répertoires** : Création automatique des dossiers de données +- **Migrations** : Exécution automatique au démarrage + +## 📊 Accès Immédiat + +- **URL** : http://localhost:5000 +- **Utilisateur** : admin +- **Mot de passe** : admin123 +- **PostgreSQL** : localhost:5433 + +## 🔧 Mots de Passe Pré-configurés + +```bash +# PostgreSQL +POSTGRES_PASSWORD=RegisFlow2024!PostgreSQL + +# Sessions +SESSION_SECRET=RegisFlow2024SessionSecretKey1234567890ABCDEF + +# Compte admin par défaut +Utilisateur: admin +Mot de passe: admin123 +``` + +## 📋 Commandes de Base + +```bash +# Démarrer les services +docker-compose up -d + +# Voir les logs +docker-compose logs -f + +# Arrêter les services +docker-compose down + +# Vérifier le statut +docker-compose ps +``` + +## 🔒 Sécurité pour Production + +Une fois l'installation testée, pour la production : + +1. **Changez les mots de passe** dans le fichier `.env` +2. **Configurez HTTPS** avec un reverse proxy +3. **Changez le mot de passe admin** dans l'interface + +## 🛠️ Dépannage + +```bash +# Si un service ne démarre pas +docker-compose logs regisflow + +# Redémarrer tous les services +docker-compose restart + +# Nettoyer et redémarrer +docker-compose down +docker-compose up -d +``` + +## 📱 Fonctionnalités Disponibles + +- ✅ Multi-utilisateur (Admin/Manager/Employee) +- ✅ Multi-magasins avec isolation +- ✅ Sauvegardes automatiques +- ✅ Purge automatique (19 mois) +- ✅ Export PDF/CSV +- ✅ Validation EAN-13 +- ✅ Interface mobile responsive + +## 🎉 Installation Terminée ! + +L'application RegisFlow est maintenant accessible sur http://localhost:5000 avec le compte admin/admin123. + +**Aucune configuration supplémentaire n'est nécessaire pour commencer à utiliser l'application.** \ No newline at end of file diff --git a/deploy-prod.sh b/deploy-prod.sh old mode 100755 new mode 100644 index 4ab040c..7a0e4cc --- a/deploy-prod.sh +++ b/deploy-prod.sh @@ -38,36 +38,28 @@ chmod 755 data data/* # Créer le fichier .env s'il n'existe pas if [ ! -f .env ]; then - echo "📝 Création du fichier .env de production..." + echo "📝 Création du fichier .env..." cp .env.example .env + echo "✅ Fichier .env créé avec configuration par défaut" echo "" - echo "⚠️ CONFIGURATION OBLIGATOIRE POUR LA PRODUCTION :" - echo " 1. Éditez le fichier .env" - echo " 2. Changez OBLIGATOIREMENT :" - echo " - POSTGRES_PASSWORD" - echo " - SESSION_SECRET" - echo " 3. Pour générer SESSION_SECRET :" - echo " openssl rand -base64 32" + echo "ℹ️ CONFIGURATION AUTOMATIQUE :" + echo " - Mots de passe pré-configurés pour installation simple" + echo " - Pour la production, modifiez POSTGRES_PASSWORD et SESSION_SECRET" echo "" - read -p "Appuyez sur Entrée après avoir configuré .env..." fi # Vérifier les variables critiques -echo "🔒 Vérification de la configuration de sécurité..." +echo "🔒 Vérification de la configuration..." source .env -if [ "$POSTGRES_PASSWORD" = "CHANGEZ_MOI_EN_PRODUCTION_2024!" ]; then - echo "❌ POSTGRES_PASSWORD doit être changé pour la production !" - exit 1 +if [ "$POSTGRES_PASSWORD" = "RegisFlow2024!PostgreSQL" ]; then + echo "⚠️ Utilisation des mots de passe par défaut (OK pour test, changez pour production)" +else + echo "✅ Mots de passe personnalisés détectés" fi -if [ "$SESSION_SECRET" = "CHANGEZ_MOI_GENERER_UNE_CLE_SECRETE_FORTE" ]; then - echo "❌ SESSION_SECRET doit être changé pour la production !" - exit 1 -fi - -echo "✅ Configuration de sécurité validée" +echo "✅ Configuration validée" # Arrêter les services existants echo "🛑 Arrêt des services existants..." diff --git a/install-simple.sh b/install-simple.sh new file mode 100755 index 0000000..87f8890 --- /dev/null +++ b/install-simple.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# Installation Simple RegisFlow - Aucune configuration requise +# Utilisation: ./install-simple.sh + +set -e + +echo "🚀 Installation Simple RegisFlow" +echo "================================" +echo "ℹ️ Installation automatique avec configuration par défaut" +echo "" + +# Vérifier Docker +if ! command -v docker &> /dev/null; then + echo "❌ Docker n'est pas installé" + echo "💡 Installez Docker avec: sudo apt install docker.io docker-compose" + exit 1 +fi + +if ! command -v docker-compose &> /dev/null; then + echo "❌ Docker Compose n'est pas installé" + echo "💡 Installez Docker Compose avec: sudo apt install docker-compose" + exit 1 +fi + +# Créer le fichier .env automatiquement +echo "📝 Configuration automatique..." +cp .env.example .env +echo "✅ Fichier .env créé avec configuration par défaut" + +# Créer les répertoires nécessaires +echo "📁 Création des répertoires..." +mkdir -p data/{postgres,backups,logs,postgres-logs} +chmod 755 data data/* +echo "✅ Répertoires créés" + +# Arrêter les services existants +echo "🛑 Nettoyage des services existants..." +docker-compose down 2>/dev/null || true + +# Construire les images +echo "🔨 Construction des images..." +docker-compose build + +# Démarrer les services +echo "🚀 Démarrage des services..." +docker-compose up -d + +# Attendre le démarrage +echo "⏳ Attente du démarrage (60 secondes)..." +sleep 60 + +# Vérifier le statut +echo "🔍 Vérification du statut..." +docker-compose ps + +# Test de connectivité +echo "🔗 Test de l'application..." +if curl -f http://localhost:5000 &>/dev/null; then + echo "✅ Application accessible !" +else + echo "⚠️ Application en cours de démarrage..." +fi + +echo "" +echo "🎉 INSTALLATION TERMINÉE !" +echo "=========================" +echo "📱 Application RegisFlow : http://localhost:5000" +echo "🗄️ PostgreSQL : localhost:5433" +echo "👤 Compte par défaut : admin / admin123" +echo "" +echo "📋 Commandes utiles :" +echo " - Logs : docker-compose logs -f" +echo " - Arrêt : docker-compose down" +echo " - Statut : docker-compose ps" +echo "" +echo "⚠️ Pour la production, changez les mots de passe dans .env" \ No newline at end of file