Deploy: GitHub submodule sync 2026-07-27 21:23:55

This commit is contained in:
Macbook
2026-07-27 21:23:55 +09:00
parent b461949266
commit 264954cc32
6 changed files with 77 additions and 5 deletions
+45 -1
View File
@@ -7,6 +7,9 @@
# ./git_fetch_all.sh --no-push # commit까지, push 생략 # ./git_fetch_all.sh --no-push # commit까지, push 생략
# ./git_fetch_all.sh --no-commit # fetch/merge만 (commit·push 생략) # ./git_fetch_all.sh --no-commit # fetch/merge만 (commit·push 생략)
# #
# commit 시 운영 WAS/RAG 기본 주소(172.16.180.130)를 복원합니다.
# exdev 로컬 주소(127.0.0.1 / host.docker.internal)는 .env·start 스크립트로만 사용합니다.
#
# 대상 (.gitmodules) — 모두 branch=chatbot2.0-agent (main 사용 안 함): # 대상 (.gitmodules) — 모두 branch=chatbot2.0-agent (main 사용 안 함):
# chatbotApi-chatbot2.0-agent # chatbotApi-chatbot2.0-agent
# chatbotApp-chatbot2.0-agent # chatbotApp-chatbot2.0-agent
@@ -40,7 +43,7 @@ for arg in "$@"; do
--no-commit) DO_COMMIT=false; DO_PUSH=false ;; --no-commit) DO_COMMIT=false; DO_PUSH=false ;;
--no-push) DO_PUSH=false ;; --no-push) DO_PUSH=false ;;
-h|--help) -h|--help)
sed -n '2,18p' "$0" sed -n '2,22p' "$0"
exit 0 exit 0
;; ;;
*) *)
@@ -107,6 +110,44 @@ restore_monorepo_overlays() {
fi fi
} }
# GitHub push 전: 로컬(exdev) WAS 주소를 커밋하지 않고 운영 기본값(172.16.180.130) 유지
PROD_WAS_API="http://172.16.180.130:8086/api"
PROD_RAG_CHAT="http://172.16.180.130:28012/agent/chat"
restore_production_endpoints_before_commit() {
local path="$1"
local dir="${ROOT_DIR}/${path}"
case "${path}" in
kakaoChatbotSkill-chatbot2.0-agent)
local yml="${dir}/src/main/resources/application.yml"
if [[ -f "${yml}" ]]; then
# ${ENV:default} 형태의 default 만 운영 IP로 고정 (실행 시 ENV 로컬 오버라이드는 유지)
perl -i -pe "s|CHATBOT_API_BASE_URL:[^}]+}|CHATBOT_API_BASE_URL:${PROD_WAS_API}/}|g" "${yml}"
perl -i -pe "s|RAG_AGENT_CHAT_URL:[^}]+}|RAG_AGENT_CHAT_URL:${PROD_RAG_CHAT}}|g" "${yml}"
# trailing slash normalize for api default
perl -i -pe "s|CHATBOT_API_BASE_URL:http://172\.16\.180\.130:8086/api/\}|CHATBOT_API_BASE_URL:http://172.16.180.130:8086/api/}|g" "${yml}"
fi
;;
exAiChatBot-chatbot2.0-agent)
if [[ -f "${dir}/env.template" ]]; then
perl -i -pe "s|^CHATBOT_API_BASE_URL=.*|CHATBOT_API_BASE_URL=${PROD_WAS_API}|" "${dir}/env.template"
fi
if [[ -f "${dir}/env.example" ]]; then
perl -i -pe "s|^CHATBOT_API_BASE_URL=.*|CHATBOT_API_BASE_URL=${PROD_WAS_API}|" "${dir}/env.example" 2>/dev/null || true
fi
if [[ -f "${dir}/scripts/agent/chatbot_tool_client.py" ]]; then
perl -i -pe 's|"http://127\.0\.0\.1:8086/api"|"http://172.16.180.130:8086/api"|g' \
"${dir}/scripts/agent/chatbot_tool_client.py"
perl -i -pe 's|"http://host\.docker\.internal:8086/api"|"http://172.16.180.130:8086/api"|g' \
"${dir}/scripts/agent/chatbot_tool_client.py"
fi
# monorepo overlay compose 는 push 대상에서 제외 (로컬 exdev 전용)
git -C "${dir}" checkout HEAD -- docker-compose.server.yml docker-compose.local.yml 2>/dev/null || true
;;
esac
}
submodule_is_cloned() { submodule_is_cloned() {
local path="$1" local path="$1"
[[ -e "${ROOT_DIR}/${path}/.git" ]] [[ -e "${ROOT_DIR}/${path}/.git" ]]
@@ -253,6 +294,9 @@ sync_one() {
# 5) 로컬 수정사항 commit # 5) 로컬 수정사항 commit
if $DO_COMMIT && repo_is_dirty; then if $DO_COMMIT && repo_is_dirty; then
log " 로컬 변경 commit..." log " 로컬 변경 commit..."
# push 전에 운영 WAS/RAG 기본 주소 복원 (exdev 로컬 주소는 .env / start 스크립트로만 사용)
restore_production_endpoints_before_commit "${path}"
log " 운영 엔드포인트 기본값 유지: ${PROD_WAS_API}"
git add -A git add -A
if git diff --cached --quiet; then if git diff --cached --quiet; then
log " staged 변경 없음 (ignore 된 파일만 있을 수 있음)" log " staged 변경 없음 (ignore 된 파일만 있을 수 있음)"
+4
View File
@@ -34,6 +34,10 @@ services:
LLM_BASE_URL: http://host.docker.internal:16000 LLM_BASE_URL: http://host.docker.internal:16000
TEI_EMBED_URL: http://host.docker.internal:16001 TEI_EMBED_URL: http://host.docker.internal:16001
TEI_RERANK_URL: http://host.docker.internal:16002 TEI_RERANK_URL: http://host.docker.internal:16002
# exdev: 호스트에서 기동한 chatbotApi(WAS). 운영 기본값(172.16.180.130)은 git push 대상 코드에만 유지.
CHATBOT_API_BASE_URL: ${CHATBOT_API_BASE_URL:-http://host.docker.internal:8086/api}
INTERNAL_TOOL_API_KEY: ${INTERNAL_TOOL_API_KEY:-exdev-agent-tool-key}
CHATBOT_TOOL_TIMEOUT: ${CHATBOT_TOOL_TIMEOUT:-60}
volumes: volumes:
- ./data:/app/data - ./data:/app/data
- ./scripts:/app/scripts - ./scripts:/app/scripts
+2 -2
View File
@@ -31,10 +31,10 @@ QDRANT_HOST=127.0.0.1
QDRANT_PORT=6333 QDRANT_PORT=6333
QDRANT_COLLECTION=qa_vectors_v2 QDRANT_COLLECTION=qa_vectors_v2
# ── Agent / WAS ── # ── Agent / WAS (Docker → 호스트 chatbotApi) ──
AGENT_MODE=agent AGENT_MODE=agent
AGENT_MAX_ROUNDS=6 AGENT_MAX_ROUNDS=6
CHATBOT_API_BASE_URL=http://127.0.0.1:8086/api CHATBOT_API_BASE_URL=http://host.docker.internal:8086/api
INTERNAL_TOOL_API_KEY=exdev-agent-tool-key INTERNAL_TOOL_API_KEY=exdev-agent-tool-key
CHATBOT_TOOL_TIMEOUT=60 CHATBOT_TOOL_TIMEOUT=60
+24
View File
@@ -339,10 +339,29 @@ stop_legacy_stack() {
} }
ensure_rag_env() { ensure_rag_env() {
# .env 키=값 갱신 (없으면 append)
patch_env() {
local key="$1" value="$2" tmp
tmp="$(mktemp)"
if [[ -f "${RAG_ENV}" ]]; then
grep -vE "^${key}=" "${RAG_ENV}" > "${tmp}" || true
else
: > "${tmp}"
fi
printf '%s\n%s=%s\n' "$(cat "${tmp}")" "${key}" "${value}" > "${RAG_ENV}"
rm -f "${tmp}"
}
if [[ ! -f "${RAG_ENV}" ]]; then if [[ ! -f "${RAG_ENV}" ]]; then
log ".env 없음 → env.exdev-server.template 복사" log ".env 없음 → env.exdev-server.template 복사"
cp "${ENV_TEMPLATE}" "${RAG_ENV}" cp "${ENV_TEMPLATE}" "${RAG_ENV}"
fi fi
# RAG(Docker) → 호스트 chatbotApi (exdev 로컬 WAS). 운영 IP(172.16.180.130) 사용 금지.
patch_env "CHATBOT_API_BASE_URL" "http://host.docker.internal:${WAS_PORT}/api"
patch_env "INTERNAL_TOOL_API_KEY" "${INTERNAL_TOOL_API_KEY}"
patch_env "CHATBOT_TOOL_TIMEOUT" "60"
log "RAG .env WAS: host.docker.internal:${WAS_PORT} (로컬 chatbotApi)"
} }
ensure_mongo() { ensure_mongo() {
@@ -392,11 +411,16 @@ start_rag() {
ensure_rag_env ensure_rag_env
ensure_rag_compose ensure_rag_compose
[[ -f "${COMPOSE_SERVER}" ]] || fail "docker-compose.server.yml 없음" [[ -f "${COMPOSE_SERVER}" ]] || fail "docker-compose.server.yml 없음"
# compose environment 보간 + 컨테이너 env (로컬 WAS)
export CHATBOT_API_BASE_URL="http://host.docker.internal:${WAS_PORT}/api"
export INTERNAL_TOOL_API_KEY="${INTERNAL_TOOL_API_KEY}"
export CHATBOT_TOOL_TIMEOUT="${CHATBOT_TOOL_TIMEOUT:-60}"
cd "${RAG_DIR}" cd "${RAG_DIR}"
docker compose -f "${COMPOSE_SERVER}" down --remove-orphans 2>/dev/null || true docker compose -f "${COMPOSE_SERVER}" down --remove-orphans 2>/dev/null || true
local -a up_flags=(-d) local -a up_flags=(-d)
if $NO_BUILD; then up_flags+=(--no-build); else up_flags+=(--build); fi if $NO_BUILD; then up_flags+=(--no-build); else up_flags+=(--build); fi
log "RAG 스택 기동 (docker-compose.server.yml)..." log "RAG 스택 기동 (docker-compose.server.yml)..."
log " CHATBOT_API_BASE_URL=${CHATBOT_API_BASE_URL}"
docker compose -f "${COMPOSE_SERVER}" up "${up_flags[@]}" docker compose -f "${COMPOSE_SERVER}" up "${up_flags[@]}"
wait_http "http://127.0.0.1:6333/collections" "Qdrant" 30 || true wait_http "http://127.0.0.1:6333/collections" "Qdrant" 30 || true
bootstrap_qdrant_if_empty bootstrap_qdrant_if_empty