diff --git a/.forgejo/workflows/botserver.yaml b/.forgejo/workflows/botserver.yaml index 0af23dbd..cc9554f4 100644 --- a/.forgejo/workflows/botserver.yaml +++ b/.forgejo/workflows/botserver.yaml @@ -64,9 +64,22 @@ jobs: - name: Deploy via rsync run: | - ssh -o StrictHostKeyChecking=no system "pkill -f botserver || true; sleep 2; rm -f /opt/gbo/bin/botserver" - rsync -avz -e "ssh -o StrictHostKeyChecking=no" /opt/gbo/ci/botserver/target/debug/botserver system:/opt/gbo/bin/botserver 2>&1 | tee /tmp/deploy.log - ssh -o StrictHostKeyChecking=no system "chmod +x /opt/gbo/bin/botserver && chown gbuser:gbuser /opt/gbo/bin/botserver && cd /opt/gbo/bin && nohup sudo -u gbuser ./botserver --noconsole >> /opt/gbo/logs/error.log 2>&1 &" + echo "=== Deploy started ===" + echo "Checking binary exists..." + ls -lh /opt/gbo/ci/botserver/target/debug/botserver + echo "Killing old botserver..." + ssh -o StrictHostKeyChecking=no system "pkill -f botserver || true; sleep 2; rm -f /opt/gbo/bin/botserver && echo 'Old binary removed'" + echo "Starting rsync transfer..." + rsync -avz --progress -e "ssh -o StrictHostKeyChecking=no -v" /opt/gbo/ci/botserver/target/debug/botserver system:/opt/gbo/bin/botserver 2>&1 | tee /tmp/deploy.log + RSYNC_EXIT=${PIPESTATUS[0]} + echo "rsync exit code: $RSYNC_EXIT" + if [ "$RSYNC_EXIT" != "0" ]; then + echo "rsync FAILED with exit code $RSYNC_EXIT" + exit 1 + fi + echo "rsync SUCCESS, setting permissions..." + ssh -o StrictHostKeyChecking=no system "chmod +x /opt/gbo/bin/botserver && chown gbuser:gbuser /opt/gbo/bin/botserver && ls -lh /opt/gbo/bin/botserver && cd /opt/gbo/bin && nohup sudo -u gbuser ./botserver --noconsole >> /opt/gbo/logs/error.log 2>&1 &" + echo "=== Deploy completed ===" - name: Verify botserver started run: |