> For the complete documentation index, see [llms.txt](https://genos-docs.gitbook.io/default/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://genos-docs.gitbook.io/default/v1.9.5/basic-tutorials/guides/development/code_serving/deploy_code_serving.md).

# 코드 서빙 배포

코드 서빙은 **리비전** 단위로 배포합니다. 커밋을 골라 리비전을 만들고, 리비전 상세에서 배포를 신청한 뒤 결재를 받는 순서입니다. 이후 커밋·배포 정보를 어떻게 확인하는지도 알아보겠습니다.

### **1. 코드 서빙 상세 페이지 진입**

코드 서빙 목록에서 배포할 코드 서빙 행을 더블클릭해 상세 페이지로 들어갑니다.

<figure><img src="https://1442180325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVa1tsb4kzRuGbCJsMdPX%2Fuploads%2Fgit-blob-95d811fc069d68dca9b82ff86e9696c583b194d1%2Fc30.png?alt=media" alt=""><figcaption></figcaption></figure>

### **2. 리비전 추가**

우상단 **\[+ 리비전 추가]** 버튼을 누르면 「리비전 추가」 창이 열립니다.

<figure><img src="https://1442180325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVa1tsb4kzRuGbCJsMdPX%2Fuploads%2Fgit-blob-cf9265b77898efdbde080ffcd7c240396e85502f%2Fc31.png?alt=media" alt=""><figcaption></figcaption></figure>

다음 항목을 상황에 맞게 입력하시면 됩니다.

* **도커 이미지 \***: 리비전을 실행할 도커 이미지
* **인스턴스 타입 \***: CPU · 메모리 사양
* **GPU 할당량**: GPU가 필요하면 할당량과 개수를 선택
* **복제본 \***: 동시에 띄울 컨테이너 수 (정수)
* **브랜치 \***: 배포할 커밋이 있는 브랜치 (검색·선택)
* **커밋 해시 \***: 배포할 커밋. 돋보기 아이콘으로 커밋 변경 내용을 미리 볼 수 있습니다.

<figure><img src="https://1442180325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVa1tsb4kzRuGbCJsMdPX%2Fuploads%2Fgit-blob-06f8847862e8b28ed18bf9442d9d726ceb4d8609%2Fc32.png?alt=media" alt=""><figcaption></figcaption></figure>

설정 예시입니다. 작성을 완료하셨으면 \[생성]을 누르고 "리비전을 생성하시겠습니까?"에 확인하면 리비전이 만들어집니다. 만들어진 리비전은 \[리비전 목록] 탭에서 확인할 수 있습니다.

> 리비전을 만든 것만으로는 배포되지 않습니다. 다음 단계에서 리비전 상세의 \[배포]로 배포를 신청해야 합니다.

### **3. 배포 신청과 결재**

\[리비전 목록] 탭에서 리비전 행을 더블클릭해 **리비전 상세**로 들어간 뒤 우상단 **\[배포]** 를 누릅니다. "배포 신청 하시겠습니까?"에 확인하면 "배포 신청이 완료 되었습니다" 안내와 함께 리비전이 승인 대기 상태가 됩니다.

* 승인 대기 중에는 \[배포] 자리에 **\[배포 취소]** 가 표시되어 신청을 거둘 수 있습니다.
* 배포된 리비전은 \[중지]로 배포 중지 결재를 신청합니다("해당 리비전의 배포 중지 결재를 신청하시겠습니까?"). 중지 승인 대기 중에는 \[중지 취소]가 표시됩니다.

결재는 결재 권한을 가진 사용자가 메뉴에서 **운영 > 결재** 로 들어가 처리합니다. 리소스 필터에서 「코드 서빙」을 고르면 코드 서빙 결재만 모아 볼 수 있습니다.

<figure><img src="https://1442180325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVa1tsb4kzRuGbCJsMdPX%2Fuploads%2Fgit-blob-4d51cde65147293d61ba99c724e1d28e1892f09b%2Fc34.png?alt=media" alt=""><figcaption></figcaption></figure>

목록에서 배포를 승인하거나 반려할 수 있습니다. 반려되면 리비전 상세 \[기본 정보]에 반려 사유가 표시됩니다.

### **4. 커밋 정보 확인**

배포한 이후에는 실수로 브랜치를 삭제하시더라도 커밋 정보를 확인할 수 있습니다.

코드 스페이스에서 다음과 같이 입력하면 됩니다.

#### a. 코드 서빙 정보 확인

```python
import requests, textwrap

# === 사용자가 바꿀 값 2개 ===
BEARER_TOKEN_RAW = """
{AccessToken값}
""" # AccessToken 값을 넣으면 됩니다.
CODE_ID = 7 # git 저장소 주소를 보시면 llmops/7 이런 식으로 숫자가 있는데 숫자를 넣으면 됩니다.

# 줄바꿈/공백 제거
BEARER_TOKEN = "".join(BEARER_TOKEN_RAW.split())

BASE = "http://llmops-admin-api-service.llmops.svc.cluster.local:8080/api/admin"
url = f"{BASE}/serving/code/{CODE_ID}"

headers = {"Accept": "application/json", "Authorization": f"Bearer {BEARER_TOKEN}"}
response = requests.get(url, headers=headers, timeout=15)

print("GET", url)
print("status:", response.status_code)
print(textwrap.shorten(response.text, width=2000, placeholder=" ..."))
```

**출력 예시**

<figure><img src="https://1442180325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVa1tsb4kzRuGbCJsMdPX%2Fuploads%2Fgit-blob-ec8e3e40c61e7fb2c98b0015a934011680e8de50%2Fc35.png?alt=media" alt=""><figcaption></figcaption></figure>

코드 서빙 리소스와 기본 메타데이터를 조회할 수 있습니다.

#### b. 배포 정보 확인

```python
import requests, textwrap

# 토큰/대상 코드서빙 ID 설정
BEARER_TOKEN_RAW = """
{accessToken 값}
"""  # AccessToken 값을 넣으면 됩니다.
CODE_ID = 7 # git 저장소 주소를 보시면 llmops/7 이런 식으로 숫자가 있는데 숫자를 넣으면 됩니다.

BEARER_TOKEN = "".join(BEARER_TOKEN_RAW.split())

BASE = "http://llmops-admin-api-service.llmops.svc.cluster.local:8080/api/admin"
url = f"{BASE}/serving/code/{CODE_ID}/deployments"

headers = {"Accept": "application/json", "Authorization": f"Bearer {BEARER_TOKEN}"}
response = requests.get(url, headers=headers, timeout=15)

print("GET", url)
print("status:", response.status_code)
print(textwrap.shorten(response.text, width=2500, placeholder=" ..."))
```

**출력 예시**

<figure><img src="https://1442180325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVa1tsb4kzRuGbCJsMdPX%2Fuploads%2Fgit-blob-4db407b5d984649e79b1075033d595a8417a910a%2Fc36.png?alt=media" alt=""><figcaption></figcaption></figure>

배포 정보를 확인하실 수 있습니다.

#### c. 커밋 정보 확인

```python
import requests, textwrap

# 토큰/대상 코드서빙 ID 설정
BEARER_TOKEN_RAW = """
{accessToken }
"""  # AccessToken 값을 넣으면 됩니다.
CODE_ID = 7 # git 저장소 주소를 보시면 llmops/7 이런 식으로 숫자가 있는데 숫자를 넣으면 됩니다.

BEARER_TOKEN = "".join(BEARER_TOKEN_RAW.split())

BASE = "http://llmops-admin-api-service.llmops.svc.cluster.local:8080/api/admin"
url = f"{BASE}/serving/code/{CODE_ID}/commits"

headers = {"Accept": "application/json", "Authorization": f"Bearer {BEARER_TOKEN}"}

# branch 를 비우면 저장소 기본 브랜치. 페이지네이션: pg(페이지 번호), pgSize(페이지당 건수)
params = {"branch": "main", "pg": 1, "pgSize": 10}

response = requests.get(url, headers=headers, params=params, timeout=15)

print("GET", url)
print("params:", params)
print("status:", response.status_code)
print(textwrap.shorten(response.text, width=2500, placeholder=" ..."))
```

**출력 예시**

<figure><img src="https://1442180325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVa1tsb4kzRuGbCJsMdPX%2Fuploads%2Fgit-blob-322399cddc2e9615b83870d73cf2f66e21082554%2Fc37.png?alt=media" alt=""><figcaption></figcaption></figure>

위 사진과 같이 커밋 정보를 확인할 수 있습니다.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://genos-docs.gitbook.io/default/v1.9.5/basic-tutorials/guides/development/code_serving/deploy_code_serving.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
