Update deploy.sh for native deployment

This commit is contained in:
2026-06-10 12:54:09 +02:00
parent ec2797e8d0
commit 1b87810af8
+9 -10
View File
@@ -1,8 +1,7 @@
#!/bin/bash
set -e
REPO_DIR="/opt/aufmassweb"
COMPOSE_FILE="docker-compose.deploy.yml"
APP_DIR="/opt/aufmassweb/_aufmass_web"
LOG_FILE="/var/log/aufmassweb-deploy.log"
log() {
@@ -11,18 +10,18 @@ log() {
log "=== Deployment gestartet ==="
cd "$REPO_DIR"
cd "$APP_DIR"
log "Pull von Gitea..."
git pull origin main 2>&1 | tee -a "$LOG_FILE"
cd /opt/aufmassweb && git pull origin main 2>&1 | tee -a "$LOG_FILE"
log "Docker Compose build..."
docker compose -f "$COMPOSE_FILE" build 2>&1 | tee -a "$LOG_FILE"
log "Pip install..."
cd "$APP_DIR" && source venv/bin/activate && pip install --no-cache-dir -r requirements.txt 2>&1 | tee -a "$LOG_FILE"
log "Docker Compose up (Rolling-Restart)..."
docker compose -f "$COMPOSE_FILE" up -d --remove-orphans 2>&1 | tee -a "$LOG_FILE"
log "DB-Migration..."
cd "$APP_DIR" && source venv/bin/activate && flask db upgrade 2>&1 | tee -a "$LOG_FILE" || echo "No migration needed"
log "Alte Images bereinigen..."
docker image prune -f 2>&1 | tee -a "$LOG_FILE"
log "Restart..."
systemctl restart aufmassweb 2>&1 | tee -a "$LOG_FILE"
log "=== Deployment erfolgreich abgeschlossen ==="