Add Apple container deployment for daemon + dashboard

install-apple-container.sh builds and (re)starts both containers
(dashboard mounts reports/ read-only, port 8090); --boot installs a
LaunchAgent since Apple container has no restart policy. README covers
the new deploy path, SearXNG settings, and the dashboard.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jsahn
2026-09-01 00:59:07 +09:00
co-authored by Claude Fable 5
parent f7b8d895c3
commit a482a0a3e3
3 changed files with 100 additions and 0 deletions
+23
View File
@@ -57,9 +57,14 @@ cp .env.example .env # MINIMAX_API_KEY 필수, TELEGRAM_* 선택
| 환경 | 방법 |
|---|---|
| macOS | `bash deploy/install-launchd.sh` (launchd, KeepAlive) |
| macOS (Apple container) | `bash deploy/install-apple-container.sh` — 데몬+대시보드 빌드·기동. `--boot`를 붙이면 로그인 시 자동 기동(LaunchAgent) 등록 |
| Linux | `deploy/us2kr.service` → `systemctl enable --now us2kr` |
| Docker | `docker compose -f deploy/compose.yaml up -d --build` |
Apple container(`brew install container`)는 restart 정책이 없어 재부팅 후 자동 기동은 `--boot`의
LaunchAgent(`container system start` + `container start us2kr`)가 담당합니다.
`data/` `reports/` `logs/`는 호스트 디렉터리를 그대로 마운트하므로 launchd 방식과 산출물 위치가 같습니다.
> macOS 노트북은 **잠자기 중에는 실행되지 않습니다.** 06~07시에 깨어 있도록
> `sudo pmset repeat wakeorpoweron MTWRFS 06:00:00` 로 예약 기동을 걸거나, 항상 켜진 머신/서버에서 돌리세요.
@@ -76,6 +81,8 @@ cp .env.example .env # MINIMAX_API_KEY 필수, TELEGRAM_* 선택
| `US2KR_CATCHUP_WINDOW_HOURS` | `3` | 재시작 시 따라잡기 허용 창 |
| `US2KR_SKIP_WHEN_KRX_CLOSED` | `false` | 한국 휴장일에 다음 미국 세션이 먼저 마감되어 브리핑이 무의미해질 때만 스킵(금요일 세션은 항상 발송) |
| `US2KR_NEWS_LOOKBACK_HOURS` / `US2KR_NEWS_MAX_ITEMS` | `18` / `40` | 뉴스 수집 범위 |
| `SEARXNG_BASE_URL` | — | 있으면 RSS 외에 SearXNG 뉴스 검색 결과도 병합 (인스턴스에 `json` 포맷 활성화 필요) |
| `US2KR_SEARXNG_QUERIES` | 기본 검색어 3개 | SearXNG 검색어 CSV (기본: `us2kr/collectors/searx.py`의 `DEFAULT_QUERIES`) |
| `US2KR_KRX_EXTRA_HOLIDAYS` | — | 캘린더에 없는 한국 임시휴장일 CSV (예: `2026-06-03`) |
## 산출물
@@ -84,6 +91,22 @@ cp .env.example .env # MINIMAX_API_KEY 필수, TELEGRAM_* 선택
- `data/us2kr.sqlite3` — 시세 스냅샷·리포트·발송 기록(전일 대비 비교, 중복 방지)
- `logs/us2kr.log` — 일자별 회전, API 키 마스킹
## 대시보드 (dashboard/)
쌓인 브리핑을 보는 웹 대시보드(TypeScript, 런타임 의존성 없는 Node 24 서버 + 번들 클라이언트).
`reports/*.json`만 읽는 읽기 전용 뷰라 데몬의 SQLite(WAL)와 절대 경합하지 않습니다.
- 최신 세션 요약 타일(S&P·나스닥·SOX·VIX·달러/원·10년물), 종목별 종가 추이 차트(표 전환 가능)
- 브리핑 목록/본문(Markdown 렌더, sanitize), 데이터 결측·오류 로그 표시
- Apple container 배포 시 함께 기동: `http://localhost:8090` (포트: `US2KR_DASHBOARD_PORT`)
```bash
cd dashboard
npm install
npm run build # tsc 타입체크 + esbuild 번들
US2KR_REPORTS_DIR=../reports npm start # http://localhost:8090
```
## 개발
```bash