Repository navigation
docs(quickstart): Auth0 セットアップ手順を追加 - #134
Conversation
Keycloak から Auth0 への移行に伴い、QUICKSTART.md を完全に更新: - Auth0 Management API 認証情報の取得手順 - Terraform による Auth0 リソースのプロビジョニング - 環境変数の設定手順 - トラブルシューティングセクションの更新 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe QUICKSTART.md documentation is reorganized to replace Keycloak-based setup with Auth0-centric configuration and Terraform provisioning. Steps now emphasize repository cloning, dependency installation, Auth0 dashboard configuration including machine-to-machine permissions, terraform.tfvars population, and unified local service startup via Makefile targets, with updated environment variables and troubleshooting guidance. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
docs/QUICKSTART.md (1)
3-4: Clarify the time estimate in Step 0 context.The introduction text (line 3) claims "5 minutes to startup" in line 12's heading, but the footer (line 248) indicates "10–15 minutes" total. While these refer to different aspects (initial startup vs. complete setup), the earlier "5分で起動" (5 minutes) might set incorrect expectations given that Auth0 dashboard configuration and Terraform provisioning add significant overhead.
Consider either:
- Updating the headline to reflect the realistic time including Auth0 setup, or
- Clarifying that the "5 minutes" refers only to the local service startup after Auth0 is configured
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/QUICKSTART.md
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
docs/QUICKSTART.md
172-172: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
176-176: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
180-180: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
209-209: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
217-217: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: claude-review
- GitHub Check: ci
| #### 3.1 Auth0 Management API 認証情報の取得 | ||
|
|
||
| ```bash | ||
| # Docker イメージをビルドして起動 | ||
| make docker-run | ||
|
|
||
| # アクセス先 | ||
| # - Control Plane UI: http://localhost:3000 | ||
| # - Keycloak: http://localhost:8080 | ||
| ``` | ||
| 1. [Auth0 Dashboard](https://manage.auth0.com) にログイン | ||
| 2. 左サイドバーから **Applications** → **APIs** を選択 | ||
| 3. **Auth0 Management API** をクリック | ||
| 4. **Machine to Machine Applications** タブを開く | ||
| 5. **Create & Authorize** をクリックして新しい M2M アプリを作成 | ||
| 6. 以下の権限(Permissions)を付与: | ||
| - `read:clients` | ||
| - `create:clients` | ||
| - `update:clients` | ||
| - `delete:clients` | ||
| - `read:resource_servers` | ||
| - `create:resource_servers` | ||
| - `update:resource_servers` | ||
| - `read:client_credentials` | ||
| - `create:client_credentials` | ||
| 7. **Authorize** をクリック | ||
| 8. 作成したアプリの **Settings** タブから以下を取得: | ||
| - **Domain** (例: `your-tenant.auth0.com`) | ||
| - **Client ID** | ||
| - **Client Secret** | ||
|
|
||
| 停止する場合は次を実行します。 | ||
| #### 3.2 Terraform 変数ファイルの作成 | ||
|
|
||
| ```bash | ||
| make docker-stop | ||
| # terraform.tfvars を作成 | ||
| cp infrastructure/terraform/environments/dev/terraform.tfvars.example \ | ||
| infrastructure/terraform/environments/dev/terraform.tfvars | ||
| ``` | ||
|
|
||
| この方法では `.env.local` ファイルが必要です。事前に `frontend/control-plane/.env.local` を作成してください。 | ||
| `infrastructure/terraform/environments/dev/terraform.tfvars` を編集して、取得した認証情報を設定してください。 | ||
|
|
||
| ### 方法 3: 手動セットアップ | ||
|
|
||
| #### 1. Docker Desktop を起動 | ||
|
|
||
| macOS の場合は次を実行する。 | ||
| ```bash | ||
| # アプリケーションフォルダから Docker.app を起動 | ||
| # メニューバーに Docker アイコンが緑色になるまで待つ | ||
| ``` | ||
|
|
||
| Docker が起動しているか確認する。 | ||
| ```bash | ||
| docker --version | ||
| ```hcl | ||
| auth0_domain = "your-tenant.auth0.com" | ||
| auth0_client_id = "取得した Client ID" | ||
| auth0_client_secret = "取得した Client Secret" | ||
| ``` | ||
|
|
||
| #### 2. Keycloak を起動 | ||
| `terraform.tfvars` はシークレット情報を含むため、Git にコミットしないでください(`.gitignore` で除外済み)。 | ||
|
|
||
| ```bash | ||
| cd infrastructure/docker/keycloak | ||
| docker compose up -d | ||
| ``` | ||
| #### 3.3 Auth0 リソースのプロビジョニング | ||
|
|
||
| 起動状態を確認する。 | ||
| ```bash | ||
| docker compose ps | ||
| ``` | ||
|
|
||
| 以下のように表示されれば成功と判断できる。 | ||
| # Auth0 をセットアップ(init + apply + 認証情報表示) | ||
| make auth0-setup | ||
| ``` | ||
| NAME STATUS PORTS | ||
| keycloak-keycloak-1 Up 30 seconds 0.0.0.0:8080->8080/tcp | ||
| keycloak-postgres-1 Up 30 seconds 5432/tcp | ||
| ``` | ||
|
|
||
| #### 3. Keycloak の初期設定 | ||
|
|
||
| ##### 3.1 管理コンソールにアクセス | ||
|
|
||
| ブラウザで http://localhost:8080 を開く。 | ||
|
|
||
| ##### 3.2 ログイン | ||
|
|
||
| - **Username**: `admin` | ||
| - **Password**: `admin` | ||
|
|
||
| ##### 3.3 TenkaCloud Realm を作成 | ||
|
|
||
| 1. 左上のドロップダウン("Keycloak" と表示)をクリック | ||
| 2. "Create Realm" をクリック | ||
| 3. **Realm name**: `tenkacloud` と入力 | ||
| 4. "Create" をクリック | ||
|
|
||
| ##### 3.4 Client を作成 | ||
|
|
||
| 1. 左メニューから **Clients** をクリック | ||
| 2. "Create client" ボタンをクリック | ||
| このコマンドにより、Control Plane 用 Auth0 Application、Application Plane 用 Auth0 Application、TenkaCloud API (Resource Server) が作成されます。 |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify Auth0 setup configuration paths and Makefile targets
echo "=== Checking for terraform.tfvars.example template ==="
find . -name "terraform.tfvars.example" -o -name "terraform.tfvars*" 2>/dev/null | head -20
echo -e "\n=== Checking Terraform directory structure ==="
find infrastructure -type d -name terraform 2>/dev/null | head -5
find infrastructure/terraform -type f -name "*.tfvars*" 2>/dev/null
echo -e "\n=== Checking for Makefile and auth0-setup target ==="
if [ -f "Makefile" ]; then
echo "Makefile found. Searching for auth0-setup target:"
grep -n "auth0-setup" Makefile || echo "NOT FOUND"
echo -e "\nChecking for 'start' target:"
grep -n "^start:" Makefile || echo "NOT FOUND"
else
echo "ERROR: Makefile not found in repository root"
fi
echo -e "\n=== Checking for Terraform Auth0 provider/main config ==="
find infrastructure -name "*.tf" -type f 2>/dev/null | head -10Repository: susumutomita/TenkaCloud
Length of output: 1320
🏁 Script executed:
#!/bin/bash
# Check actual Terraform Auth0 configuration for M2M permissions requirements
echo "=== Checking Terraform Auth0 provider configuration ==="
find infrastructure -name "*.tf" -type f | while read -r file; do
if grep -l "auth0_app\|auth0_client\|auth0_resource_server" "$file" > /dev/null 2>&1; then
echo "File: $file"
echo "---"
fi
done
echo -e "\n=== Looking for Terraform variables file ==="
find infrastructure -name "variables.tf" -o -name "*.tf" | xargs grep -l "auth0" 2>/dev/null | head -5Repository: susumutomita/TenkaCloud
Length of output: 728
🏁 Script executed:
#!/bin/bash
# Check the actual Auth0 resources being created
echo "=== Auth0 Terraform module main.tf (Auth0 resources) ==="
head -100 infrastructure/terraform/modules/auth0/main.tf
echo -e "\n=== Checking for auth0_client or auth0_resource_server resource blocks ==="
rg "resource \"auth0_" infrastructure/terraform/modules/auth0/main.tf | head -20
echo -e "\n=== Checking outputs from auth0-setup command ==="
grep -A 20 "^auth0-output:" MakefileRepository: susumutomita/TenkaCloud
Length of output: 4021
🏁 Script executed:
#!/bin/bash
# Check environment variable setup references in documentation
echo "=== Checking Step 3.4 environment variables against outputs ==="
echo "Documentation references: AUTH0_ISSUER, AUTH0_CLIENT_ID, AUTH0_CLIENT_SECRET"
echo ""
echo "Terraform outputs file:"
cat infrastructure/terraform/modules/auth0/outputs.tf
echo -e "\n=== Checking auth0-output target in Makefile ==="
grep -B 5 -A 10 "auth0-output:" MakefileRepository: susumutomita/TenkaCloud
Length of output: 2218
🏁 Script executed:
#!/bin/bash
# Check all outputs in auth0 module
echo "=== Complete outputs.tf file ==="
cat infrastructure/terraform/modules/auth0/outputs.tf
echo -e "\n=== Verify output names match Makefile expectations ==="
echo "Makefile looks for: auth0_control_plane_client_id, auth0_control_plane_client_secret, etc."
echo "Actual outputs:"
rg "^output" infrastructure/terraform/modules/auth0/outputs.tfRepository: susumutomita/TenkaCloud
Length of output: 1279
🏁 Script executed:
#!/bin/bash
# Check if M2M permissions cover resource_server_scopes management
echo "=== Checking Auth0 documentation for resource_server_scopes permissions ==="
echo "Terraform creates resource: auth0_resource_server_scopes"
echo "Documentation M2M permissions listed:"
grep -A 12 "以下の権限" docs/QUICKSTART.md | head -15Repository: susumutomita/TenkaCloud
Length of output: 608
Fix Makefile jq output references—terraform output names do not include auth0_ prefix.
The make auth0-output command in the Makefile references terraform outputs that do not exist. The outputs.tf file defines control_plane_client_id, control_plane_client_secret, application_plane_client_id, application_plane_client_secret, and api_identifier, but the Makefile's jq command references auth0_control_plane_client_id, auth0_control_plane_client_secret, and auth0_api_identifier. This mismatch will cause the command to fail silently and return null values, preventing users from retrieving credentials needed for .env.local setup.
The terraform.tfvars.example path and Makefile auth0-setup target are correctly documented. M2M permissions listed are sufficient for the Terraform resources being created.
🤖 Prompt for AI Agents
In docs/QUICKSTART.md around lines 34 to 82, the Makefile's auth0-output jq
references use non-existent Terraform output names with an auth0_ prefix,
causing null results; update the documentation to reflect the actual Terraform
outputs (control_plane_client_id, control_plane_client_secret,
application_plane_client_id, application_plane_client_secret, api_identifier) so
the Makefile jq filters match the real output names, or alternatively note the
correct keys to extract from terraform output before running make auth0-setup so
users get valid values for .env.local.
| ### ログイン時にエラーが発生 | ||
| ### Auth0 ログインでエラーが発生 | ||
|
|
||
| **エラー: "Invalid redirect URI"** |
There was a problem hiding this comment.
Fix markdown heading syntax violations (MD036).
Five subsection headers in the troubleshooting section use bold emphasis (**text**) instead of proper markdown heading syntax (###). This violates the no-emphasis-as-heading (MD036) linting rule.
🔎 Proposed fix to use proper heading syntax
-**エラー: "Invalid redirect URI"**
+### エラー: "Invalid redirect URI"
-**エラー: "Invalid client or Invalid client credentials"**
+### エラー: "Invalid client or Invalid client credentials"
-**エラー: "Configuration error"**
+### エラー: "Configuration error"
-**エラー: "terraform.tfvars が見つかりません"**
+### エラー: "terraform.tfvars が見つかりません"
-**エラー: "Auth0 API error"**
+### エラー: "Auth0 API error"Also applies to: 176-176, 180-180, 209-209, 217-217
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
172-172: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🤖 Prompt for AI Agents
In docs/QUICKSTART.md around lines 172, 176, 180, 209 and 217, several
subsection titles are written with bold emphasis (e.g., **エラー: "Invalid redirect
URI"**) which violates MD036; change each of those bolded subsection lines to
proper markdown headings (for example convert **エラー: "Invalid redirect URI"** to
a level-3 heading like ### エラー: "Invalid redirect URI") preserving the exact
text content and surrounding spacing, and verify the same change for the other
four mentioned lines so the no-emphasis-as-heading lint rule is satisfied.
PR レビュー: Auth0 セットアップ手順の追加📋 概要QUICKSTART.md を Keycloak ベースから Auth0 ベースに完全移行する大規模なドキュメント更新です。全体的に非常に良い改善ですが、いくつかの改善点を発見しました。 ✅ 良い点
🔍 改善提案1. Makefile の auth0-output コマンドのバグ 🐛
推奨:
2. ステップ 4 の起動コマンドが曖昧
推奨:
3. Auth0 権限リストの不一致QUICKSTART.md と terraform.tfvars.example で権限リストに差異があります。 推奨: 両方のファイルで権限リストを統一する 4. テストカバレッジの確認CLAUDE.md の要件に従い、PR マージ前に 🎯 優先度別アクションアイテム🔴 High Priority
🟡 Medium Priority
💡 まとめ全体的に非常に良いドキュメント更新です。特に Auth0 への移行手順が詳細で、Terraform による IaC アプローチが素晴らしいです。上記の改善点を修正すれば、ユーザーがスムーズにセットアップできるようになります。 お疲れ様でした! 🎉 |
Summary
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.