From 5ca00065e6d77990a8bc04e7d412a27eb1cf088a Mon Sep 17 00:00:00 2001 From: M_Kececi Date: Tue, 17 Feb 2026 13:18:21 +0300 Subject: [PATCH] fix(deploy): stabilize sass-embedded and runtime env files --- deploy/deploy.sh | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/deploy/deploy.sh b/deploy/deploy.sh index 21e019e..3de80bf 100644 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -11,6 +11,15 @@ LOG_FILE="/var/log/bssapp_deploy.log" APP_DIR="/opt/bssapp" LOCK_FILE="/tmp/bssapp_deploy.lock" +ensure_runtime_env_files() { + # Bazı unit dosyaları EnvironmentFile olarak bu path'leri bekliyor. + # Dosyalar yoksa systemd "Failed to load environment files" ile düşüyor. + [[ -f "$APP_DIR/.env" ]] || touch "$APP_DIR/.env" + [[ -f "$APP_DIR/mail.env" ]] || touch "$APP_DIR/mail.env" + [[ -f "$APP_DIR/svc/.env" ]] || touch "$APP_DIR/svc/.env" + [[ -f "$APP_DIR/svc/mail.env" ]] || touch "$APP_DIR/svc/mail.env" +} + build_api_binary() { if ! command -v go >/dev/null 2>&1; then echo "go command not found; cannot build backend binary." @@ -44,28 +53,18 @@ run_deploy() { cd "$APP_DIR/ui" npm ci --no-audit --no-fund --include=optional - # npm scriptlerinde PATH onceligi nedeniyle node_modules/.bin/sass kullanilir. - # Bu dosya pure JS olursa --embedded hata verir; global Dart Sass binary'sine bagliyoruz. - SASS_BIN="$(command -v sass || true)" - if [[ -z "$SASS_BIN" ]]; then - echo "sass command not found in PATH." - return 1 - fi - "$SASS_BIN" --embedded --version >/dev/null 2>&1 || { - echo "Global sass supports --embedded is not available." - return 1 - } - ln -sf "$SASS_BIN" "$APP_DIR/ui/node_modules/.bin/sass" - "$APP_DIR/ui/node_modules/.bin/sass" --embedded --version >/dev/null 2>&1 || { - echo "node_modules/.bin/sass still does not support --embedded." - return 1 - } + # Linux'ta sass --embedded hatasını engellemek için + # deploy sırasında çalışan node_modules ağacına doğrudan yazıyoruz. + npm i -D --no-audit --no-fund sass-embedded@1.93.2 npm run build echo "== BUILD API ==" build_api_binary + echo "== ENSURE ENV FILES ==" + ensure_runtime_env_files + echo "== RESTART SERVICE ==" systemctl restart bssapp