Security (CRITICAL): - Add .env.example with strong password generation instructions - Fix path traversal validation in restore.sh (now detects all .. patterns) - Secure .env loading with set -a/set +a in all scripts - Add logs/ to .gitignore to prevent credential leaks Backup & Restore (IMPORTANT): - Add file locking system to prevent concurrent backups - Add disk space verification before backup operations - Generate SHA256 checksums for all backups - Verify checksums before restoration - Create safety database backup before restore - Implement comprehensive logging to ./logs/ directory - Fix BACKUP_RETENTION_DAYS inconsistency - Replace dangerous find -delete with safe iteration Update & Recovery: - Backup docker-compose.yml before updates with auto-rollback - Add version display before/after updates - Increase timeouts to 120s for slow containers - Dynamic backup suggestion in recover.sh Compatibility: - Add Docker Compose v2 support with v1 fallback in all scripts - Standardized log() function across all scripts New Features: - Add check-health.sh: comprehensive system health monitoring - Add SECURITY.md: complete security documentation - Update Makefile with check-health and recover commands - Centralized logging with timestamps and levels 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
80 lines
2.5 KiB
Makefile
80 lines
2.5 KiB
Makefile
.PHONY: help up down restart logs ps occ backup restore update health check-health recover
|
|
|
|
include .env
|
|
export
|
|
|
|
help:
|
|
@echo "Nextcloud Docker - Commandes disponibles:"
|
|
@echo ""
|
|
@echo "Services:"
|
|
@echo " make up - Démarrer tous les services Docker"
|
|
@echo " make down - Arrêter et supprimer les containers"
|
|
@echo " make restart - Redémarrer tous les services"
|
|
@echo " make ps - Lister les containers actifs"
|
|
@echo " make logs - Afficher les logs Nextcloud en temps réel"
|
|
@echo ""
|
|
@echo "Maintenance:"
|
|
@echo " make backup - Backup complet (DB + fichiers + config)"
|
|
@echo " → Active mode maintenance"
|
|
@echo " → Sauvegarde MariaDB, config, données, apps"
|
|
@echo " → Désactive mode maintenance"
|
|
@echo " → Archive dans ./backups/"
|
|
@echo ""
|
|
@echo " make update - Mise à jour Nextcloud (avec backup auto)"
|
|
@echo " → Backup de sécurité automatique"
|
|
@echo " → Pull nouvelle image Docker"
|
|
@echo " → Restart avec nouvelle version"
|
|
@echo " → Upgrade base de données"
|
|
@echo " → Optimisations post-update"
|
|
@echo ""
|
|
@echo " make restore <file> - Restaurer depuis un backup"
|
|
@echo " → Arrêt des services"
|
|
@echo " → Restauration DB + fichiers"
|
|
@echo " → Redémarrage et réparation"
|
|
@echo ""
|
|
@echo "Outils:"
|
|
@echo " make occ <cmd> - Exécuter une commande OCC Nextcloud"
|
|
@echo " make health - Vérifier l'état (Nextcloud + DB + config)"
|
|
|
|
up:
|
|
docker-compose up -d
|
|
|
|
down:
|
|
docker-compose down
|
|
|
|
restart:
|
|
docker-compose restart
|
|
|
|
logs:
|
|
docker-compose logs -f --tail=100 nextcloud
|
|
|
|
ps:
|
|
docker-compose ps
|
|
|
|
occ:
|
|
@bash scripts/occ.sh $(filter-out $@,$(MAKECMDGOALS))
|
|
|
|
backup:
|
|
@bash scripts/backup.sh
|
|
|
|
restore:
|
|
@bash scripts/restore.sh $(filter-out $@,$(MAKECMDGOALS))
|
|
|
|
update:
|
|
@bash scripts/update.sh
|
|
|
|
health:
|
|
@docker-compose exec nextcloud php occ status
|
|
@docker-compose exec nextcloud php occ config:list system
|
|
@docker-compose exec -T db sh -c 'mysql -u"$$MYSQL_USER" -p"$$MYSQL_PASSWORD" -e "SELECT 1"' 2>/dev/null && echo "✅ Base de données accessible" || echo "❌ Erreur base de données"
|
|
|
|
check-health:
|
|
@bash scripts/check-health.sh
|
|
|
|
recover:
|
|
@bash scripts/recover.sh
|
|
|
|
# Catch-all target pour permettre les arguments aux commandes occ et restore
|
|
%:
|
|
@:
|