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.
|
# Git wird nur lokal auf dem Mac und für Forgejo-Backup genutzt.
|
||||||
# ==============================================================
|
# ==============================================================
|
||||||
|
|
||||||
DS_HOST := ds
|
DS_HOST := ds
|
||||||
DS_IP := 10.47.11.10
|
DS_IP := 10.47.11.10
|
||||||
# Hinweis: NPM braucht 10.47.11.99 als Forward-IP (Macvlan-Shim), nicht .10
|
# Hinweis: NPM braucht 10.47.11.99 als Forward-IP (Macvlan-Shim), nicht .10
|
||||||
DS_SSH_PORT := 4711
|
DS_SSH_PORT := 4711
|
||||||
DS_PATH := /volume1/docker/banyaro
|
DS_PATH := /volume1/docker/banyaro
|
||||||
CONTAINER := banyaro # container_name (für docker logs/exec)
|
DS_PATH_STAGING := /volume1/docker/banyaro-staging
|
||||||
SERVICE := banyaro # service-name in docker-compose.yml (für docker compose restart)
|
CONTAINER := banyaro
|
||||||
GIT_REMOTE := origin
|
CONTAINER_STAGING:= banyaro-staging
|
||||||
DOCKER := sudo /usr/local/bin/docker
|
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: was NICHT auf die DS übertragen wird
|
||||||
TAR_EXCLUDE := --exclude='.git' \
|
TAR_EXCLUDE := --exclude='.git' \
|
||||||
|
|
@ -23,7 +26,7 @@ TAR_EXCLUDE := --exclude='.git' \
|
||||||
--exclude='./*.db' \
|
--exclude='./*.db' \
|
||||||
--exclude='./.DS_Store'
|
--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
|
logs logs-f shell db dev clean-cache check-ssh
|
||||||
|
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
|
|
@ -106,6 +109,47 @@ deploy-clean: check-ssh
|
||||||
@echo " ✓ Deploy fertig. Letzte Logs:"
|
@echo " ✓ Deploy fertig. Letzte Logs:"
|
||||||
@ssh $(DS_HOST) "$(DOCKER) logs $(CONTAINER) --tail=15"
|
@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
|
# SYNC — nur Dateien zur DS übertragen, kein Docker-Rebuild
|
||||||
# ACHTUNG: ALLE Dateien (CSS/JS/HTML/Python) sind ins Image gebacken!
|
# ACHTUNG: ALLE Dateien (CSS/JS/HTML/Python) sind ins Image gebacken!
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,15 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<!-- Staging-Banner (nur auf staging.banyaro.app) -->
|
||||||
|
<div id="staging-banner"
|
||||||
|
style="display:none;position:fixed;top:0;left:0;right:0;z-index:10000;
|
||||||
|
background:#7c3aed;color:#fff;font-size:0.75rem;font-weight:700;
|
||||||
|
padding:5px 16px;align-items:center;justify-content:center;gap:8px;
|
||||||
|
letter-spacing:0.04em;text-transform:uppercase">
|
||||||
|
⚗️ Staging-Umgebung — Keine Produktionsdaten
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Offline-Banner -->
|
<!-- Offline-Banner -->
|
||||||
<div id="offline-banner" aria-live="polite"
|
<div id="offline-banner" aria-live="polite"
|
||||||
style="display:none;position:fixed;top:0;left:0;right:0;z-index:9999;
|
style="display:none;position:fixed;top:0;left:0;right:0;z-index:9999;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@
|
||||||
Router, State-Management, Navigation, Initialisierung.
|
Router, State-Management, Navigation, Initialisierung.
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const APP_VER = '489'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
const APP_VER = '490'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||||
|
const APP_VERSION = '1.0.0'; // ← semantische Version, wird bei make release gesetzt
|
||||||
|
const IS_STAGING = location.hostname === 'staging.banyaro.app';
|
||||||
|
|
||||||
const App = (() => {
|
const App = (() => {
|
||||||
|
|
||||||
|
|
@ -860,4 +862,11 @@ const App = (() => {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// App starten
|
// App starten
|
||||||
document.addEventListener('DOMContentLoaded', () => App.init());
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
if (IS_STAGING) {
|
||||||
|
const b = document.getElementById('staging-banner');
|
||||||
|
if (b) b.style.display = 'flex';
|
||||||
|
document.title = '⚗️ ' + document.title;
|
||||||
|
}
|
||||||
|
App.init();
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -334,7 +334,7 @@ window.Page_settings = (() => {
|
||||||
<span style="background:var(--c-surface-2);border:1px solid var(--c-border);
|
<span style="background:var(--c-surface-2);border:1px solid var(--c-border);
|
||||||
border-radius:100px;padding:2px 10px;font-family:monospace;
|
border-radius:100px;padding:2px 10px;font-family:monospace;
|
||||||
font-size:10px;color:var(--c-text-muted)">
|
font-size:10px;color:var(--c-text-muted)">
|
||||||
v${typeof APP_VER !== 'undefined' ? APP_VER : '—'}
|
v${typeof APP_VERSION !== 'undefined' ? APP_VERSION : '1.0.0'} <span style="opacity:0.5;font-size:10px">(${typeof APP_VER !== 'undefined' ? APP_VER : '—'})</span>
|
||||||
</span>
|
</span>
|
||||||
<button id="settings-check-update" style="background:none;border:none;cursor:pointer;
|
<button id="settings-check-update" style="background:none;border:none;cursor:pointer;
|
||||||
font-size:var(--text-xs);color:var(--c-primary);padding:2px 6px;
|
font-size:var(--text-xs);color:var(--c-primary);padding:2px 6px;
|
||||||
|
|
@ -588,7 +588,7 @@ window.Page_settings = (() => {
|
||||||
reg.waiting.postMessage({ type: 'SKIP_WAITING' });
|
reg.waiting.postMessage({ type: 'SKIP_WAITING' });
|
||||||
UI.toast.success('Update wird installiert…');
|
UI.toast.success('Update wird installiert…');
|
||||||
} else {
|
} else {
|
||||||
UI.toast.success('Ban Yaro ist aktuell (v' + (typeof APP_VER !== 'undefined' ? APP_VER : '—') + ').');
|
UI.toast.success('Ban Yaro ist aktuell — v' + (typeof APP_VERSION !== 'undefined' ? APP_VERSION : '1.0.0') + '.');
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
UI.toast.error('Update-Prüfung fehlgeschlagen.');
|
UI.toast.error('Update-Prüfung fehlgeschlagen.');
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"id": "/",
|
"id": "/",
|
||||||
|
"version": "1.0.0",
|
||||||
"name": "Ban Yaro — Die Hunde-Plattform",
|
"name": "Ban Yaro — Die Hunde-Plattform",
|
||||||
"short_name": "Ban Yaro",
|
"short_name": "Ban Yaro",
|
||||||
"description": "Alles rund um deinen Hund. Von Welpe bis Opa.",
|
"description": "Alles rund um deinen Hund. Von Welpe bis Opa.",
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Offline-Cache + Push Notifications + Tile-Cache
|
Offline-Cache + Push Notifications + Tile-Cache
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const CACHE_VERSION = 'by-v512';
|
const CACHE_VERSION = 'by-v513';
|
||||||
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
||||||
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
||||||
const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache
|
const CACHE_API = 'ban-yaro-api-v1'; // API-Response-Cache
|
||||||
|
|
|
||||||
23
docker-compose.staging.yml
Normal file
23
docker-compose.staging.yml
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
services:
|
||||||
|
banyaro-staging:
|
||||||
|
build: .
|
||||||
|
container_name: banyaro-staging
|
||||||
|
restart: on-failure:3
|
||||||
|
ports:
|
||||||
|
- "3012:8000"
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
- DB_PATH=/data/banyaro.db
|
||||||
|
- MEDIA_DIR=/data/media
|
||||||
|
- STAGING=true
|
||||||
|
- VAPID_PUBLIC_KEY=BMKbFAmpsqJ-eFef_4XJcYpuxPWqBNAoy9buMNnMSa6ijcPzltboHi_YccPKJrUD0isBez-vJIzAgjnLTWkzcC0
|
||||||
|
- VAPID_PRIVATE_KEY=8PWa9vvwMqtqsJEJGcwmiLhR0_Yl7duVX3wmWiKS878
|
||||||
|
- VAPID_CONTACT=mailto:admin@banyaro.app
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/')"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
Loading…
Add table
Add a link
Reference in a new issue