Skip to content

docs(quickstart): Auth0 セットアップ手順を追加 - #134

Merged
susumutomita merged 1 commit into
mainfrom
docs/quickstart-auth0-update
Dec 27, 2025
Merged

susumutomita merged 1 commit into
mainfrom
docs/quickstart-auth0-update

Conversation

@susumutomita

@susumutomita susumutomita commented Dec 27, 2025 •

Copy link
Copy Markdown
Owner

Summary

  • QUICKSTART.md を Keycloak ベースから Auth0 ベースに完全更新
  • Auth0 Management API 認証情報の取得手順を詳細に記載
  • Terraform による Auth0 リソースのプロビジョニング手順を追加
  • 環境変数の設定手順(Control Plane / Application Plane)を追加
  • Auth0 関連のトラブルシューティングセクションを更新

Test plan

  • ドキュメントの Markdown 構文が正しいことを確認
  • Auth0 セットアップ手順が実際の操作と一致することを確認
  • リンクが正しく機能することを確認

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Reorganized quick-start guide with new setup workflow
    • Added Auth0 authentication configuration steps with detailed dashboard guidance
    • Introduced Terraform-based provisioning workflow
    • Updated environment variable configuration instructions
    • Expanded Makefile commands and code quality tool references
    • Enhanced troubleshooting section with Auth0-specific error guidance
    • Added port conflict detection instructions

✏️ Tip: You can customize this high-level summary in your review settings.

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>
@coderabbitai

coderabbitai Bot commented Dec 27, 2025 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
Documentation Update
docs/QUICKSTART.md
Restructured quick-start guide: replaced Keycloak/docker-compose flow with Auth0 dashboard setup and Terraform provisioning; reorganized steps (cloning → dependencies → Auth0 config → Terraform setup → local startup); added M2M application permissions; updated environment variables and troubleshooting sections to reflect Auth0-specific errors; expanded Makefile commands reference; added git-ignore guidance for terraform.tfvars; updated port conflict checks for new service layout.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 From Keycloak's gates, we hop away,
Auth0 beckons us today!
Terraform scripting, clean and true,
Quick and easy, tried and new! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding Auth0 setup instructions to the quickstart documentation, which is the primary focus of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/quickstart-auth0-update

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@susumutomita
susumutomita enabled auto-merge (squash) December 27, 2025 00:54
@susumutomita
susumutomita merged commit cf9b1c2 into main Dec 27, 2025
6 of 7 checks passed
@susumutomita
susumutomita deleted the docs/quickstart-auth0-update branch December 27, 2025 00:56

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Updating the headline to reflect the realistic time including Auth0 setup, or
  2. 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9816893 and 1d60cdc.

📒 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

Comment thread docs/QUICKSTART.md
Comment on lines +34 to +82
#### 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) が作成されます。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 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 -10

Repository: 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 -5

Repository: 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:" Makefile

Repository: 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:" Makefile

Repository: 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.tf

Repository: 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 -15

Repository: 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.

Comment thread docs/QUICKSTART.md
### ログイン時にエラーが発生
### Auth0 ログインでエラーが発生

**エラー: "Invalid redirect URI"**

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

@claude

claude Bot commented Dec 27, 2025

Copy link
Copy Markdown

PR レビュー: Auth0 セットアップ手順の追加

📋 概要

QUICKSTART.md を Keycloak ベースから Auth0 ベースに完全移行する大規模なドキュメント更新です。全体的に非常に良い改善ですが、いくつかの改善点を発見しました。


✅ 良い点

  1. 明確なステップバイステップガイド

    • Auth0 Management API の認証情報取得手順が詳細に記載されている
    • Terraform を使った IaC アプローチで再現性が高い
    • make auth0-setup による自動化が素晴らしい
  2. セキュリティ意識

    • terraform.tfvars を .gitignore で除外する注意書き
    • 本番環境での注意事項を明記
  3. Ubiquitous Language への準拠

    • Control Plane / Application Plane の用語を一貫して使用
    • CLAUDE.md の技術スタックと整合性がある
  4. トラブルシューティングセクション

    • よくあるエラーと解決策を記載

🔍 改善提案

1. Makefile の auth0-output コマンドのバグ 🐛

Makefile:569 の jq コマンドで Issuer を抽出する部分は auth0_api_identifier から生成しようとしていますが、Auth0 の Issuer はテナントドメインであるべきです。

推奨:

  • Terraform の outputs.tf に auth0_domain を追加する
  • または、ドキュメントに「AUTH0_ISSUER は手動で設定」と明記する

2. ステップ 4 の起動コマンドが曖昧

make start は Control Plane のみ起動します。Application Plane は起動されません。

推奨:

  • ドキュメントで「Control Plane のみ起動」と明記し、Application Plane は make dev-app で起動すると説明する

3. Auth0 権限リストの不一致

QUICKSTART.md と terraform.tfvars.example で権限リストに差異があります。update:client_credentials が含まれていません。

推奨: 両方のファイルで権限リストを統一する

4. テストカバレッジの確認

CLAUDE.md の要件に従い、PR マージ前に make before-commit を実行し、すべてのチェックが通ることを確認してください。


🎯 優先度別アクションアイテム

🔴 High Priority

  1. Makefile の auth0-output コマンドを修正
  2. make start の動作を明確化

🟡 Medium Priority

  1. Auth0 権限リストを統一
  2. make before-commit を実行

💡 まとめ

全体的に非常に良いドキュメント更新です。特に Auth0 への移行手順が詳細で、Terraform による IaC アプローチが素晴らしいです。上記の改善点を修正すれば、ユーザーがスムーズにセットアップできるようになります。

お疲れ様でした! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant