feat(phase-0): scaffold backend + web + docker + DB schema

- docker-compose.yml: timescaledb-ha (timescaledb 2.27 + vectorscale + pgvector + pgai)
  + backend (FastAPI, CUDA 12.1) + web (Next.js 14)
- docker-compose.gpu.yml: GPU profile overlay for RTX 3070 Ti
- build.bat: Windows bootstrap, auto-detects nvidia-smi and selects GPU/CPU compose
- backend: Dockerfile, pyproject.toml, FastAPI skeleton with /health and /health/db
- DB migration 001_init.sql: symbols (with trigram search), ohlcv_daily/1m (hypertables),
  macro_daily, trading_value_daily, news (vector embedding), predictions
  (with user_triggered flag for on-demand UX), prediction_outcomes, model_performance
- web: Next.js 14 + Tailwind + lightweight-charts placeholder
- README: KIS/DART/HuggingFace token issuance guides + 10 seed tickers + run instructions
This commit is contained in:
tkrmagid
2026-05-20 14:37:35 +09:00
parent 619dc7811b
commit cacddf5adf
30 changed files with 852 additions and 0 deletions

81
build.bat Normal file
View File

@@ -0,0 +1,81 @@
@echo off
REM stock_chart_site - Windows 빌드/기동 스크립트
REM 더블클릭하면 .env 준비 -> GPU 감지 -> docker compose up
setlocal enabledelayedexpansion
cd /d "%~dp0"
echo === stock_chart_site bootstrap ===
REM 1) .env 준비
if not exist .env (
echo .env not found. Copying .env.example -> .env
copy /Y .env.example .env >nul
echo - 키 발급 안내는 README.md 참조. 비워둬도 pykrx 만으로 일단 동작합니다.
)
REM 2) Docker 설치 / 실행 확인
where docker >nul 2>&1
if errorlevel 1 (
echo [ERROR] docker 명령을 찾을 수 없습니다. Docker Desktop 설치/실행을 확인하세요.
pause
exit /b 1
)
docker info >nul 2>&1
if errorlevel 1 (
echo [ERROR] Docker Desktop이 실행 중이 아닙니다.
pause
exit /b 1
)
REM 3) GPU 감지
set USE_GPU=0
where nvidia-smi >nul 2>&1
if not errorlevel 1 (
nvidia-smi >nul 2>&1
if not errorlevel 1 set USE_GPU=1
)
if "%USE_GPU%"=="1" (
echo [GPU] NVIDIA GPU detected. Using GPU profile.
set COMPOSE_FILES=-f docker-compose.yml -f docker-compose.gpu.yml
) else (
echo [CPU] NVIDIA GPU not detected. Falling back to CPU mode.
echo Docker Desktop ^> Settings ^> Resources ^> WSL Integration ^> GPU support 를 켜면 GPU 사용 가능합니다.
set COMPOSE_FILES=-f docker-compose.yml
)
REM 4) Build + up
echo.
echo === docker compose build ===
docker compose %COMPOSE_FILES% build
if errorlevel 1 (
echo [ERROR] build 실패.
pause
exit /b 1
)
echo.
echo === docker compose up -d ===
docker compose %COMPOSE_FILES% up -d
if errorlevel 1 (
echo [ERROR] up 실패.
pause
exit /b 1
)
echo.
echo === 상태 ===
docker compose %COMPOSE_FILES% ps
echo.
echo 접속:
echo Web http://localhost:3000
echo Backend http://localhost:8000/health
echo DB ext http://localhost:8000/health/db
echo.
echo 로그 보기: docker compose logs -f backend
echo 정지: docker compose down
echo.
pause
endlocal