From 6c1f19e6901960be05977dcbe91a458989805ab7 Mon Sep 17 00:00:00 2001 From: gahusb Date: Fri, 1 May 2026 09:48:37 +0900 Subject: [PATCH] =?UTF-8?q?fix(deploy):=20rsync=20=EB=8C=80=EC=8B=A0=20tar?= =?UTF-8?q?|ssh=20=EB=B0=A9=EC=8B=9D=EC=9C=BC=EB=A1=9C=20=EC=A0=84?= =?UTF-8?q?=ED=99=98=20(Synology=20rsync=20--server=20=EC=B0=A8=EB=8B=A8?= =?UTF-8?q?=20=EC=9A=B0=ED=9A=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Synology가 rsync 바이너리를 패치하여 --server 모드도 데몬 인증을 요구함. SSH는 정상 동작하므로 tar czf | ssh로 대체하여 배포 가능하도록 수정. Co-Authored-By: Claude Sonnet 4.6 --- scripts/deploy-nas.cjs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/deploy-nas.cjs b/scripts/deploy-nas.cjs index 6694e29..3a4d1af 100644 --- a/scripts/deploy-nas.cjs +++ b/scripts/deploy-nas.cjs @@ -67,16 +67,23 @@ if (isWin) { } const portOpt = cleanPort ? `-p ${cleanPort}` : ""; - // -e 인자는 단따옴표로 감싸야 -i 경로의 공백/따옴표 충돌을 방지 - const sshCmd = `ssh ${portOpt} -i ${keyFile} -o StrictHostKeyChecking=accept-new -o BatchMode=yes` + // Synology는 rsync --server 모드를 별도 인증으로 막음 → tar | ssh 방식 사용 + const sshBase = `ssh ${portOpt} -i ${keyFile} -o StrictHostKeyChecking=accept-new -o PreferredAuthentications=publickey` .replace(/\s+/g, " ").trim(); - console.log(`Deploying via SSH → ${cleanTarget}:${cleanPath}`); - console.log(`SSH command: ${sshCmd}`); + console.log(`Deploying via tar|ssh → ${cleanTarget}:${cleanPath}`); + + // 1단계: 원격 디렉토리 초기화 execSync( - `rsync -r --delete --delete-delay -e '${sshCmd}' ${src}/ ${cleanTarget}:${cleanPath}`, + `${sshBase} ${cleanTarget} "rm -rf '${cleanPath}'/* 2>/dev/null; mkdir -p '${cleanPath}'"`, { stdio: "inherit" } ); + // 2단계: 빌드 산출물 tar로 전송 → 원격에서 압축 해제 + execSync( + `cd ${src} && tar czf - . | ${sshBase} ${cleanTarget} "cd '${cleanPath}' && tar xzf -"`, + { stdio: "inherit" } + ); + console.log("Deploy complete."); process.exit(0); }