← 전체로 돌아가기
프로젝트 메모 network -home-son-prj-thesis

papergen v2 두 머신 아키텍처

papergen GPU/웹 서버 분리, SSH로 자동화 제어.

distributed-architecturenginxsystemdsshpython

papergen v2 아키텍처 (두 머신)

GPU 서버 (son-pro6000, 192.168.1.116) - ~/prj/thesis에 프로젝트, .venv (Python 3.10.19, torch+CUDA). - 발행 논문마다 systemd 서비스 (papergen-[id].service) 띄움. marimo run 포트 27000~27999. - papergen/state.py가 포트 할당 관리.

웹/엣지 서버 (son-wtr, 192.168.1.121) - nginx/thesis/[id]/ 요청을 http://192.168.1.116:[포트]로 프록시. - /etc/nginx/snippets/learn-papers/[id].conf에 논문별 프록시 설정. - /var/www/learn.ericfromkorea.com/thesis/index.html에 static index page.

son-pro6000에서 papergen/publish.py 실행 시 son-wtr에 SSH (son@192.168.1.121, 키 인증) 접속함. ~/.ssh/id_ed25519 키 사용. son-wtrauthorized_keys에 등록됨. - nginx snippet 작성, nginx reload, index push 작업 수행.

왜 분리했나? GPU 연산은 son-pro6000에 고정. Public IP, certs, nginx는 son-wtr에 고정. 서로 역할이 다름.

디버깅할 때: 서비스 상태/셀 에러

ssh 192.168.1.116 sudo journalctl -u papergen-[id].service

HTTP/HTTPS/nginx 상태

curl https://learn.ericfromkorea.com/thesis/[id]/

DNS/인증서 갱신은 son-wtr에서 certbot timer 확인.

여기서 배울 것

  1. GPU/웹 서버 역할 분리해서 프로젝트 돌리는 구조.
  2. `systemd` 서비스, `nginx` 프록시로 웹 서비스 구성.
  3. SSH 키 인증으로 서버 간 자동화 통신 구현함.
  4. 분산 시스템 디버깅은 각 서버 역할 맞춰 로그 확인.
원본 파일 보기 (.claude/projects/-home-son-prj-thesis/memory/architecture.md)
---
name: papergen v2 two-machine architecture
description: How the thesis project is split across son-pro6000 (GPU) and son-wtr (web), so future sessions don't try to reconfigure on one machine
type: project
originSessionId: a80e3f6f-bf8c-4ef5-93e8-e5c44239beaa
---
papergen runs on **son-pro6000 (192.168.1.116)** — the GPU server (RTX Pro 6000):
- Project: `~/prj/thesis` with `.venv` (Python 3.10.19, torch+CUDA13+transformers).
- One systemd service per published paper (`papergen-<id>.service`), `marimo run` on a port in 27000~27999.
- `papergen/state.py` holds the port allocation table (`state/state.json`).

nginx + Let's Encrypt cert + DNS-pointed public IP live on **son-wtr (192.168.1.121)** — the web/edge box:
- nginx site `/etc/nginx/sites-enabled/learn.ericfromkorea.com` proxies `/thesis/<id>/` to `http://192.168.1.116:<port>`.
- Per-paper proxy snippets in `/etc/nginx/snippets/learn-papers/<id>.conf`.
- Static index page at `/var/www/learn.ericfromkorea.com/thesis/index.html`.

`papergen/publish.py` runs on son-pro6000 but reaches out to son-wtr over SSH (`son@192.168.1.121`, key auth) to write the nginx snippet, reload nginx, and push the index. The SSH key was generated at `~/.ssh/id_ed25519` on son-pro6000 and added to son-wtr's `authorized_keys`.

**Why:** GPU compute can't move (it's only on son-pro6000), and the public IP / certs / nginx are pinned to son-wtr. So we split.

**How to apply:** Don't try to do everything on one box. When debugging a published paper:
- Service status / cell errors → `ssh 192.168.1.116 sudo journalctl -u papergen-<id>.service`
- HTTP/HTTPS / nginx status → on son-wtr (this current host) or `curl https://learn.ericfromkorea.com/thesis/<id>/`
- DNS / cert renewal → son-wtr's certbot timer