Deploy to Cloudflare

Push to GitHub → Auto Deploy

เว็บของคุณ → ออนไลน์ใน 30 วินาที

Why Cloudflare Workers?

FeatureBenefit
Free tier100,000 requests/day
FastGlobal CDN (300+ locations)
HTTPSAuto SSL certificate
Git IntegrationPush = Deploy

URL ฟรี: your-name.workers.dev

How It Works

git push origin main
        ↓
GitHub receives push
        ↓
Cloudflare detects change
        ↓
Auto build & deploy
        ↓
🎉 Live at workers.dev

ไม่ต้อง run command ใดๆ!

Project Structure

your-project/
├── wrangler.jsonc    ← config (3 lines!)
└── public/           ← static files
    ├── index.html
    ├── styles.css
    └── slides/
        └── *.html

ทุกอย่างใน public/ = deploy ได้

wrangler.jsonc

{
  "name": "your-project-name",
  "compatibility_date": "2025-01-01",
  "assets": {
    "directory": "./public"
  }
}
Fieldคืออะไร
nameชื่อ subdomain (.workers.dev)
compatibility_dateVersion ของ Workers API
assets.directoryFolder ที่จะ deploy

Step 1 - Connect GitHub

  1. ไป Cloudflare Dashboard
  2. Workers & Pages → Create
  3. Connect to Git → Select repo
  4. เลือก branch: main

ครั้งเดียวจบ!

Step 2 - Configure Build

SettingValue
Build command(leave empty)
Build outputpublic
Root directory/

Static site = ไม่ต้อง build

Step 3 - Just Push!

# แก้ไขไฟล์
edit public/index.html

# Commit & Push
git add -A
git commit -m "update content"
git push origin main

# Done! Auto deploy ภายใน ~30 seconds

Live Demo

# ดู current files
ls public/

# Push changes
git add -A && git commit -m "new slides" && git push

# เปิดดู (รอ ~30 sec)
open https://siit-claude-code-workshops.laris.workers.dev/

Cloudflare จัดการทุกอย่าง

Check Deploy Status

Cloudflare Dashboard:

  • Workers & Pages → your project
  • Deployments tab
  • ดู status: ✓ Success / ✗ Failed

หรือดู GitHub:

  • Commit status check (green ✓)

Troubleshooting

IssueFix
Deploy ไม่ updateCheck branch ถูกไหม
404 errorCheck assets.directory path
Build failedดู Cloudflare logs
Wrong contentClear cache / wait 30s

Key Takeaways

3 สิ่งที่ต้องจำ:

  1. Config = wrangler.jsonc (3 lines)
  2. Connect = GitHub → Cloudflare (ครั้งเดียว)
  3. Deploy = git push (ทุกครั้งที่ update)

git push = deploy

ง่ายแค่นี้!