Initial commit: CF Multisite 멀티테넌트 정적 호스팅
Some checks failed
Deploy to CF Multisite / deploy (push) Failing after 1m53s

- Cloudflare Workers + R2 기반
- Edge 캐싱으로 비용 절감
- 티어별 Rate Limiting (free/basic/pro)
- KV 기반 사용량 추적
- Admin API (usage, customers, tiers, stats)
- Gitea Actions 배포 워크플로우

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
kappa
2026-01-29 09:20:46 +09:00
commit 8850031c45
12 changed files with 4824 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
# Gitea Actions 워크플로우 예시
# 고객 저장소에서 사용할 템플릿
name: Deploy to CF Multisite
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# Hugo 사이트인 경우 (선택사항)
# - name: Setup Hugo
# run: |
# wget -qO- https://github.com/gohugoio/hugo/releases/download/v0.139.0/hugo_extended_0.139.0_linux-amd64.tar.gz | tar xz
# sudo mv hugo /usr/local/bin/
# - name: Build Hugo
# run: hugo --minify
- name: Install AWS CLI
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip -q awscliv2.zip
sudo ./aws/install
- name: Upload to R2
env:
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_KEY }}
R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }}
R2_BUCKET: multisite-bucket
# 저장소 이름을 고객 ID로 사용 (또는 별도 설정)
CUSTOMER_ID: ${{ github.repository_owner }}
run: |
# 정적 파일 디렉토리 (Hugo: public, 일반: . 또는 dist)
SOURCE_DIR="."
# Hugo 빌드 결과가 있으면 그것 사용
if [ -d "public" ]; then
SOURCE_DIR="public"
fi
aws s3 sync "$SOURCE_DIR" "s3://${R2_BUCKET}/sites/${CUSTOMER_ID}/" \
--endpoint-url "$R2_ENDPOINT" \
--exclude ".git/*" \
--exclude ".gitea/*" \
--exclude "*.md" \
--exclude "README*" \
--delete
echo "Deployed to: https://${CUSTOMER_ID}.yoursite.com"