Fix server deploy: rsync submodules, local chatbotApp build, deploy flow.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Macbook
2026-07-23 13:46:25 +09:00
parent b23e96c412
commit 48a2e5815f
5 changed files with 150 additions and 38 deletions
+36 -3
View File
@@ -130,12 +130,48 @@ wait_remote_deploy() {
fi
}
sync_submodules_to_server() {
local rsync_script="${SERVER_DEV_DIR}/sync-submodules-rsync.sh"
[[ -x "${rsync_script}" ]] || fail "sync-submodules-rsync.sh 없음"
log "submodule 소스 → chatbot.exdev.co.kr rsync..."
EXDEV_SSH="${EXDEV_SSH}" "${rsync_script}"
}
trigger_remote_deploy() {
log "원격 monorepo checkout..."
ssh -o BatchMode=yes "${EXDEV_SSH}" \
"GIT_DIR=/Volumes/ADATA/gitea/data/gitea-repositories/aidev/exaichatbot_agent.git; \
WT=/Users/aidev/dev/exAichatbot_agent; \
git --work-tree=\"\${WT}\" --git-dir=\"\${GIT_DIR}\" checkout -f main; \
rm -f \"\${WT}/.git\" /tmp/exAichatbot_agent_deploy.lock"
sync_submodules_to_server
log "원격 deploy (빌드 + 기동)..."
ssh -o BatchMode=yes "${EXDEV_SSH}" \
"cp /Users/aidev/dev/exAichatbot_agent/server-dev/deploy.sh /Volumes/ADATA/git/deploy-exAichatbot_agent.sh 2>/dev/null || true; \
chmod +x /Volumes/ADATA/git/deploy-exAichatbot_agent.sh; \
export PATH=\"/opt/homebrew/bin:/Applications/Docker.app/Contents/Resources/bin:\$PATH\"; \
bash /Volumes/ADATA/git/deploy-exAichatbot_agent.sh --start-only" \
|| warn "원격 deploy 실패"
}
build_chatbot_app_for_deploy() {
log "chatbotApp 로컬 빌드 (서버 Next.js 대신 public/ 생성)..."
(
cd "${APP_DIR}/web"
npm ci --prefer-offline 2>/dev/null || npm install
)
bash "${APP_DIR}/build.sh"
[[ -f "${APP_DIR}/public/index.html" ]] || fail "chatbotApp public/ 빌드 실패"
}
deploy_from_local_mac() {
log "로컬 Mac → Gitea push → chatbot.exdev.co.kr 배포"
if ! $NO_PULL; then
sync_github_submodules "${ROOT_DIR}" || true
fi
build_chatbot_app_for_deploy
push_source_to_gitea
trigger_remote_deploy
wait_remote_deploy
log "=========================================="
log "원격 배포 요청 완료"
@@ -161,9 +197,6 @@ sync_source_from_git() {
fail "브랜치 없음: ${branch} (GIT_DIR=${GIT_DIR})"
fi
git --work-tree="${tree}" --git-dir="${GIT_DIR}" checkout -f "${branch}"
if [[ ! -e "${tree}/.git" ]]; then
echo "gitdir: ${GIT_DIR}" > "${tree}/.git"
fi
sync_github_submodules "${tree}" || true
local commit
commit="$(git --git-dir="${GIT_DIR}" rev-parse --short HEAD)"