Files
web-page-backend/scripts/deploy-nas.sh
gahusb 8b916194aa deployer: blog-lab 서비스 배포 스크립트에 추가
rsync 대상, docker compose up, 헬스체크에 blog-lab 포함

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 20:05:14 +09:00

44 lines
1.3 KiB
Bash

#!/bin/bash
set -euo pipefail
# 1. 자동 감지: Docker 컨테이너 내부인가?
if [ -d "/repo" ] && [ -d "/runtime" ]; then
echo "Detected Docker Container environment."
SRC="/repo"
DST="/runtime"
else
# 2. Host 환경: .env 로드 시도
if [ -f ".env" ]; then
echo "Loading .env file..."
set -a; source .env; set +a
fi
# 환경변수가 없으면 현재 디렉토리를 SRC로
SRC="${REPO_PATH:-$(pwd)}"
DST="${RUNTIME_PATH:-}"
if [ -z "$DST" ]; then
echo "Error: RUNTIME_PATH is not set. Please create .env file with RUNTIME_PATH defined."
exit 1
fi
fi
echo "Source: $SRC"
echo "Target: $DST"
cd "$SRC"
# 레포에서 운영으로 반영할 항목들만 복사/동기화 (필요한 것만 적기)
# backend, travel-proxy, deployer, nginx, scripts, docker-compose.yml, .env 등
RSYNC_EXCLUDES="--exclude .git --exclude __pycache__ --exclude *.pyc --exclude data/"
for dir in backend travel-proxy deployer stock-lab music-lab blog-lab nginx scripts; do
rsync -a --delete $RSYNC_EXCLUDES \
"$SRC/$dir/" "$DST/$dir/"
done
# compose 파일만 동기화 (.env는 절대 동기화하지 않음 — 운영 시크릿 보호)
rsync -a "$SRC/docker-compose.yml" "$DST/docker-compose.yml"
echo "SYNC_OK"