iop/apps/web/README.md

71 lines
2.7 KiB
Markdown

# web - Legacy IOP Web Portal
`apps/web`은 삭제 예정인 legacy Next.js 스캐폴드다. IOP Portal의 장기 UI 기준은 Flutter-first 앱이며, 웹 표면은 Flutter Web 산출물로 대체한다. 이 디렉터리에서 `/nodes`, `/models`, `/jobs` 같은 도메인 페이지를 새로 구현하지 않는다.
Control Plane과의 주요 통신은 edge-node에서 사용 중인 proto-socket을 IOP Wire Protocol 기준으로 확장한다. Portal-Control Plane은 Flutter mobile/desktop과 Flutter Web을 고려해 proto-socket WebSocket/WSS를 우선한다. 현재 TypeScript 클라이언트 TODO는 제품 경로로 확장하지 않는다.
## Migration
현재 최상위 작업은 `agent-ops/roadmap/milestones/flutter-first-portal-migration.md`다. 이 마일스톤에서 `apps/web`의 TypeScript/Next.js scaffold와 npm 기반 배포 흐름을 삭제하고, Docker/compose web 서비스는 Flutter Web build 산출물을 서빙하는 흐름으로 바꾼다.
## Local
웹 개발과 테스트는 기본적으로 호스트 환경에서 수행한다. Docker는 컨테이너 패키징과 compose 통합 확인이 필요할 때 사용한다.
필요한 런타임:
- Node.js `>=20.9.0`
- npm `>=10`
- Go toolchain
루트에서 Control Plane을 먼저 실행한다.
```bash
go run ./apps/control-plane/cmd/control-plane serve --config configs/control-plane.yaml
```
다른 터미널에서 Web Portal을 실행한다.
```bash
npm ci --prefix apps/web
./bin/web.sh
```
기본 호스트 endpoint는 코드 기본값과 `configs/control-plane.yaml` 기준을 따른다.
```bash
CONTROL_PLANE_INTERNAL_HTTP_URL=http://localhost:9080
NEXT_PUBLIC_CONTROL_PLANE_HTTP_URL=http://localhost:9080
NEXT_PUBLIC_CONTROL_PLANE_WIRE_URL=tcp://localhost:19080
```
호스트 검증은 다음 명령을 기준으로 한다.
```bash
cd apps/web
npm run verify
```
현재 `npm run verify`는 TypeScript check와 production build를 수행한다. Next.js 16 기준 lint는 `next lint`가 아니라 ESLint CLI(`eslint .`)를 사용한다. 아직 이 앱에는 ESLint 의존성, 설정 파일, `lint` script가 없으므로 lint는 필수 검증에 포함하지 않는다.
lint를 도입할 때는 다음 기준을 따른다.
- `eslint`, `eslint-config-next`와 flat config(`eslint.config.*`)를 함께 추가한다.
- `package.json`에는 `"lint": "eslint ."`를 추가한다.
- `verify``npm run check && npm run lint && npm run build` 순서로 갱신한다.
production standalone 실행을 확인할 때는 먼저 build를 만든 뒤 실행한다.
```bash
cd apps/web
npm run build
PORT=3000 HOSTNAME=0.0.0.0 npm run start
```
## Docker
Docker는 compose 기반 통합 확인이 필요할 때 루트에서 실행한다.
```bash
docker compose up --build
```