Files
CODE_ASSISTANT/docs/tech/customer-repo-layout.md
T

67 lines
4.8 KiB
Markdown

# 고객사 repo 구조 · 배포 루틴 (2026-09-22 정리)
고객사(GHE, SAML)는 repo 를 **하나만** 줌. 우리 팀 프로젝트 둘(ABAP_OPENCODE, CODE_ASSISTANT)을 그 안에 폴더로 나눠 넣음.
로컬 개발 repo(sqnotes)는 그대로 각각 씀 — 고객사 repo 는 "배포용 사본".
## 폴더
```
/www/abap-ito/ ← -12·-13 VM 둘 다 여기로 clone (https, 계정+PAT 저장됨)
README.md
abap-specgen/ ← ABAP_OPENCODE 전부 (git mv 로 옮겨 히스토리 유지)
.gitignore ← 원래 루트 것이 그대로 따라옴. 경로 패턴은 이 폴더 기준
web/deploy/bare/.env ← -13 설정 (bare 모드). git 밖
web/deploy/bare/run.sh ← -13 기동/중지/상태. "자기 위치 3단계 위" = abap-specgen/ 이 ROOT
bin/ logs/ run/ workspace/ web/BE/code/.venv … ← 런타임(git 밖). ROOT 밑에 있어야 run.sh 가 찾음
code-assistant/ ← CODE_ASSISTANT (zip 반입 → 우리 로컬 히스토리는 없음)
.gitignore
5_django_backend/.env ← -12 설정. git 밖
5_django_backend/deploy.sh ← -12 배포 한 방
5_django_backend/.venv, opencode/wiki, opencode/.opencode/node_modules ← git 밖
```
- `.env` 는 폴더마다 따로. 둘 다 gitignore. **커밋 전 `git status --short | grep '\.env$'` 가 비어야 함.**
- `-12`(code-assistant) 와 `-13`(abap-specgen) 은 서로 통신 안 함. 각자 GHE 만 봄.
## 배포 루틴 — 환경별 스크립트 하나씩
| | 고객사(도커 없음, bare) | 우리 환경 20.200.170.37 (도커) |
|---|---|---|
| code-assistant | `cd /www/abap-ito/code-assistant/5_django_backend && bash deploy.sh` (안에서 git pull) | `cd ~/codeassist/5_django_backend/deploy/docker && ./deploy.sh update` |
| abap-specgen | `bash /www/abap-ito/abap-specgen/web/deploy/bare/deploy.sh` (git pull → pip → restart) | `cd ~/abap-opencode/web/deploy && bash deploy.sh update` |
| Phoenix | `deploy/phoenix/run.sh` (pip, -12 안 8915) | `cd ~/codeassist/5_django_backend/deploy/phoenix && docker compose up -d` (`:6006`, 둘이 공유) |
우리 서버(20.200.170.37, `ssh pwc-rnd-aide-lab`, edge_user)는 고객사 repo 구조가 아니라 **우리 git 두 개를 각각 clone** 해둠: `~/abap-opencode`(ABAP_OPENCODE main), `~/codeassist`(CODE_ASSISTANT master).
컨테이너에서 같은 서버 Phoenix 는 `PHOENIX_HOST=http://host.docker.internal:6006`(compose 가 host-gateway 매핑). 바깥 포트 8080(CodeAssist)·6006(Phoenix)은 Azure NSG 에서 열어야 접근됨(2026-09-22 현재 80/22 만 열림).
-13 에서 `git pull` 이 "local changes would be overwritten" 로 막히면 서버에서 직접 고친 파일이 있는 것:
`git diff > /tmp/p.patch && git checkout -- . && git pull && git apply /tmp/p.patch`.
## 로컬 → 고객사 repo 로 코드 넣는 법 (code-assistant)
고객사 PC 는 우리 로컬 repo 에 못 붙음. 그래서 tracked 파일만 zip 으로 뽑아 덮어씀:
```bash
# 이 PC (CODE_ASSISTANT 루트)
git archive -o ~/Desktop/code-assistant_repo.zip --prefix=code-assistant/ HEAD
cp ~/Desktop/code-assistant_repo.zip ~/Desktop/code-assistant_repo.txt # 메일이 .zip 막음 → .txt 로
```
```powershell
# 고객사 PC, repo 루트 (PowerShell — Git Bash 없음)
Rename-Item code-assistant_repo.txt code-assistant_repo.zip
Remove-Item -Recurse -Force code-assistant; Expand-Archive code-assistant_repo.zip -DestinationPath . -Force; Remove-Item code-assistant_repo.zip
git add -A; git status --short | Where-Object { $_ -match '\.env$' } # 비어야 함
git commit -m "code-assistant: <뭐 바꿨나>"; git push
```
그 다음 -12 배포 루틴. 앱(msi)은 별개 — `4_rust_tauri` 빌드 → msi 를 1.2MB `.txt` 조각 4개로 → `copy /b` 로 합침.
## 2026-09-22 옮길 때 겪은 것
- Windows 에서 `git mv cline …` 이 "rename failed" 반복 → 폴더 잠금(탐색기/VS Code/백신). 재부팅 후 `.git/index.lock` 지우고 재시도.
- 한글 파일명 때문에 `git ls-tree` 출력이 `"\355…"` 로 나옴 → `git -c core.quotepath=false ls-tree`, PowerShell 은 `Test-Path -LiteralPath`.
- `git mv` 는 tracked 만 옮김. untracked(`.env`, venv, node_modules, logs)는 옛 자리에 남음 → 손으로 `cp -a` / `mv`.
- venv 스크립트(`.venv/bin/uvicorn` 등) shebang 에 옛 절대경로 박혀 있음 → `grep -rl 옛경로 .venv/bin | xargs sed -i 's#옛#새#g'`.
- 옛 프로세스가 포트(8080/8888/4096) 잡고 있어서 새 run.sh 가 "죽음" → `fuser -k 포트/tcp` 후 재기동.
- 고객사 메일이 `.zip` 첨부 자체를 막음 → 확장자만 `.txt` 로 바꾸면 통과(MD5 로 확인).
- GHE 가 SAML 이라 https clone 은 비밀번호 대신 PAT(`ghp_…`, Configure SSO → Authorize 필수). username 은 `~/.git-credentials` 에서 확인.