Feature: Staging-Workflow — develop-Branch, make staging/release, APP_VERSION 1.0.0, Staging-Banner — SW by-v513
This commit is contained in:
parent
9d3f902014
commit
041af92306
7 changed files with 100 additions and 14 deletions
62
Makefile
62
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!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue