나스 서비스 준비

This commit is contained in:
2026-06-22 19:52:45 +09:00
parent 2ecf6201c0
commit 331d6c5fe9
7 changed files with 46 additions and 21 deletions

View File

@@ -17,7 +17,7 @@ cp .env.example .env
| `JWT_SECRET` | 32자 이상 랜덤 문자열 (필수) |
| `ADMIN_EMAIL` | 최초 관리자 이메일 |
| `ADMIN_PASSWORD` | 최초 관리자 비밀번호 (8자+) |
| `WEB_PORT` | 웹 노출 포트 (기본 `8080`) |
| `WEB_PORT` | 웹 노출 포트 (기본 `44082`, 기존 정적 사이트 포트 유지) |
| `CORS_ORIGINS` | 옆 프로젝트 도메인 포함, 쉼표 구분 |
예시:
@@ -26,13 +26,13 @@ cp .env.example .env
JWT_SECRET=your-random-secret-at-least-32-chars
ADMIN_EMAIL=admin@uniare.sori.studio
ADMIN_PASSWORD=your-secure-password
WEB_PORT=8080
CORS_ORIGINS=https://uniare.sori.studio,https://your-other-app.sori.studio,http://localhost:8080,http://localhost:5500,http://127.0.0.1:5500
WEB_PORT=44082
CORS_ORIGINS=https://uniare.sori.studio,https://your-other-app.sori.studio,http://localhost:44082,http://127.0.0.1:44082,http://localhost:5500,http://127.0.0.1:5500
```
## 3. 로컬 테스트
> **한 줄 요약:** 프로젝트 루트에서 `npm start` → 브라우저 **http://localhost:8080**
> **한 줄 요약:** 프로젝트 루트에서 `npm start` → 브라우저 **http://localhost:44082**
회원가입·로그인·덱 저장은 **API 서버**가 떠 있어야 합니다.
HTML만 Live Server 등으로 열면 저장·로그인이 **405** 로 실패합니다.
@@ -41,7 +41,7 @@ HTML만 Live Server 등으로 열면 저장·로그인이 **405** 로 실패합
```bash
npm start # 백그라운드 실행 (터미널 점유 안 함)
# 브라우저: http://localhost:8080
# 브라우저: http://localhost:44082
npm run logs # 로그 보기 (종료: Ctrl+C)
npm stop # 서버 종료
@@ -57,10 +57,10 @@ npm stop # 서버 종료
### 저장이 안 될 때
1. `curl http://localhost:8080/api/v1/health` → `{"ok":true,...}` 가 나와야 함
1. `curl http://localhost:44082/api/v1/health` → `{"ok":true,...}` 가 나와야 함
2. 안 나오면 `npm start` 다시 실행
3. `npm run dev` 후 `Healthy`에서 멈춘 것처럼 보여도 **정상**이지만, `Ctrl+C`하면 서버가 꺼짐 → **`npm start` 사용 권장**
4. Live Server(`:5500`)로 HTML만 연 경우 → 아래 방법 B 또는 **반드시 `:8080` 사용**
4. Live Server(`:5500`)로 HTML만 연 경우 → 아래 방법 B 또는 **반드시 `:44082` 사용**
### 방법 A — Docker (`npm start`와 동일)
@@ -68,7 +68,7 @@ npm stop # 서버 종료
npm start
```
브라우저: **http://localhost:8080** (Live Server 포트가 아님)
브라우저: **http://localhost:44082** (Live Server 포트가 아님)
### 방법 B — API만 로컬 실행 (Live Server / Cursor 미리보기 사용 시)
@@ -115,7 +115,7 @@ docker compose up -d --build
확인:
```bash
curl http://localhost:8080/api/v1/health
curl http://localhost:44082/api/v1/health
# → {"ok":true,"version":"4.0.0"}
```
@@ -126,11 +126,14 @@ curl http://localhost:8080/api/v1/health
### 옵션 A — `uadeck-web` 포트만 프록시 (권장)
```
https://uniare.sori.studio → http://NAS_IP:8080
https://uniare.sori.studio → http://NAS_IP:44082
```
`uadeck-web` 컨테이너가 `/api/`와 정적 파일을 모두 처리합니다.
`docker-compose.prod.yml`은 프로젝트 루트 전체를 웹 루트로 열지 않고, 필요한 HTML·정적 폴더만 read-only로 마운트합니다.
따라서 `.env`, `.git`, `api/`, `docs/` 같은 내부 파일은 Nginx에서 직접 노출되지 않습니다.
### 옵션 B — 기존 정적 호스팅 + API만 Docker
1. `docker compose up -d` (API만, 포트 3000)
@@ -171,7 +174,7 @@ docker cp uadeck-api:/data/uadeck.db ./backup/uadeck-$(date +%Y%m%d).db
## 8. 카드/이미지 업데이트
`datas/`, `images/`, HTML 파일은 **볼륨 마운트**이므로:
`datas/`, `images/`, HTML 파일은 **허용된 경로만 read-only 볼륨 마운트**이므로:
1. Git pull (또는 파일 동기화)
2. **재빌드 불필요** — 브라우저 새로고침만으로 반영