fix: stable webhook deploy (EPIPE safe)

This commit is contained in:
M_Kececi
2026-02-17 11:44:32 +03:00
parent 3eac743225
commit 68790c9f4e

View File

@@ -1,40 +1,83 @@
#!/bin/bash #!/bin/bash
set -e set -euo pipefail
LOG=/var/log/bssapp_deploy.log ################################
# CONFIG
################################
APP_DIR="/opt/bssapp"
UI_DIR="$APP_DIR/ui"
LOG="/var/log/bssapp_deploy.log"
exec >> $LOG 2>&1 ################################
# LOG
################################
exec >> "$LOG" 2>&1
echo "==============================" echo "=============================="
echo "🚀 DEPLOY START $(date)" echo "🚀 DEPLOY START $(date)"
echo "==============================" echo "=============================="
cd /opt/bssapp cd "$APP_DIR"
################################
# STOP SERVICE
################################
echo "== STOP SERVICE ==" echo "== STOP SERVICE =="
systemctl stop bssapp || true systemctl stop bssapp || true
################################
# GIT SYNC
################################
echo "== GIT SYNC ==" echo "== GIT SYNC =="
git fetch origin git fetch origin
git reset --hard origin/master git reset --hard origin/master
git clean -fdx git clean -fdx
################################
# BUILD UI
################################
echo "== BUILD UI ==" echo "== BUILD UI =="
cd ui
npm install
npm run build
cd ..
cd "$UI_DIR"
# Node path garanti
export PATH=$PATH:/usr/bin:/usr/local/bin
# Sessiz install
echo "--- NPM INSTALL ---"
npm ci --silent --no-progress
# Sessiz build (EPIPE fix)
echo "--- QUASAR BUILD ---"
npx quasar build --silent
################################
# COPY UI
################################
echo "== COPY UI ==" echo "== COPY UI =="
rm -rf svc/public/*
cp -r ui/dist/spa/* svc/public/
rm -rf "$APP_DIR/svc/public"/*
cp -r dist/spa/* "$APP_DIR/svc/public/"
################################
# BUILD BACKEND
################################
echo "== BUILD BACKEND ==" echo "== BUILD BACKEND =="
cd svc
go build -o bssapp
cd ..
cd "$APP_DIR/svc"
go build -o bssapp
################################
# START SERVICE
################################
echo "== START SERVICE ==" echo "== START SERVICE =="
systemctl start bssapp systemctl start bssapp
echo "✅ DEPLOY DONE $(date)" ################################
# DONE
################################
echo "=============================="
echo "✅ DEPLOY FINISHED"
echo "=============================="