Files
member-platform/docs/LOCAL_DEV_RUNBOOK.md

42 lines
1003 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Local Dev RunbookKeycloak
## 1) 啟動後端
```bash
cd backend
./scripts/start_dev.sh
```
## 2) 啟動前端
```bash
cd frontend
npm install
npm run dev
```
## 3) 必要環境變數backend/.env.development
- `KEYCLOAK_BASE_URL`
- `KEYCLOAK_REALM`
- `KEYCLOAK_CLIENT_ID`
- `KEYCLOAK_CLIENT_SECRET`
- `KEYCLOAK_ADMIN_CLIENT_ID`
- `KEYCLOAK_ADMIN_CLIENT_SECRET`
- `ADMIN_REQUIRED_GROUPS`
## 4) 基本檢查
1. `GET http://127.0.0.1:8000/healthz` 應為 200。
2. 前端按「前往 Keycloak 登入」應可成功導轉與回跳。
3. `GET /me` 登入後應有資料。
4. 非 admin 群組帳號打 `/admin/*` 應為 403。
## 5) 新模型驗收路徑
1. 新增 Company、Site。
2. 新增 System、Role。
3. 對 Site 指派 Role。
4. 新增 User加入 Site。
5. 驗證 User 的角色是由 Site 推導,不是 direct assign。
## 6) API 白名單驗收
1. 建立 `api_client`
2.`X-Client-Key` + `X-API-Key` 呼叫 `/internal/*`
3. 驗證未授權 key 會被拒絕。