Skip to content

feat: Makefile で一括起動コマンド (make start-all) を追加 - #39

Merged
susumutomita merged 2 commits into
mainfrom
feat/makefile-start-all
Nov 15, 2025
Merged

susumutomita merged 2 commits into
mainfrom
feat/makefile-start-all

Conversation

@susumutomita

@susumutomita susumutomita commented Nov 15, 2025 •

Copy link
Copy Markdown
Owner

概要

ローカル環境を一括で起動・管理できる Makefile コマンドを追加しました。

変更内容

Makefile の拡張

  • make start-all: ローカル環境を一括起動
    • Keycloak の起動
    • Keycloak の自動セットアップ(Realm と Client 作成)
    • .env.local の作成(存在しない場合)
    • 次のステップの表示
  • make stop-all: ローカル環境を一括停止
  • make restart-all: ローカル環境を再起動
  • make setup-keycloak: Keycloak のみセットアップ
  • make check-docker: Docker 起動確認
  • make help: ヘルプメッセージを拡張

ドキュメント更新

  • docs/QUICKSTART.md: Makefile を使った起動方法を追加(推奨方法)
  • README.md: クイックスタートセクションと主要コマンドの説明を追加

使い方

# Docker Desktop を起動してから実行
make start-all

これだけで以下が自動的に実行されます:

  1. Keycloak の起動
  2. Realm と Client の自動作成
  3. .env.local の作成(存在しない場合)
  4. 次のステップの表示

テスト

  • make start-all でローカル環境が起動することを確認
  • make stop-all で環境が停止することを確認
  • make restart-all で再起動することを確認
  • Markdown linting 警告を修正(MD032, MD034)
  • ドキュメントが正確であることを確認

参照

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Summary by CodeRabbit

  • New Features

    • One-command local environment orchestration: start, stop, restart, and environment readiness checks, with automatic Keycloak setup and .env.local creation.
  • Documentation

    • Expanded Quick Start and README with 1-minute startup flow, Makefile command reference (localized Japanese help), detailed Keycloak/manual setup paths, environment variable guidance, UI startup steps, troubleshooting, and port conflict handling.

- make start-all: ローカル環境を一括起動
  - Docker の起動状態を自動確認
  - Keycloak を起動
  - Keycloak の自動セットアップスクリプトを実行
  - .env.local の存在確認と自動作成
- make stop-all: ローカル環境を一括停止
- make restart-all: ローカル環境を再起動
- make setup-keycloak: Keycloak のみセットアップ
- make check-docker: Docker 起動確認
- make help: ヘルプメッセージを拡張

Quick Start Guide を更新:
- Makefile による一括起動手順を追記(推奨方法)
- 手動セットアップ手順の見出しレベルを調整

README.md を更新:
- クイックスタートセクションを追加
- Makefile コマンド一覧を追加
- Quick Start Guide へのリンク追加

これで `make start-all` 一発でローカル環境を起動できます。

Refs: Plan.md "NextAuth.js + Keycloak 認証統合 - 2025-11-13"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 15, 2025 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

Added Makefile targets to orchestrate Docker/Keycloak lifecycle (check-docker, setup-keycloak, start-all, stop-all, restart-all), expanded and replaced help text, and updated docs (README.md, docs/QUICKSTART.md) with a Japanese Quick Start, Makefile command overview, and detailed Keycloak & .env.local setup instructions.

Changes

Cohort / File(s) Summary
Makefile — orchestration & help
Makefile
Added targets: check-docker, setup-keycloak, start-all, stop-all, restart-all; expanded .PHONY; implemented Docker/Keycloak readiness checks and orchestration sequences; enhanced help output with consolidated, localized (Japanese) guidance and usage examples.
Documentation — quick start & commands
README.md
Added Japanese Quick Start describing make start-all, automatic Keycloak setup, and .env.local handling; added Makefile commands overview (local env management, code quality, tests); expanded features section with "バトルアリーナ" and related capabilities.
Docs — detailed setup
docs/QUICKSTART.md
Reworked Quick Start to prefer make start-all; switched Keycloak startup to docker compose up -d; added explicit Keycloak/manual setup steps, .env.local snippet and AUTH_SECRET guidance, dependency/UI startup steps, troubleshooting (ports/cleanup) and verification commands.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Make as Makefile
    participant Docker as Docker / Keycloak
    participant Setup as setup-keycloak
    participant UI as Control Plane UI

    Dev->>Make: make start-all
    Make->>Docker: check-docker (validate Docker & daemon)
    Docker-->>Make: OK / error
    Make->>Docker: docker compose up -d keycloak
    Docker-->>Make: Keycloak starting
    Make->>Setup: setup-keycloak
    Setup->>Docker: wait for Keycloak readiness
    Docker-->>Setup: ready
    Setup->>Docker: run Keycloak setup script (realm/client/users)
    Docker-->>Setup: setup complete
    Make->>UI: create `.env.local` (from env.example) / show guidance
    Make-->>Dev: environment ready
    Dev->>UI: bun run dev
    UI-->>Dev: app at http://localhost:3000
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Focus review on Makefile orchestration sequences and shell logic (readiness loops, error handling).
  • Verify setup-keycloak script invocation and any assumptions about env.example / generated .env.local.
  • Quick pass for docs consistency and localized wording in README.md and docs/QUICKSTART.md.

Possibly related PRs

Poem

🐰 A hop, a key, a makefile call,
Docker wakes and Keycloak stands tall.
With .env.local and one swift cartwheel,
Start-all hums — the dev box feels real. 🥕🚀

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 'feat: Makefile で一括起動コマンド (make start-all) を追加' clearly summarizes the main change: adding a batch startup command to the Makefile, which is the central focus across all modified files (Makefile, README.md, and QUICKSTART.md).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb5caad and 43197e3.

📒 Files selected for processing (2)
  • README.md (1 hunks)
  • docs/QUICKSTART.md (6 hunks)

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.

- README.md: 文末の句点を追加し、コロン表現を自然な日本語に修正
- docs/QUICKSTART.md: 文末の句点を追加し、コロン表現を自然な日本語に修正

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

@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: 4

🧹 Nitpick comments (2)
Makefile (2)

38-51: Extract duplicated health check logic into a helper target or function.

The Keycloak readiness wait logic (lines 42–49) is duplicated identically in the start-all target (lines 61–68). Extract this into a reusable helper target to reduce duplication and ease future maintenance.

For example, create a helper target:

+wait-keycloak-ready:
+	@echo "⏳ Keycloak の起動を待っています(最大60秒)..."
+	@bash -c 'for i in {1..30}; do \
+		if curl -s -f http://localhost:8080/health/ready > /dev/null 2>&1; then \
+			echo "✅ Keycloak が起動しました"; \
+			break; \
+		fi; \
+		echo "   試行 $$i/30..."; \
+		sleep 2; \
+	done'
+
 setup-keycloak: check-docker
 	@echo "🚀 Keycloak をセットアップしています..."
 	@cd infrastructure/docker/keycloak && docker compose up -d
-	@echo "⏳ Keycloak の起動を待っています(最大60秒)..."
-	@bash -c 'for i in {1..30}; do \
-		if curl -s -f http://localhost:8080/health/ready > /dev/null 2>&1; then \
-			echo "✅ Keycloak が起動しました"; \
-			break; \
-		fi; \
-		echo "   試行 $$i/30..."; \
-		sleep 2; \
-	done'
+	$(MAKE) wait-keycloak-ready

Then reference it in start-all as well.


1-1: Consider adding all as a phony target.

Per checkmake, the all phony target is a conventional entry point. Currently, .PHONY declares many targets but not all. If you intend for all to be an alias to a specific target (e.g., all: start-all), add it to .PHONY and define the target. Otherwise, silently ignore this note.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc2e235 and fb5caad.

📒 Files selected for processing (3)
  • Makefile (2 hunks)
  • README.md (1 hunks)
  • docs/QUICKSTART.md (6 hunks)
🧰 Additional context used
🪛 checkmake (0.2.2)
Makefile

[warning] 1-1: Missing required phony target "all"

(minphony)


[warning] 116-116: Target body for "help" exceeds allowed length of 5 (38).

(maxbodylength)

🪛 GitHub Actions: ci
docs/QUICKSTART.md

[error] 20-20: textlint: 文末が'。'で終わっていません。 (ja-technical-writing/ja-no-mixed-period)


[error] 20-20: textlint-ja/ai-writing/no-ai-colon-continuation: 「これで以下が自動的に実行されます:」のような述語とコロンで終わるパターンは、自然な日本語表現を検討してください。

README.md

[error] 33-33: textlint: 文末が'。'で終わっていません。 (ja-technical-writing/ja-no-mixed-period)


[error] 33-33: textlint-ja/ai-writing/no-ai-colon-continuation: 「これで以下が自動的に実行されます:」のような述語とコロンで終わるパターンは、自然な日本語表現を検討してください。


[error] 39-39: textlint: 文末が'。'で終わっていません。 (ja-technical-writing/ja-no-mixed-period)

🪛 markdownlint-cli2 (0.18.1)
docs/QUICKSTART.md

65-65: Bare URL used

(MD034, no-bare-urls)

⏰ 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). (1)
  • GitHub Check: claude-review
🔇 Additional comments (1)
Makefile (1)

71-71: Clarify the intent of error suppression on setup-keycloak.sh.

The || true on line 71 silently swallows any errors from the setup script. If the script should fail loudly on errors, remove || true. If it's intentionally forgiving (e.g., setup may partially fail but startup should continue), document why in a comment for clarity to future maintainers.

Comment thread docs/QUICKSTART.md Outdated
Comment thread docs/QUICKSTART.md
#### 3.1 管理コンソールにアクセス
##### 3.1 管理コンソールにアクセス

ブラウザで http://localhost:8080 を開く。

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

Wrap bare URL in markdown link syntax.

Line 65 has a bare URL that violates MD034. Wrap it in markdown link syntax:

-ブラウザで http://localhost:8080 を開く。
+ブラウザで [http://localhost:8080](http://localhost:8080) を開く。

Alternatively, shorten to a descriptive link:

-ブラウザで http://localhost:8080 を開く。
+ブラウザで [Keycloak 管理コンソール](http://localhost:8080) を開く。
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ブラウザで http://localhost:8080 を開く。
ブラウザで [http://localhost:8080](http://localhost:8080) を開く。
Suggested change
ブラウザで http://localhost:8080 を開く。
ブラウザで [Keycloak 管理コンソール](http://localhost:8080) を開く。
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

65-65: Bare URL used

(MD034, no-bare-urls)

🤖 Prompt for AI Agents
In docs/QUICKSTART.md around line 65, the bare URL "http://localhost:8080"
violates MD034; wrap it in Markdown link syntax or replace it with a descriptive
link. Update the line to use either an explicit link like
[http://localhost:8080](http://localhost:8080) or a descriptive form such as
[Open the app in your browser](http://localhost:8080) so the URL is not bare.

Comment thread README.md Outdated
Comment thread README.md Outdated
@susumutomita
susumutomita merged commit 8684e82 into main Nov 15, 2025
11 of 12 checks passed
@susumutomita
susumutomita deleted the feat/makefile-start-all branch November 15, 2025 22:43
@claude

claude Bot commented Nov 15, 2025

Copy link
Copy Markdown

コードレビュー - PR #39

⚠️ CRITICAL: CI が失敗しています

プルリクエストの CI チェックが失敗しています。CI が Green になるまでマージすべきではありません。


✅ 良い点

  1. 優れた UX 改善 - make start-all による一括起動は、開発者体験を大幅に向上させます
  2. 堅牢なエラーハンドリング - Docker の存在と起動状態を事前チェック
  3. 冪等性 - 既に設定済みの環境でも安全に実行可能
  4. 充実したドキュメント - README/QUICKSTART の更新

🔍 主な改善提案

1. Keycloak ヘルスチェックのタイムアウト処理

問題: 現在のヘルスチェックは 30 回試行しますが、タイムアウト時の明示的なエラーがありません。
推奨: タイムアウト時に明示的にエラーを報告し、スクリプトを終了させる。

2. setup-keycloak.sh のエラーハンドリング

問題: || true により失敗しても続行されますが、ユーザーは失敗に気づかない可能性があります。
推奨: 失敗時にも明確なメッセージを表示。

3. Markdown リンク形式

問題: README.md:46 の 形式は MD034 警告が出る場合があります。
推奨: 通常のリンク形式に統一。


📋 チェックリスト

  • コードがプロジェクトスタイルに従っている
  • ドキュメントが更新されている
  • CI が Green(CRITICAL)
  • タイムアウト時のエラーハンドリング追加を推奨

🎯 総評

非常に価値のある改善 ですが、CI が失敗している点は致命的 です。

次のステップ

  1. CRITICAL: CI エラーを修正して Green にする
  2. 推奨: タイムアウトエラーハンドリングを追加
  3. オプション: その他の改善提案を検討

CI が通過し、タイムアウトエラーハンドリングが追加されれば、強くマージを推奨 します。


🤖 Generated with Claude Code

susumutomita added a commit that referenced this pull request Jun 4, 2026
…s red team (#1708)

The Disruptions (red team) tab was empty because the problems submodule was pinned
to de6a8f5, which predates the sample Battle getting a real red team. Bump the pin to
a7ac11e (TenkaCloudChallenge main), which brings in:

- #38 hello-world-battle: a real, explained red team — "frontend-down" disruption
  (ssm-run-command stops nginx; ADR-029 auto-revert after 600s). This is what makes
  the Disruptions tab non-empty so organizers can actually test the feature.
- #39 microservice-migration-battle: red-team explanation in the description.
- #40 problem "check engine" validator; #41 teaser ASCII-diagram fix.

Also update apps/participant-portal/src/plugins/props-builder.test.ts: it used
hello-world-battle as a "no disruptions" example, which is no longer true — switch the
empty-case example to a challenge and pin the sample's new public disruption.

To see it live, redeploy the problem-deploy backend (the event-handler Lambda bundles
the catalog).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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