From b1c52ad1b36013c652d5176187be84b1927b0857 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Wed, 21 Jan 2026 13:33:30 +0100 Subject: [PATCH] deploy --- .gitea/workflows/deploy.yml | 51 ++++++++++++------------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 15be4ee..86087f3 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -16,7 +16,7 @@ jobs: - name: Install tools run: | apt-get update - apt-get install -y docker.io openssh-client + apt-get install -y docker.io openssh-client rsync - name: Login to registry env: @@ -44,7 +44,7 @@ jobs: chmod 600 ~/.ssh/id_ed25519 ssh-keyscan -H alpha.mintel.me >> ~/.ssh/known_hosts - - name: Sync docker-compose file to server + - name: Sync files to server run: | echo "Checking for docker-compose file..." @@ -60,42 +60,26 @@ jobs: echo "Found and syncing: $COMPOSE_FILE" - # Verzeichnis vorbereiten - ssh -i ~/.ssh/id_ed25519 \ - -o StrictHostKeyChecking=no \ - -o ServerAliveInterval=60 \ - -o ServerAliveCountMax=5 \ - -o TCPKeepAlive=yes \ - deploy@alpha.mintel.me \ + COMMON_SSH_OPTS="-o StrictHostKeyChecking=no -o ServerAliveInterval=30 -o ServerAliveCountMax=6 -o TCPKeepAlive=yes -o ConnectTimeout=30" + + ssh -i ~/.ssh/id_ed25519 $COMMON_SSH_OPTS deploy@alpha.mintel.me \ "mkdir -p /home/deploy/sites/klz-cables.com && chmod 775 /home/deploy/sites/klz-cables.com" - # Datei kopieren mit KeepAlive - scp -i ~/.ssh/id_ed25519 \ - -o StrictHostKeyChecking=no \ - -o ServerAliveInterval=60 \ - -o ServerAliveCountMax=5 \ - -o TCPKeepAlive=yes \ - "$COMPOSE_FILE" \ - deploy@alpha.mintel.me:/home/deploy/sites/klz-cables.com/"$COMPOSE_FILE" + # rsync für Compose-Datei + rsync -avz --progress \ + -e "ssh -i ~/.ssh/id_ed25519 $COMMON_SSH_OPTS" \ + "$COMPOSE_FILE" deploy@alpha.mintel.me:/home/deploy/sites/klz-cables.com/"$COMPOSE_FILE" # varnish optional if [ -d "./varnish" ]; then - scp -r -i ~/.ssh/id_ed25519 \ - -o StrictHostKeyChecking=no \ - -o ServerAliveInterval=60 \ - -o ServerAliveCountMax=5 \ - -o TCPKeepAlive=yes \ + rsync -avz --progress \ + -e "ssh -i ~/.ssh/id_ed25519 $COMMON_SSH_OPTS" \ varnish/ deploy@alpha.mintel.me:/home/deploy/sites/klz-cables.com/ echo "varnish synced" fi - # Rechte + Log-Nachweis - ssh -i ~/.ssh/id_ed25519 \ - -o StrictHostKeyChecking=no \ - -o ServerAliveInterval=60 \ - -o ServerAliveCountMax=5 \ - -o TCPKeepAlive=yes \ - deploy@alpha.mintel.me \ + # Rechte + Log + ssh -i ~/.ssh/id_ed25519 $COMMON_SSH_OPTS deploy@alpha.mintel.me \ "chmod 664 /home/deploy/sites/klz-cables.com/$COMPOSE_FILE && \ ls -la /home/deploy/sites/klz-cables.com/ && \ stat /home/deploy/sites/klz-cables.com/$COMPOSE_FILE && \ @@ -106,12 +90,9 @@ jobs: REGISTRY_USER: ${{ secrets.REGISTRY_USER }} REGISTRY_PASS: ${{ secrets.REGISTRY_PASS }} run: | - ssh -i ~/.ssh/id_ed25519 \ - -o StrictHostKeyChecking=no \ - -o ServerAliveInterval=60 \ - -o ServerAliveCountMax=5 \ - -o TCPKeepAlive=yes \ - -o IPQoS=0x00 deploy@alpha.mintel.me " + COMMON_SSH_OPTS="-o StrictHostKeyChecking=no -o ServerAliveInterval=30 -o ServerAliveCountMax=6 -o TCPKeepAlive=yes -o ConnectTimeout=30 -o IPQoS=0x00" + + ssh -i ~/.ssh/id_ed25519 $COMMON_SSH_OPTS deploy@alpha.mintel.me " set -e echo 'Logging in to registry...'