Files
exAichatbot_agent/chatbotApp-chatbot2.0-agent/start.sh
T
Macbook 4b86b2a660 Agent 2.0 exdev 서버 배포 스택
- server-dev start/stop/deploy 및 Gitea push 자동 배포
- local-dev 로컬 개발 환경

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-21 22:57:30 +09:00

57 lines
2.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# chatbotApp 단독 웹서버 기동 (nginx + RAG API 프록시)
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
export PATH="/usr/local/bin:/Applications/Docker.app/Contents/Resources/bin:${PATH}"
PORT="${CHATBOT_APP_PORT:-8089}"
RAG_PORT="${RAG_API_PORT:-28012}"
export CHATBOT_API_UPSTREAM="${CHATBOT_API_UPSTREAM:-https://chatbot.exdev.co.kr/chatbot/}"
export CHATBOT_API_HOST="${CHATBOT_API_HOST:-chatbot.exdev.co.kr}"
log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*"; }
if ! docker info >/dev/null 2>&1; then
log "ERROR: Docker Engine 미기동"
exit 1
fi
# :8089 점유 시 Caddy/GoldenChart 등과 충돌 — chatbotApp 전용 포트 확보
if docker ps --format '{{.Names}} {{.Ports}}' 2>/dev/null | grep -E '8089->8089|:8089->8089' | grep -qv 'ex-chatbot-app-web'; then
log "⚠️ :8089 다른 컨테이너(Caddy 등) 점유 — docker stop ex-chatbot-caddy 후 재시도"
fi
docker compose up -d --force-recreate
sleep 2
APP_URL="http://127.0.0.1:${PORT}/chatbot/app/"
BODY="$(curl -sf --max-time 5 "$APP_URL" 2>/dev/null || true)"
if echo "$BODY" | grep -q 'data-chatbot-app="next-sse"'; then
log "✅ chatbotApp UI: ${APP_URL}"
elif echo "$BODY" | grep -qi 'GoldenChart'; then
log "❌ GoldenChart 화면 — :${PORT} 포트 충돌"
log " 1) docker stop ex-chatbot-caddy (CADDY_HTTP_PORT는 9089 권장)"
log " 2) cd chatbotApp && docker compose up -d --force-recreate"
log " 3) ${APP_URL} 재접속"
exit 1
else
log "⚠️ UI 미응답 — docker logs ex-chatbot-app-web"
fi
if curl -sf --max-time 10 "http://127.0.0.1:${PORT}/chatbot/health" >/dev/null 2>&1; then
log "✅ API 프록시 연결 가능 → ${CHATBOT_API_UPSTREAM}"
else
log "⚠️ API 프록시 미응답 — 원격 ${CHATBOT_API_UPSTREAM} 또는 네트워크 확인"
fi
if curl -sf --max-time 5 "http://127.0.0.1:${RAG_PORT}/chatbot/health" >/dev/null 2>&1; then
log "ℹ️ 로컬 RAG :${RAG_PORT} 기동 중 (프록시 대상 변경 시 CHATBOT_API_UPSTREAM 사용)"
fi
log "원격 API: ${CHATBOT_API_UPSTREAM}"
log "운영 URL (Caddy): https://chatbot.exdev.co.kr/chatbot/app/"