- App_Server/Dockerfile: Build-Context auf Repo-Root, COPY-Pfade angepasst, ENTRYPOINT aktiviert, dev-Stage mit inittypescriptdev.sh - NGINX_Server/Dockerfile: Multi-Stage mit frontend-Stage (Node.js baut TypeScript), statische Dateien und Config-Templates ins Image kopiert - docker-compose.base.yaml: Context auf '.', python-venv Volume entfernt, NGINX_STATIC_DIR/CONFIG_TEMPLATE_DIR bind-mounts in Dev verschoben - docker-compose.dev.yaml: python-venv-dev Volume, APP_DEBUG=true, nginx-proxy mit bind-mounts fuer statische Dateien und Templates - docker-compose.prod.yaml: Code-bind-mount entfernt, nginx-proxy extends - approot.py: absolute Pfade, Debug-Modus via APP_DEBUG Umgebungsvariable - init.sh: vereinfacht (kein cd/pip, absolute Pfade) - inireader.mjs: absoluter Pfad fuer config.ini - package.json: scripts.build (tsc + rollup) ergaenzt - .dockerignore, deploy-kbcrm-test.sh, deploy-kbcrm-prod.sh erstellt - docker-compose.save.yaml geloescht - env-sample: BUILD_ENVIRONMENT nach oben, Dev-only Variablen markiert Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
45 lines
1.3 KiB
Bash
45 lines
1.3 KiB
Bash
#!/bin/bash
|
|
# Deploy-Script: Promotion nach PROD (manuelles OK erforderlich)
|
|
# Wird manuell aufgerufen, nachdem test-prod verifiziert wurde.
|
|
# Voraussetzungen auf dem Server: git, docker, docker compose.
|
|
set -euo pipefail
|
|
|
|
# Konfiguration — an die jeweilige Server-Umgebung anpassen
|
|
REPO_DIR=/opt/kbcrm-prod/repo
|
|
COMPOSE_FILE=docker-compose.prod.yaml
|
|
ENV_FILE=/opt/kbcrm-prod/.env
|
|
PROD_PORT=443
|
|
|
|
echo "=== Deploy KB-CRM PROD ==="
|
|
|
|
# Sicherheitsabfrage — nur bei manueller Eingabe von "yes" wird fortgesetzt
|
|
echo "This will deploy to PRODUCTION. Continue? (yes/no)"
|
|
read -r confirmation
|
|
if [ "$confirmation" != "yes" ]; then
|
|
echo "Aborted."
|
|
exit 1
|
|
fi
|
|
|
|
# 1. Code aktualisieren
|
|
cd "$REPO_DIR"
|
|
echo "=== Pulling latest code ==="
|
|
git fetch origin main
|
|
git checkout main
|
|
git reset --hard origin/main
|
|
|
|
# 2. Images neu bauen und Container starten
|
|
echo "=== Building and starting containers ==="
|
|
docker compose --env-file "$ENV_FILE" -f "$COMPOSE_FILE" up -d --build
|
|
|
|
# 3. Health-Check
|
|
echo "=== Waiting for container startup ==="
|
|
sleep 10
|
|
if curl -sf "http://localhost:${PROD_PORT}/health-check" >/dev/null 2>&1; then
|
|
echo "Health check: OK"
|
|
else
|
|
echo "WARNING: Health check failed — check container logs with:"
|
|
echo " docker compose --env-file $ENV_FILE -f $COMPOSE_FILE logs"
|
|
fi
|
|
|
|
echo "=== Deploy PROD complete ==="
|