From 041af92306184da28fea9d40da8228729f78d23d Mon Sep 17 00:00:00 2001 From: rene Date: Wed, 29 Apr 2026 19:57:33 +0200 Subject: [PATCH] =?UTF-8?q?Feature:=20Staging-Workflow=20=E2=80=94=20devel?= =?UTF-8?q?op-Branch,=20make=20staging/release,=20APP=5FVERSION=201.0.0,?= =?UTF-8?q?=20Staging-Banner=20=E2=80=94=20SW=20by-v513?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 62 ++++++++++++++++++++++++----- backend/static/index.html | 9 +++++ backend/static/js/app.js | 13 +++++- backend/static/js/pages/settings.js | 4 +- backend/static/manifest.json | 1 + backend/static/sw.js | 2 +- docker-compose.staging.yml | 23 +++++++++++ 7 files changed, 100 insertions(+), 14 deletions(-) create mode 100644 docker-compose.staging.yml diff --git a/Makefile b/Makefile index b9ae067..8bc1dc6 100644 --- a/Makefile +++ b/Makefile @@ -4,15 +4,18 @@ # Git wird nur lokal auf dem Mac und für Forgejo-Backup genutzt. # ============================================================== -DS_HOST := ds -DS_IP := 10.47.11.10 +DS_HOST := ds +DS_IP := 10.47.11.10 # Hinweis: NPM braucht 10.47.11.99 als Forward-IP (Macvlan-Shim), nicht .10 -DS_SSH_PORT := 4711 -DS_PATH := /volume1/docker/banyaro -CONTAINER := banyaro # container_name (für docker logs/exec) -SERVICE := banyaro # service-name in docker-compose.yml (für docker compose restart) -GIT_REMOTE := origin -DOCKER := sudo /usr/local/bin/docker +DS_SSH_PORT := 4711 +DS_PATH := /volume1/docker/banyaro +DS_PATH_STAGING := /volume1/docker/banyaro-staging +CONTAINER := banyaro +CONTAINER_STAGING:= banyaro-staging +SERVICE := banyaro +GIT_REMOTE := origin +DOCKER := sudo /usr/local/bin/docker +VERSION ?= $(shell grep '"version"' backend/static/manifest.json | grep -o '[0-9]*\.[0-9]*\.[0-9]*' | head -1) # tar: was NICHT auf die DS übertragen wird TAR_EXCLUDE := --exclude='.git' \ @@ -23,7 +26,7 @@ TAR_EXCLUDE := --exclude='.git' \ --exclude='./*.db' \ --exclude='./.DS_Store' -.PHONY: help deploy deploy-clean sync push restart build stop status \ +.PHONY: help deploy deploy-clean staging release sync push restart build stop status \ logs logs-f shell db dev clean-cache check-ssh # ---------------------------------------------------------- @@ -106,6 +109,47 @@ deploy-clean: check-ssh @echo " ✓ Deploy fertig. Letzte Logs:" @ssh $(DS_HOST) "$(DOCKER) logs $(CONTAINER) --tail=15" +# ---------------------------------------------------------- +# STAGING — develop-Branch auf Staging deployen (Port 3012) +# ---------------------------------------------------------- +staging: check-ssh + @echo "→ Git push develop..." + @git push $(GIT_REMOTE) develop + @echo "→ Sync zu DS (Staging)..." + @COPYFILE_DISABLE=1 tar czf - $(TAR_EXCLUDE) . | ssh $(DS_HOST) "tar xzf - -C $(DS_PATH_STAGING)/" + @echo "→ Staging rebuild + restart..." + @ssh $(DS_HOST) " \ + cd $(DS_PATH_STAGING) && \ + $(DOCKER) compose -f docker-compose.staging.yml down && \ + $(DOCKER) compose -f docker-compose.staging.yml build && \ + $(DOCKER) compose -f docker-compose.staging.yml up -d" + @echo "" + @echo " ✓ Staging fertig — https://staging.banyaro.app" + @ssh $(DS_HOST) "$(DOCKER) logs $(CONTAINER_STAGING) --tail=10" + +# ---------------------------------------------------------- +# RELEASE — develop → main → Production (VERSION= pflichtangabe) +# Beispiel: make release VERSION=1.1.0 +# ---------------------------------------------------------- +release: check-ssh + @if [ -z "$(VERSION)" ]; then \ + echo "❌ Bitte VERSION setzen: make release VERSION=1.1.0"; exit 1; fi + @echo "→ Merge develop → main (v$(VERSION))..." + @git checkout main + @git merge develop --no-ff -m "Release v$(VERSION)" + @sed -i '' 's/"version": "[^"]*"/"version": "$(VERSION)"/' backend/static/manifest.json + @git add backend/static/manifest.json + @git commit --amend --no-edit + @git tag "v$(VERSION)" + @git push $(GIT_REMOTE) main --tags + @echo "→ Production deployen..." + @$(MAKE) deploy + @git checkout develop + @git merge main + @git push $(GIT_REMOTE) develop + @echo "" + @echo " ✓ Release v$(VERSION) veröffentlicht 🚀" + # ---------------------------------------------------------- # SYNC — nur Dateien zur DS übertragen, kein Docker-Rebuild # ACHTUNG: ALLE Dateien (CSS/JS/HTML/Python) sind ins Image gebacken! diff --git a/backend/static/index.html b/backend/static/index.html index 3f4acbb..82258db 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -94,6 +94,15 @@ + + +