mirror of
https://github.com/R0m1k3/noteflow.git
synced 2026-10-11 17:29:37 +02:00
Docs: Guide de déploiement PostgreSQL
DEPLOY-NOW.md: Guide complet de déploiement en 3 commandes Contenu: - 🎯 Commandes de déploiement (build + up) - 📋 Ce qui va se passer au démarrage - 🔍 Vérifications post-migration - ✅ Checklist complète - 🆘 Dépannage si problème - 📊 Création de backups PostgreSQL - ✨ Avantages de PostgreSQL L'utilisateur peut maintenant déployer en 1 ligne: docker-compose build && docker-compose up -d La migration SQLite → PostgreSQL se fait automatiquement au premier démarrage si data/notes.db existe.
This commit is contained in:
1 file changed
+277
+277
@@ -0,0 +1,277 @@
|
|||||||
|
# 🚀 DÉPLOIEMENT IMMÉDIAT - PostgreSQL Uniquement
|
||||||
|
|
||||||
|
## ✅ Ce qui a été fait
|
||||||
|
|
||||||
|
NoteFlow a été **complètement migré vers PostgreSQL**. Plus besoin de SQLite.
|
||||||
|
|
||||||
|
### Changements appliqués:
|
||||||
|
|
||||||
|
1. ✅ **Base de données:** PostgreSQL uniquement (`config/database.js`)
|
||||||
|
2. ✅ **Migration automatique:** Au démarrage si SQLite détecté
|
||||||
|
3. ✅ **Toutes les routes:** Mises à jour pour PostgreSQL
|
||||||
|
4. ✅ **Docker-entrypoint:** Attend PostgreSQL et migre automatiquement
|
||||||
|
5. ✅ **Documentation:** Guide complet créé (`POSTGRESQL-ONLY.md`)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎯 DÉPLOIEMENT EN 3 COMMANDES
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Reconstruire l'image avec PostgreSQL uniquement
|
||||||
|
docker-compose build
|
||||||
|
|
||||||
|
# 2. Démarrer les containers
|
||||||
|
docker-compose up -d
|
||||||
|
|
||||||
|
# 3. Suivre les logs pour voir la migration
|
||||||
|
docker-compose logs -f notes-app
|
||||||
|
```
|
||||||
|
|
||||||
|
**C'est tout!** 🎉
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📋 Ce qui va se passer
|
||||||
|
|
||||||
|
### Au démarrage du container:
|
||||||
|
|
||||||
|
```
|
||||||
|
🚀 Démarrage de NoteFlow avec PostgreSQL
|
||||||
|
========================================
|
||||||
|
|
||||||
|
⏳ Attente de PostgreSQL...
|
||||||
|
✅ PostgreSQL est prêt
|
||||||
|
|
||||||
|
🔍 Vérification des données...
|
||||||
|
⚠️ PostgreSQL est vide
|
||||||
|
|
||||||
|
📦 Base SQLite détectée: /app/data-sqlite/notes.db
|
||||||
|
🔄 Lancement de la migration automatique...
|
||||||
|
|
||||||
|
==================== MIGRATION SQLite → PostgreSQL ====================
|
||||||
|
|
||||||
|
📋 Migration table: users
|
||||||
|
✓ Table "users": 1/1 lignes migrées
|
||||||
|
📋 Migration table: notes
|
||||||
|
✓ Table "notes": X/X lignes migrées
|
||||||
|
📋 Migration table: global_todos
|
||||||
|
✓ Table "global_todos": X/X lignes migrées
|
||||||
|
📋 Migration table: rss_feeds
|
||||||
|
✓ Table "rss_feeds": X/X lignes migrées
|
||||||
|
📋 Migration table: rss_articles
|
||||||
|
✓ Table "rss_articles": X/X lignes migrées
|
||||||
|
...
|
||||||
|
|
||||||
|
========================================================
|
||||||
|
✅ Migration terminée!
|
||||||
|
Total: XXX lignes migrées
|
||||||
|
========================================================
|
||||||
|
|
||||||
|
✅ Migration réussie!
|
||||||
|
|
||||||
|
========================================
|
||||||
|
🚀 Démarrage du serveur NoteFlow...
|
||||||
|
|
||||||
|
Base de données connectée: postgresql://noteflow:***@postgres:5499/noteflow
|
||||||
|
✓ Tables de base de données créées avec succès
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
**Durée estimée:** 30 secondes à 2 minutes selon la quantité de données
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔍 Vérification après déploiement
|
||||||
|
|
||||||
|
### 1. Vérifier que l'application est accessible
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl http://localhost:2222/health
|
||||||
|
```
|
||||||
|
|
||||||
|
Attendu: `{"status":"ok","timestamp":"...","uptime":...}`
|
||||||
|
|
||||||
|
### 2. Vérifier les données dans PostgreSQL
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker exec noteflow-postgres psql -U noteflow -d noteflow -p 5499 -c "
|
||||||
|
SELECT 'notes' as table_name, COUNT(*) as count FROM notes
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'rss_articles', COUNT(*) FROM rss_articles
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'global_todos', COUNT(*) FROM global_todos;
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Connexion à l'interface web
|
||||||
|
|
||||||
|
Ouvrez: **http://localhost:2222**
|
||||||
|
|
||||||
|
Connectez-vous avec: `admin` / `admin`
|
||||||
|
|
||||||
|
**⚠️ IMPORTANT:** Changez immédiatement le mot de passe admin!
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📊 Vérifications complètes
|
||||||
|
|
||||||
|
### ✅ Checklist post-migration:
|
||||||
|
|
||||||
|
- [ ] Application accessible sur http://localhost:2222
|
||||||
|
- [ ] Connexion avec admin/admin fonctionne
|
||||||
|
- [ ] Notes affichées (vérifier le nombre)
|
||||||
|
- [ ] Tâches visibles dans la sidebar
|
||||||
|
- [ ] Flux RSS configurés (Admin > Flux RSS)
|
||||||
|
- [ ] Articles RSS affichés
|
||||||
|
- [ ] Calendrier fonctionne (si configuré)
|
||||||
|
- [ ] Paramètres présents (Admin > Paramètres)
|
||||||
|
|
||||||
|
### ✅ Vérification technique:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Nombre de tables PostgreSQL
|
||||||
|
docker exec noteflow-postgres psql -U noteflow -d noteflow -p 5499 -c "
|
||||||
|
SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'public';
|
||||||
|
"
|
||||||
|
# Attendu: 13 tables
|
||||||
|
|
||||||
|
# Taille de la base
|
||||||
|
docker exec noteflow-postgres psql -U noteflow -d noteflow -p 5499 -c "
|
||||||
|
SELECT pg_size_pretty(pg_database_size('noteflow'));
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎉 Après la migration réussie
|
||||||
|
|
||||||
|
### Votre ancienne base SQLite
|
||||||
|
|
||||||
|
Elle est **conservée automatiquement** dans `./data/notes.db`
|
||||||
|
|
||||||
|
**Ne la supprimez PAS** tant que vous n'avez pas:
|
||||||
|
1. ✅ Vérifié que tout fonctionne avec PostgreSQL
|
||||||
|
2. ✅ Utilisé l'application pendant quelques jours
|
||||||
|
3. ✅ Fait un backup PostgreSQL
|
||||||
|
|
||||||
|
### Créer un backup PostgreSQL
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Backup complet
|
||||||
|
docker exec noteflow-postgres pg_dump -U noteflow -d noteflow -p 5499 > backup-noteflow-$(date +%Y%m%d).sql
|
||||||
|
|
||||||
|
# Backup compressé
|
||||||
|
docker exec noteflow-postgres pg_dump -U noteflow -d noteflow -p 5499 | gzip > backup-noteflow-$(date +%Y%m%d).sql.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
### Programmer des backups automatiques
|
||||||
|
|
||||||
|
Ajoutez à votre crontab:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Backup quotidien à 3h du matin
|
||||||
|
0 3 * * * cd /chemin/vers/noteflow && docker exec noteflow-postgres pg_dump -U noteflow -d noteflow -p 5499 | gzip > backups/noteflow-$(date +\%Y\%m\%d).sql.gz && find backups/ -name "noteflow-*.sql.gz" -mtime +30 -delete
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🆘 En cas de problème
|
||||||
|
|
||||||
|
### PostgreSQL ne démarre pas
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Voir les logs PostgreSQL
|
||||||
|
docker-compose logs postgres
|
||||||
|
|
||||||
|
# Vérifier le container
|
||||||
|
docker-compose ps postgres
|
||||||
|
|
||||||
|
# Redémarrer PostgreSQL seul
|
||||||
|
docker-compose restart postgres
|
||||||
|
```
|
||||||
|
|
||||||
|
### Migration échoue
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Voir les logs détaillés
|
||||||
|
docker-compose logs notes-app | grep -A 50 "migration"
|
||||||
|
|
||||||
|
# Relancer la migration manuellement
|
||||||
|
docker exec -e SQLITE_PATH=/app/data-sqlite/notes.db \
|
||||||
|
notes-todo-app node scripts/migrate-sqlite-to-postgres.js
|
||||||
|
```
|
||||||
|
|
||||||
|
### Application ne démarre pas
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Voir les logs complets
|
||||||
|
docker-compose logs notes-app
|
||||||
|
|
||||||
|
# Vérifier les variables d'environnement
|
||||||
|
docker exec notes-todo-app env | grep DATABASE
|
||||||
|
|
||||||
|
# Rebuild complet
|
||||||
|
docker-compose down
|
||||||
|
docker-compose build --no-cache
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### Données manquantes après migration
|
||||||
|
|
||||||
|
**Vos données SQLite sont toujours là!** `./data/notes.db`
|
||||||
|
|
||||||
|
Pour revenir temporairement à SQLite (debug):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Arrêter les containers
|
||||||
|
docker-compose down
|
||||||
|
|
||||||
|
# 2. Modifier temporairement config/database.js
|
||||||
|
cp config/database-sqlite-backup.js config/database.js
|
||||||
|
|
||||||
|
# 3. Rebuild et restart
|
||||||
|
docker-compose build notes-app
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
Puis re-migrez proprement une fois le problème identifié.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📚 Documentation complète
|
||||||
|
|
||||||
|
- **`POSTGRESQL-ONLY.md`** - Guide complet PostgreSQL
|
||||||
|
- **`MIGRATION-STEPS.md`** - Détails techniques migration
|
||||||
|
- **`RECUPERATION-DONNEES.md`** - En cas de perte apparente de données
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎯 Résumé en 1 ligne
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose build && docker-compose up -d && docker-compose logs -f notes-app
|
||||||
|
```
|
||||||
|
|
||||||
|
**Attendez que la migration se termine, puis accédez à http://localhost:2222** 🚀
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Date:** 2025-11-14
|
||||||
|
**Commit:** 6b5f408 - BREAKING: Migration complète vers PostgreSQL uniquement
|
||||||
|
**Branch:** claude/update-rss-feeds-011CV6EZDsWAUqbRHZR1117Q
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✨ Avantages de PostgreSQL
|
||||||
|
|
||||||
|
Vous bénéficiez maintenant de:
|
||||||
|
|
||||||
|
- ✅ **Performance:** Meilleure gestion des requêtes complexes
|
||||||
|
- ✅ **Concurrence:** Support multi-utilisateurs optimisé
|
||||||
|
- ✅ **Fiabilité:** Transactions ACID complètes
|
||||||
|
- ✅ **Évolutivité:** Prêt pour la production
|
||||||
|
- ✅ **Fonctionnalités:** Full-text search, JSON, etc.
|
||||||
|
- ✅ **Monitoring:** Outils PostgreSQL standard
|
||||||
|
- ✅ **Backup:** Solutions professionnelles disponibles
|
||||||
|
|
||||||
|
**Bienvenue dans le monde PostgreSQL!** 🐘
|
||||||
Reference in new issue
Block a user