Initial commit: Organized PTC project structure with .gitignore and README

This commit is contained in:
2026-03-23 14:44:39 +09:00
commit 35ababe236
21 changed files with 8921 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
@echo off
setlocal EnableExtensions EnableDelayedExpansion
set "PROJECT_DIR=/home/hyein/project"
set "WEB_PORT=8000"
set "API_PORT=4000"
net session >nul 2>&1
if not "%errorlevel%"=="0" (
echo 관리자 권한으로 다시 실행합니다...
powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
exit /b
)
echo WSL IP 확인 중...
for /f "usebackq delims=" %%i in (`wsl.exe bash -lc "hostname -I | cut -d' ' -f1"`) do (
set "WSL_IP=%%i"
)
if "%WSL_IP%"=="" (
echo WSL IP를 확인하지 못했습니다.
pause
exit /b 1
)
echo WSL IP: %WSL_IP%
echo 기존 서버 정리 및 재실행 중...
wsl.exe bash -lc "pkill -f 'python3 -m http.server 8000' >/dev/null 2>&1 || true; pkill -f '/home/hyein/project/server/ptc_api_server.py' >/dev/null 2>&1 || true; nohup python3 -m http.server 8000 --directory /home/hyein/project >/tmp/ptc_web.log 2>&1 & nohup python3 /home/hyein/project/server/ptc_api_server.py >/tmp/ptc_api.log 2>&1 & sleep 2"
echo 포트포워딩 갱신 중...
netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=%WEB_PORT% >nul 2>&1
netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=%API_PORT% >nul 2>&1
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=%WEB_PORT% connectaddress=%WSL_IP% connectport=%WEB_PORT%
if errorlevel 1 (
echo 8000 포트포워딩 설정에 실패했습니다.
pause
exit /b 1
)
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=%API_PORT% connectaddress=%WSL_IP% connectport=%API_PORT%
if errorlevel 1 (
echo 4000 포트포워딩 설정에 실패했습니다.
pause
exit /b 1
)
echo 방화벽 규칙 적용 중...
netsh advfirewall firewall delete rule name="PTC 8000" >nul 2>&1
netsh advfirewall firewall delete rule name="PTC 4000" >nul 2>&1
netsh advfirewall firewall add rule name="PTC 8000" dir=in action=allow protocol=TCP localport=%WEB_PORT% >nul
netsh advfirewall firewall add rule name="PTC 4000" dir=in action=allow protocol=TCP localport=%API_PORT% >nul
echo 서버 상태 확인 중...
wsl.exe bash -lc "curl -s http://127.0.0.1:4000/api/health >/tmp/ptc_api_health.json && curl -I -s http://127.0.0.1:8000/PTC/ >/tmp/ptc_web_health.txt"
if errorlevel 1 (
echo WSL 내부 서버 확인에 실패했습니다.
echo /tmp/ptc_api.log 와 /tmp/ptc_web.log 를 확인해 주세요.
pause
exit /b 1
)
echo.
echo 공유 준비 완료
echo 메인 화면: http://172.16.40.36:%WEB_PORT%/PTC/
echo API 안내 : http://172.16.40.36:%API_PORT%/
echo.
echo 참고: WSL이 재시작되어 IP가 바뀌면 이 파일을 다시 실행하세요.
pause