deployer: 배포 안정성 개선 — 헬스체크 실패 exit 1 + rsync 에러 핸들링 수정

- deploy.sh: 헬스체크 실패 시 exit 1 반환 (성공/실패 로그 추적 가능)
- deploy.sh: 릴리즈 백업에서 data/ 디렉토리 제외 (디스크 절약)
- deploy-nas.sh: rsync || [...] && true 셸 구문 오류 수정 (올바른 에러 핸들링)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-06 22:12:04 +09:00
parent cd292b2632
commit d9bfd04c76
2 changed files with 32 additions and 5 deletions

View File

@@ -33,11 +33,23 @@ cd "$SRC"
RSYNC_OPTS="-rl --delete --no-owner --no-group --exclude .git --exclude __pycache__ --exclude *.pyc --exclude data/"
for dir in backend travel-proxy deployer stock-lab music-lab blog-lab realestate-lab nginx scripts; do
rsync $RSYNC_OPTS "$SRC/$dir/" "$DST/$dir/" || [ $? -eq 23 ] && true
rsync $RSYNC_OPTS "$SRC/$dir/" "$DST/$dir/" || {
rc=$?
if [ $rc -ne 23 ]; then
echo "rsync failed for $dir with exit code $rc"
exit $rc
fi
}
done
# compose 파일만 동기화 (.env는 절대 동기화하지 않음 — 운영 시크릿 보호)
rsync -rl --no-owner --no-group "$SRC/docker-compose.yml" "$DST/docker-compose.yml" || [ $? -eq 23 ] && true
rsync -rl --no-owner --no-group "$SRC/docker-compose.yml" "$DST/docker-compose.yml" || {
rc=$?
if [ $rc -ne 23 ]; then
echo "rsync failed for docker-compose.yml with exit code $rc"
exit $rc
fi
}
# 파일 권한 설정 — bgg8988:users 755
# 호스트(bgg8988)에서는 본인 소유 파일만 변경 가능, deployer 컨테이너(root)에서는 전부 가능