chore(backend): deploy.sh — 고객사 -12 배포 한 방(env 보강·migrate·시드 import·렌더·재시작·확인)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
lee-hyeon-cheol
2026-09-21 16:13:48 +09:00
co-authored by Claude Fable 5.1
parent 2e7bae4c06
commit 5c78edcaa5
2 changed files with 36 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# 고객사 -12 배포 — git pull 뒤 이 폴더에서: bash deploy.sh
# .env 새 키 채움 → migrate → 시드 import(seed/snippets.db 있을 때) → OpenCode 설정 렌더 → 재시작 → 확인
set -euo pipefail
cd "$(dirname "$0")"
export PYTHONUTF8=1
# .env 에 새 키 없으면 추가(있으면 그대로)
grep -q '^AAF_FABRIX_VISION_MODEL_ID=' .env || echo 'AAF_FABRIX_VISION_MODEL_ID=605' >> .env
grep -q '^DB_SSLMODE=' .env || echo 'DB_SSLMODE=disable' >> .env
grep -q '^STREAM_FIRST_EVENT_TIMEOUT_S=' .env || echo 'STREAM_FIRST_EVENT_TIMEOUT_S=300' >> .env
grep -q '^AAF_FABRIX_READ_TIMEOUT_S=' .env || echo 'AAF_FABRIX_READ_TIMEOUT_S=300' >> .env
grep -q '^ABAP_INDEX_URL=' .env || echo 'ABAP_INDEX_URL=http://127.0.0.1:8100' >> .env
sed -i 's/^AAF_FABRIX_MODEL_ID=.*/AAF_FABRIX_MODEL_ID=339/; s/^AAF_FABRIX_MODELS=.*/AAF_FABRIX_MODELS=339:GaussO Flash,581:GaussO Think,605:Gemma4/' .env
.venv/bin/python manage.py migrate --noinput
[ -f seed/snippets.db ] && .venv/bin/python manage.py import_snippets seed/snippets.db
.venv/bin/python opencode/render_opencode.py
pkill -f "opencode-bin serve" || true; pkill -f "uvicorn config.asgi" || true; sleep 1
mkdir -p logs
(cd opencode && nohup /www/opencode-bin serve --hostname 127.0.0.1 --port 4096 > ../logs/opencode.log 2>&1 &)
nohup .venv/bin/uvicorn config.asgi:application --host 0.0.0.0 --port 8080 > logs/django.log 2>&1 &
sleep 4
echo "--- health"; curl -s http://127.0.0.1:8080/api/v1/health | head -c 80; echo
echo "--- models"; curl -s http://127.0.0.1:8080/api/ito/models | head -c 120; echo
echo "--- tools (abap_index 3개면 OK)"; curl -s "http://127.0.0.1:4096/experimental/tool/ids?directory=$(pwd)/opencode" | tr ',' '\n' | grep -c abap_index || true