← Foundations Course

SYSTEM FOUNDATIONS · 15

Cloud / Deployment:GitHub 上的 Code 怎麼變成 Production

Deployment 是把經過驗證的 artifact 發布到 production runtime。Cloud 平台不是「神奇地讀 GitHub 就出網站」;中間仍有 checkout、install、check、build、upload、routing、smoke。

Learning outcomes

1. CI Runner

GitHub commit
  ↓
CI runner checkout
  ↓
install dependencies
  ↓
checks/tests
  ↓
build

Runner 是一次性的執行環境,不是 production server。

2. Artifact

src/
  ↓ build
dist/
  index.html
  app.js
  styles.css

Production 應部署你真正驗過的 output,而不是模糊地假設 source files 等於 final artifact。

3. Deploy

dist/
  ↓ upload
Cloud platform
  ↓ routing/runtime
Public URL

Static assets、serverless function、container、VM 都是不同 deployment model,但都要回答「artifact 在哪裡執行/被服務」。

4. Secrets / Environment

source code:
  no privileged secret

CI / platform:
  secret store
  env configuration

Secret 不應進 Git history。Public client config 和 privileged secret 也要依能力區分。

5. Production Smoke

deploy command PASS
  ↓
GET public URL
  ↓
status/content check
  ↓
production evidence

平台接受 deployment 不代表 route、asset、env、API 都正常。

Project checkpoint:Request Journey Map v15

Local commit
  ↓ push
GitHub
  ↓ CI checks
Build artifact
  ↓ deploy
Cloud platform
  ↓ public URL
Production smoke
  ↓
User request

Debug evidence:CI 綠、production 壞

先分 artifact、environment、routing、runtime、external dependency。不要因為 CI PASS 就假設 production 一定使用同一份 config/route。

Knowledge check

  1. CI runner 和 production runtime 差在哪?
  2. artifact 是什麼?
  3. secret 為什麼不能 commit?
  4. deploy success 後為什麼仍要 smoke?