fix(deploy): rsync 대신 tar|ssh 방식으로 전환 (Synology rsync --server 차단 우회)
Synology가 rsync 바이너리를 패치하여 --server 모드도 데몬 인증을 요구함. SSH는 정상 동작하므로 tar czf | ssh로 대체하여 배포 가능하도록 수정. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -67,16 +67,23 @@ if (isWin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const portOpt = cleanPort ? `-p ${cleanPort}` : "";
|
const portOpt = cleanPort ? `-p ${cleanPort}` : "";
|
||||||
// -e 인자는 단따옴표로 감싸야 -i 경로의 공백/따옴표 충돌을 방지
|
// Synology는 rsync --server 모드를 별도 인증으로 막음 → tar | ssh 방식 사용
|
||||||
const sshCmd = `ssh ${portOpt} -i ${keyFile} -o StrictHostKeyChecking=accept-new -o BatchMode=yes`
|
const sshBase = `ssh ${portOpt} -i ${keyFile} -o StrictHostKeyChecking=accept-new -o PreferredAuthentications=publickey`
|
||||||
.replace(/\s+/g, " ").trim();
|
.replace(/\s+/g, " ").trim();
|
||||||
|
|
||||||
console.log(`Deploying via SSH → ${cleanTarget}:${cleanPath}`);
|
console.log(`Deploying via tar|ssh → ${cleanTarget}:${cleanPath}`);
|
||||||
console.log(`SSH command: ${sshCmd}`);
|
|
||||||
|
// 1단계: 원격 디렉토리 초기화
|
||||||
execSync(
|
execSync(
|
||||||
`rsync -r --delete --delete-delay -e '${sshCmd}' ${src}/ ${cleanTarget}:${cleanPath}`,
|
`${sshBase} ${cleanTarget} "rm -rf '${cleanPath}'/* 2>/dev/null; mkdir -p '${cleanPath}'"`,
|
||||||
{ stdio: "inherit" }
|
{ stdio: "inherit" }
|
||||||
);
|
);
|
||||||
|
// 2단계: 빌드 산출물 tar로 전송 → 원격에서 압축 해제
|
||||||
|
execSync(
|
||||||
|
`cd ${src} && tar czf - . | ${sshBase} ${cleanTarget} "cd '${cleanPath}' && tar xzf -"`,
|
||||||
|
{ stdio: "inherit" }
|
||||||
|
);
|
||||||
|
console.log("Deploy complete.");
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user