116 lines
4.4 KiB
Markdown
116 lines
4.4 KiB
Markdown
---
|
|
title: Gitea 서버 및 CI/CD
|
|
updated: 2026-03-28
|
|
---
|
|
|
|
## 서버
|
|
|
|
K3s 클러스터에서 Helm 차트(gitea/gitea 12.5.0)로 운영. 네임스페이스: `gitea`.
|
|
|
|
- Gitea 1.25.4 + PostgreSQL 16 + Valkey
|
|
- 도메인: gitea.inouter.com
|
|
- 트래픽: BunnyCDN(iron-git, BlockNoneReferrer: false) → HAProxy → Traefik → gitea svc:3000
|
|
- SSH 활성화, 외부 포트 2202 (relay4wd APISIX stream_route 경유: `ssh -p 2202 git@git.inouter.com`), MetalLB 192.168.9.54:22, SSH_DOMAIN: git.inouter.com
|
|
- 스토리지: Git 저장소 Longhorn PVC 5Gi, **그 외 전부 R2** (패키지/LFS/첨부파일/아바타/아카이브/Actions)
|
|
- R2 버킷: `gitea-storage` (APAC), Vault `secret/cloud/r2-gitea`, K8s Secret `gitea-r2`
|
|
- 시크릿: Vault `secret/apps/gitea`
|
|
- Deployment strategy: Recreate (RWO PVC 충돌 방지)
|
|
- 메일: Mailgun SMTP (`gitea@inouter.com`, 도메인 `inouter.com`), FROM: `noreply@inouter.com`
|
|
|
|
### Helm 관리
|
|
|
|
```bash
|
|
# values 파일
|
|
~/k8s/gitea/values.yaml
|
|
|
|
# 업그레이드
|
|
helm upgrade gitea gitea/gitea -n gitea -f ~/k8s/gitea/values.yaml
|
|
```
|
|
|
|
### 이전 (Synology)
|
|
|
|
2026-03-15 Synology NAS(192.168.9.100, SQLite)에서 K3s(PostgreSQL)로 이전 완료. Synology 패키지 중지됨 (데이터 보존 중).
|
|
|
|
## 이미지 레지스트리
|
|
|
|
모든 컨테이너 이미지는 `gitea.inouter.com/kaffa/` 경로. R2 `gitea-storage` 버킷에 저장.
|
|
|
|
### R2 스토리지 설정
|
|
|
|
| 항목 | 값 |
|
|
|------|-----|
|
|
| STORAGE_TYPE | minio (S3 호환) |
|
|
| 엔드포인트 | `d8e5997eb4040f8b489f09095c0f623c.r2.cloudflarestorage.com` |
|
|
| 버킷 | `gitea-storage` |
|
|
| API 키 | Vault `secret/cloud/r2-gitea` (access_key_id, secret_access_key) |
|
|
| K8s Secret | `gitea-r2` (gitea 네임스페이스) |
|
|
|
|
R2에 저장되는 데이터: packages, lfs, attachments, avatars, repo-avatars, repo-archive, actions_log, actions_artifacts
|
|
|
|
### BunnyCDN Pull Zone 분리 (2026-03-27)
|
|
|
|
Gitea는 iron-kr에서 **iron-git** (ID 5584382)으로 분리. 이유: iron-kr의 `BlockNoneReferrer: true`가 git 클라이언트(Referrer 없음)를 차단하여 git push/pull 403 에러 발생. iron-git은 `BlockNoneReferrer: false`로 설정.
|
|
|
|
## Act Runner
|
|
|
|
Gitea Act Runner는 [[infra-hosts|incus-jp1]]의 gitea-runner 컨테이너에서 실행 (act_runner daemon, systemd 서비스).
|
|
- 라벨: `ubuntu-latest`, `ubuntu-22.04`, `ubuntu-20.04`
|
|
- 설정: `/root/.runner` (address: `https://gitea.inouter.com`)
|
|
- Docker config: `/root/.docker/config.json` (레지스트리 인증)
|
|
- `/etc/hosts`: `192.168.9.53 gitea.inouter.com` (직접 접근)
|
|
|
|
## CI/CD 배포
|
|
|
|
ArgoCD로 배포 관리. CI workflow는 Docker 이미지 빌드+푸시만 수행하고, ArgoCD가 `k8s/` 매니페스트 변경을 감지하여 자동 배포.
|
|
|
|
| repo | ArgoCD 앱 | workflow | 비고 |
|
|
|------|-----------|----------|------|
|
|
| namecheap-api | namecheap-api | docker.yaml | build+push |
|
|
| vultr-api | vultr-api | build.yaml + ci.yml | build+push |
|
|
| bunnycdn-mcp | bunnycdn-mcp | ci.yml | build+push |
|
|
| cf-bouncer-manager | cf-bouncer-manager | build.yaml | build+push |
|
|
|
|
### CI workflow 공통 패턴
|
|
|
|
```yaml
|
|
env:
|
|
REGISTRY: gitea.inouter.com
|
|
IMAGE_NAME: ${{ gitea.repository }}
|
|
# secrets.REGISTRY_TOKEN 사용 (각 repo Actions secrets에 설정)
|
|
```
|
|
|
|
## 백업
|
|
|
|
K8s CronJob `gitea-backup` (매일 03:00 UTC):
|
|
- `gitea dump` → `/backup/gitea-dump-*.tar.gz`
|
|
- 7일 보존, Longhorn PVC 10Gi
|
|
- 매니페스트: `~/k8s/gitea/backup-cronjob.yaml`
|
|
|
|
## 도메인 이전 (2026-03-28)
|
|
|
|
`gitea.inouter.com` → `gitea.inouter.com` 완전 교체.
|
|
|
|
변경 항목:
|
|
- DNS: Cloudflare CNAME → iron-git.b-cdn.net + BunnyCDN Free SSL
|
|
- K8s: HTTPRoute, Helm values (DOMAIN, ROOT_URL), CoreDNS 헤어핀 rewrite
|
|
- ArgoCD: 4개 앱 repoURL + 8개 repo secret
|
|
- Gitea Runner: `.runner`, `.docker/config.json`, `/etc/hosts`
|
|
- Mailgun: `gitea@inouter.com` → `gitea@inouter.com` credential 교체
|
|
- 4개 repo CI workflow 이미지 경로 수정
|
|
- 컨테이너 이미지 경로: 5개 Deployment
|
|
- 로컬 git remote 6개, Obsidian 문서 7개, CLAUDE.md, Vault secret
|
|
|
|
## 트러블슈팅
|
|
|
|
### 웹 로그인 안 될 때 비밀번호 리셋
|
|
|
|
```bash
|
|
curl -s -X PATCH "https://gitea.inouter.com/api/v1/admin/users/kaffa" \
|
|
-H "Authorization: token <API_TOKEN>" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"password":"<PASSWORD>","must_change_password":false,"login_name":"kaffa","source_id":0}'
|
|
```
|
|
|
|
- API 토큰, 비밀번호: Vault `secret/apps/gitea`
|
|
- 2026-03-17 웹 로그인 불가 → API로 비밀번호 리셋하여 해결
|