RESTAPI_SERVER/start-server.bat

95 lines
2.5 KiB
Batchfile
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.

@echo off
chcp 65001 >nul
echo ========================================
echo 🚀 REST API 서버 시작
echo ========================================
echo.
REM Docker 설치 및 실행 확인
docker --version >nul 2>&1
if %errorlevel% neq 0 (
echo ❌ Docker가 설치되지 않았습니다.
echo Docker Desktop을 설치해주세요: https://www.docker.com/products/docker-desktop
pause
exit /b 1
)
docker info >nul 2>&1
if %errorlevel% neq 0 (
echo ❌ Docker Desktop이 실행되지 않았습니다.
echo Docker Desktop을 시작해주세요.
pause
exit /b 1
)
echo ✅ Docker가 정상적으로 실행 중입니다.
echo.
REM 기존 컨테이너 정리
echo 🧹 기존 컨테이너 정리 중...
docker stop restapi-server >nul 2>&1
docker rm restapi-server >nul 2>&1
REM 이미지 빌드 (캐시 무시하여 최신 코드 반영)
echo 🏗️ Docker 이미지 빌드 중... (최신 코드 반영)
echo 캐시를 무시하고 처음부터 빌드합니다.
docker build --no-cache -t restapi-server:latest .
if %errorlevel% neq 0 (
echo ❌ 이미지 빌드 실패!
pause
exit /b 1
)
REM 서버 시작
echo 🚀 서버 시작 중...
docker run -d ^
--name restapi-server ^
--restart unless-stopped ^
-p 5577:5577 ^
-e NODE_ENV=production ^
-e DB_HOST=39.117.244.52 ^
-e DB_PORT=11521 ^
-e DB_DATABASE=XE ^
-e DB_USERNAME=wace ^
-e DB_PASSWORD=wace0909!! ^
-e PORT=5577 ^
restapi-server:latest
if %errorlevel% neq 0 (
echo ❌ 서버 시작 실패!
pause
exit /b 1
)
echo.
echo ========================================
echo 🎉 서버가 성공적으로 시작되었습니다!
echo ========================================
echo.
echo 📱 웹 UI: http://localhost:5577
echo 🔐 관리자: admin / admin123!
echo.
echo Oracle DB 연결 실패 시 자동으로 Mock DB를 사용합니다.
echo.
REM 서버 시작 대기 및 상태 확인
echo 🕐 서버 시작 대기 중... (15초)
timeout /t 15 /nobreak >nul
echo 🔍 서버 상태 확인 중...
curl -s http://localhost:5577/api/health >nul 2>&1
if %errorlevel% equ 0 (
echo ✅ 서버가 정상적으로 실행 중입니다!
echo 🌐 브라우저에서 http://localhost:5577 을 열어보세요!
) else (
echo ⚠️ 서버가 아직 시작 중일 수 있습니다.
echo 잠시 후 http://localhost:5577 을 확인해보세요.
)
echo.
echo 📊 유용한 명령어:
echo 로그 확인: docker logs -f restapi-server
echo 서버 중지: stop-server.bat
echo 컨테이너 상태: docker ps
echo.
pause