You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guide/ko/docker.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,32 @@ docker run -d -p 8080:8080 \
27
27
28
28
이 컨테이너가 Ingress, 리버스 프록시 또는 로드 밸런서를 통해 노출되는 경우, 헬스 체크 및 상태 엔드포인트는 내부용으로 유지하십시오. `/health`, `/ready`, `/status`는 신뢰할 수 있는 운영 체크를 위한 것이며 공용 인터넷에 노출되어서는 안 됩니다. 엔드포인트 노출 가이드는 [운영 가이드](operations.md#http-exposure)를 참조하십시오.
29
29
30
+
리버스 프록시 정책 예시:
31
+
32
+
| 경로 | 공용 인터넷 | 내부 네트워크 |
33
+
|------|-------------|---------------|
34
+
|`/mcp`| Bearer 인증 및 네트워크 정책이 있을 때만 허용 | 허용 |
35
+
|`/webhook`| HMAC secret 및 repo allowlist가 있을 때만 허용 | 허용 |
36
+
|`/health`| 차단 | 허용 |
37
+
|`/ready`| 차단 | 허용 |
38
+
|`/status`| 차단 | 허용 |
39
+
40
+
웹훅 서비스 모드에서는 canonical clone base URL을 사용하고, repo 이름 중복이 없다는 보장이 없다면 CCG 인스턴스 하나에는 하나의 조직/owner만 연결하십시오.
Copy file name to clipboardExpand all lines: guide/ko/operations.md
+22-2Lines changed: 22 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -168,6 +168,15 @@ CCG가 Ingress, 리버스 프록시 또는 로드 밸런서 뒤에 있는 경우
168
168
- 지속성 있는 로컬 스토리지를 위한 `--repo-root`
169
169
- 팀용 또는 상시 가동 배포를 위한 `--db-driver postgres`
170
170
171
+
웹훅 네임스페이스 추출은 마지막 저장소 이름을 사용합니다. 예를 들어 `acme/api`는 `api` 네임스페이스에 저장되고 `$REPO_ROOT/api`에 checkout됩니다. 이 전략은 단일 owner 웹훅 배포를 위한 것입니다. 허용 목록이 여러 owner를 포함하면 서버는 경고를 남깁니다. `acme/api`와 `external/api`가 같은 네임스페이스 및 checkout 경로에서 충돌할 수 있기 때문입니다.
172
+
173
+
권장 정책:
174
+
175
+
- 웹훅 CCG 인스턴스 하나에는 하나의 조직/owner를 사용하십시오.
176
+
- 인스턴스 안에서 마지막 저장소 이름이 중복되지 않게 유지하십시오.
177
+
- 서로 다른 조직에 같은 repo 이름이 있을 수 있으면 CCG 인스턴스를 분리하십시오.
178
+
-`*/*`는 일반 운영 allowlist가 아니라 개발 또는 격리된 환경에서만 신중히 사용하십시오.
179
+
171
180
SQLite 웹훅 배포는 `--webhook-workers` 또는 `CCG_WEBHOOK_WORKERS`가 명시적으로 설정되지 않으면 기본적으로 하나의 워커를 사용합니다. 이는 동일한 SQLite 데이터베이스에 대해 여러 동시 쓰기 작업이 발생하는 것을 방지하기 위함입니다. PostgreSQL의 경우, 저장소 업데이트 시간, 데이터베이스 용량 및 허용 가능한 큐 대기 시간에 따라 워커 수를 조정해야 합니다.
172
181
173
182
큐 메모리를 제한하려면 `--webhook-max-tracked-repos`를 사용하십시오. 큐가 가득 차면 새로운 저장소 요청은 `429 Too Many Requests`로 거부됩니다. 이러한 현상이 반복되면 규모 확장이나 범위 조정 문제로 취급해야 합니다.
@@ -210,9 +219,20 @@ SQLite 웹훅 배포는 `--webhook-workers` 또는 `CCG_WEBHOOK_WORKERS`가 명
210
219
211
220
SIGINT/SIGTERM 수신 시:
212
221
213
-
1. HTTP는 5초의 종료 윈도우와 함께 새로운 요청 수락을 중단합니다.
222
+
1. HTTP는 `--webhook-shutdown-timeout`(기본 30초)의 종료 윈도우와 함께 새로운 요청 수락을 중단합니다.
214
223
2. 동기화 컨텍스트가 취소되고 진행 중인 복제/빌드 작업이 `context.Done()`을 감지합니다.
215
-
3. SyncQueue 워커는 드레인(drain)을 위해 최대 30초의 시간을 갖습니다.
224
+
3. SyncQueue 워커는 드레인(drain)을 위해 최대 `--webhook-shutdown-timeout`의 시간을 갖습니다.
225
+
226
+
큐 종료가 시작된 뒤 들어온 웹훅 delivery는 `503 Service Unavailable`을 반환하므로 GitHub/Gitea가 이벤트를 성공 처리하지 않고 재시도할 수 있습니다. 종료 직전에 수락된 요청은 프로세스 종료로 취소될 수 있으므로, 새 push 또는 수동 네임스페이스 업데이트로 복구하십시오.
227
+
228
+
수동 복구:
229
+
230
+
```bash
231
+
ccg update /data/repos/api --namespace api
232
+
ccg status --namespace api --errors
233
+
```
234
+
235
+
검색, 커뮤니티, 저장된 flow가 여전히 오래된 것처럼 보이면 namespace `api`에 대해 필요한 postprocess 플래그와 함께 MCP `run_postprocess` 도구를 호출하십시오.
216
236
217
237
Streamable HTTP 서버는 MCP 스트림이 장시간 유지될 수 있으므로 고정된 `WriteTimeout`을 사용하지 않습니다. 서비스가 인터넷에 노출된 경우 리버스 프록시에서 유휴 연결 제한 및 요청 버퍼링 정책을 설정하십시오.
3. 웹훅 페이로드의 `ref` 필드에서 `refs/heads/` 접두사는 자동으로 제거됩니다.
78
78
79
+
### 네임스페이스 전략과 단일 조직 운영
80
+
81
+
웹훅 동기화는 `org/repo` 중 마지막 저장소 이름을 그래프 네임스페이스와 checkout 디렉터리로 사용합니다. 예를 들어 `acme/api`는 `api` 네임스페이스와 `/data/repos/api` checkout으로 매핑됩니다.
82
+
83
+
이 방식은 단일 조직 배포에서 짧고 예측 가능한 이름을 유지하기 위한 전략이며, 권장 운영 모델입니다. 허용 목록이 `acme/*`와 `external/shared`처럼 여러 owner를 포함하거나 `*/*`를 사용하면, 같은 마지막 저장소 이름이 충돌할 수 있으므로 CCG는 시작 시 경고 로그를 남깁니다.
84
+
85
+
| 저장소 | 파생 네임스페이스 |
86
+
|------|-------------------|
87
+
|`acme/api`|`api`|
88
+
|`external/api`|`api`|
89
+
90
+
운영 정책:
91
+
92
+
- 웹훅 CCG 인스턴스 하나에는 하나의 owner/조직을 사용하는 것을 권장합니다.
93
+
- 같은 인스턴스 안에 마지막 저장소 이름이 같은 저장소를 허용하지 마십시오.
94
+
- 여러 owner의 동기화가 필요하면 별도 CCG 인스턴스를 사용하거나, 네임스페이스 전략을 변경한 뒤 활성화하십시오.
95
+
79
96
## 서명 검증 (Signature Verification)
80
97
81
98
HMAC-SHA256을 사용하여 웹훅 페이로드를 검증합니다.
@@ -95,11 +112,12 @@ HMAC-SHA256을 사용하여 웹훅 페이로드를 검증합니다.
95
112
96
113
SIGINT/SIGTERM 수신 시:
97
114
98
-
1.**HTTP 서버 종료** — 새로운 요청 수락 중단 (5초 타임아웃)
115
+
1.**HTTP 서버 종료** — 새로운 요청 수락 중단 (`--webhook-shutdown-timeout`, 기본 30초)
99
116
2.**동기화 컨텍스트 취소** — 진행 중인 복제/빌드 작업에 `context.Done()` 전달
100
-
3.**워커 드레인(drain)** — SyncQueue 워커가 종료될 때까지 대기 (30초 타임아웃)
117
+
3.**워커 드레인(drain)** — SyncQueue 워커가 종료될 때까지 대기 (`--webhook-shutdown-timeout`, 기본 30초)
101
118
102
119
진행 중인 복제/빌드 작업은 컨텍스트 취소를 수신하고 즉시 중단되어 종료 대기 시간을 최소화합니다.
120
+
종료가 시작된 뒤 새 웹훅 delivery가 들어오면 `503 Service Unavailable`을 반환하므로, provider가 성공 처리 대신 재시도할 수 있습니다.
103
121
104
122
## 파이프라인 (Pipeline)
105
123
@@ -201,6 +219,23 @@ include_paths:
201
219
202
220
CCG는 현재 웹훅 운영을 위한 `/metrics` 엔드포인트를 제공하지 않습니다. `/status`를 주요 구조화된 런타임 뷰로 활용하십시오.
203
221
222
+
### 복구 Runbook
223
+
224
+
`/status`가 degraded 웹훅 동기화를 보고하거나, 큐 대기 시간이 계속 증가하거나, 배포 재시작 중 수락된 이벤트가 중단되었을 수 있을 때는 아래 절차를 사용하십시오.
Copy file name to clipboardExpand all lines: guide/webhook.md
+50-2Lines changed: 50 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,6 +82,30 @@ Use the `--allow-repo` flag to configure allowed branches per repository.
82
82
2. Rejected if no matching rule found
83
83
3.`refs/heads/` prefix is automatically stripped from the `ref` field in webhook payload
84
84
85
+
### Namespace Strategy and Single-Org Operation
86
+
87
+
Webhook sync derives the graph namespace and checkout directory from the
88
+
repository name portion of `org/repo`. For example, `acme/api` maps to the
89
+
`api` namespace and `/data/repos/api` checkout.
90
+
91
+
This keeps single-organization deployments short and predictable, which is the
92
+
recommended operating model. If the allowlist spans multiple owners, such as
93
+
`acme/*` plus `external/shared` or `*/*`, CCG logs a startup warning because
94
+
repositories with the same final name can collide:
95
+
96
+
| Repo | Derived namespace |
97
+
|------|-------------------|
98
+
|`acme/api`|`api`|
99
+
|`external/api`|`api`|
100
+
101
+
Operational policy:
102
+
103
+
- Prefer one owner/organization per webhook CCG instance.
104
+
- Do not allow two repositories with the same final repo name in the same
105
+
instance.
106
+
- If multi-owner sync becomes necessary, run separate CCG instances or change
107
+
the namespace strategy before enabling those rules.
108
+
85
109
## Signature Verification
86
110
87
111
Verifies webhook payload with HMAC-SHA256.
@@ -101,11 +125,12 @@ By default, webhook requests fail closed unless `--webhook-secret` is configured
101
125
102
126
On SIGINT/SIGTERM:
103
127
104
-
1.**HTTP server shutdown** — stops accepting new requests (5-second timeout)
128
+
1.**HTTP server shutdown** — stops accepting new requests (`--webhook-shutdown-timeout`, default 30 seconds)
105
129
2.**sync context cancel** — propagates `context.Done()` to in-progress clone/build operations
106
-
3.**worker drain** — waits for SyncQueue workers to finish (30-second timeout)
130
+
3.**worker drain** — waits for SyncQueue workers to finish (`--webhook-shutdown-timeout`, default 30 seconds)
107
131
108
132
In-progress clone/build operations receive the context cancel and stop immediately, minimizing shutdown wait time.
133
+
After shutdown begins, new webhook deliveries are rejected with `503 Service Unavailable` so providers can retry instead of treating the event as successfully accepted.
109
134
110
135
## Pipeline
111
136
@@ -234,6 +259,29 @@ same repo clears that repo's error state.
234
259
CCG does not currently expose a `/metrics` endpoint for webhook operations.
235
260
Treat `/status` as the primary structured runtime view.
236
261
262
+
### Recovery Runbook
263
+
264
+
Use this runbook when `/status` reports a degraded webhook sync, queue age keeps
265
+
growing, or a deployment restart may have interrupted an accepted event.
266
+
267
+
1. Check `/status.webhook.recent_repos` and logs for `repo`, `branch`, and
268
+
`last_error`.
269
+
2. Fix non-retryable repository configuration failures, such as malformed
270
+
`.ccg.yaml``include_paths`.
271
+
3. Trigger a new push on the same branch when the upstream provider should
272
+
drive recovery.
273
+
4. For manual recovery, update the namespace from the checkout directory:
274
+
275
+
```bash
276
+
ccg update /data/repos/api --namespace api
277
+
ccg status --namespace api --errors
278
+
```
279
+
280
+
5. If search, communities, or saved flows still look stale, call the MCP
281
+
`run_postprocess`tool for namespace `api` with the needed postprocess flags.
282
+
6. Recheck `/status`; a successful sync for the same repo clears the repo-level
283
+
unresolved error.
284
+
237
285
For deployment profiles, database choice, namespace size guidance, and common
0 commit comments