3.6 KiB
3.6 KiB
title, updated, tags
| title | updated | tags | ||||
|---|---|---|---|---|---|---|
| CF Multisite (정적 사이트 호스팅) | 2026-07-21 actions.it.com zone 삭제로 서비스 중단 반영 |
|
[!warning] 기반 도메인 actions.it.com 소실 (2026-07-21)
actions.it.com네임서버가 2026-07-18 Cloudflare에서 이탈했고(파킹 서비스로 추정), 2026-07-21 CF zone 자체도 삭제됨. 아래*.actions.it.com서브도메인 전부 이제 해석 불가 — Worker 라우트도 함께 소실. Worker 스크립트(cf-multisite)와 R2 버킷(multisite-bucket)은 그대로 남아있어 새 도메인에 재연결하면 복구 가능. 상세: ../history/2026-07-21-cf-zone-cleanup
개요
Cloudflare Workers + R2 기반 멀티테넌트 정적 사이트 호스팅 플랫폼. Gitea repo에 push하면 자동으로 R2에 업로드되고, Workers가 서브도메인으로 서빙.
아키텍처
hosting/{customer} repo (Gitea push)
→ Gitea Actions Runner (jp1)
→ rclone sync → R2 multisite-bucket/sites/{customer}/
→ Cloudflare Workers (cf-multisite)
→ {customer}.actions.it.com
구성요소
| 항목 | 값 |
|---|---|
| Worker | cf-multisite (Cloudflare Workers) |
| R2 버킷 | multisite-bucket |
| R2 API 키 | Vault secret/cloud/r2-multisite |
| DNS | *.actions.it.com → Cloudflare proxied |
| Worker 라우트 | *.actions.it.com/* |
| Gitea org | hosting (private) |
| 소스 코드 | kaffa/cf-multisite |
| 템플릿 | kaffa/cf-multisite/template/.gitea/workflows/deploy.yml |
Gitea org secrets (hosting)
org-level secrets로 모든 고객 repo에 자동 적용:
| Secret | 용도 |
|---|---|
| R2_ACCESS_KEY | R2 S3 호환 액세스 키 |
| R2_SECRET_KEY | R2 S3 호환 시크릿 키 |
| R2_ENDPOINT | https://d8e5997eb4040f8b489f09095c0f623c.r2.cloudflarestorage.com |
고객 사이트 추가 절차
# 1. hosting org에 repo 생성
tea repo create --name {customer} --owner hosting --init
# 2. deploy.yml 복사 (kaffa/cf-multisite 템플릿에서)
# template/.gitea/workflows/deploy.yml을 고객 repo에 추가
# 3. 정적 파일 push
git clone https://gitea.inouter.com/hosting/{customer}.git
cd {customer}
# index.html 등 추가
git add . && git commit -m "initial site" && git push
# 4. 자동 배포 → https://{customer}.actions.it.com
org secrets가 자동 상속되지 않으면 repo-level secrets를 수동 설정:
TOKEN="(Vault secret/apps/gitea api_token)"
for secret in R2_ACCESS_KEY R2_SECRET_KEY R2_ENDPOINT; do
curl -X PUT -H "Authorization: token $TOKEN" \
"https://gitea.inouter.com/api/v1/repos/hosting/{customer}/actions/secrets/$secret" \
-H "Content-Type: application/json" \
-d "{\"data\":\"(Vault secret/cloud/r2-multisite $secret)\"}"
done
Worker 기능
- 멀티테넌트: 서브도메인 → R2 경로 매핑 (
{customer}.actions.it.com→/sites/{customer}/) - 캐시: HTML 1시간, 정적파일(CSS/JS/이미지) 24시간 Edge 캐시
- Rate Limiting: KV 기반 분당 요청 수 제한 (티어별)
- Admin API: 사용량/고객/통계 조회 (
/api/usage/:customer,/api/customers등) - MIME 자동감지: 확장자 기반 Content-Type 매핑
배포 방식
rclone으로 R2 S3 호환 API 사용. AWS CLI 대비 설치 빠르고 경량.
운영 중인 사이트
| 서브도메인 | repo | 상태 |
|---|---|---|
| demo.actions.it.com | kaffa/cf-multisite (sample-site) | ✅ |
| test-customer.actions.it.com | (직접 업로드) | ✅ |
| multisite-demo.actions.it.com | (직접 업로드) | ✅ |
| demo-site.actions.it.com | hosting/demo-site | ✅ |