From 65804182abc59ed687d6c9b6fdf8413e4a0019fc Mon Sep 17 00:00:00 2001 From: Alexis Fourmaux Date: Fri, 8 May 2026 17:01:45 +0200 Subject: [PATCH] feat: add targets to clean deployment --- Makefile | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6ea28ca..42c5b0a 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ REMOTE = $(REMOTE_USER)@$(IP) DEST ?= /home/$(REMOTE_USER)/projet-agreg RSYNC_OPTS = -arvz --delete --exclude='__pycache__' --exclude='*.pyc' --exclude='.env' --exclude='.venv' --exclude='Makefile' --exclude='.git' --exclude='.vscode' --exclude='.gitignore' -.PHONY: deploy +.PHONY: deploy deploy-gw deploy-app clean-app clean-gw clean-all deploy-all: deploy-gw deploy-app @@ -22,4 +22,20 @@ deploy-gw: rsync $(RSYNC_OPTS) lora-gateway $(REMOTE):$(DEST) @echo "Déploiement terminé" ssh $(REMOTE) "cd $(DEST)/lora-gateway && docker compose up -d --force-recreate" - @echo "Services redémarrés" \ No newline at end of file + @echo "Services redémarrés" + +clean-app: + @echo "Nettoyage de l'app sur $(REMOTE):$(DEST)/app" + ssh $(REMOTE) "cd $(DEST)/app && docker compose down --volumes --remove-orphans || true" + ssh $(REMOTE) "rm -rf $(DEST)/app" + @echo "Nettoyage de l'application terminé" + +clean-gw: + @echo "Nettoyage de la gateway sur $(REMOTE):$(DEST)/lora-gateway" + ssh $(REMOTE) "cd $(DEST)/lora-gateway && docker compose down --volumes --remove-orphans || true" + ssh $(REMOTE) "rm -rf $(DEST)/lora-gateway" + @echo "Nettoyage de la gateway terminé" + +clean-all: clean-app clean-gw + ssh $(REMOTE) "docker system prune -f || true" + @echo "Nettoyage complet terminé" \ No newline at end of file