0Pricing
MCP Academy · レッスン

ヘルスチェックと再起動

サービスを稼働させ、自動復旧できる状態に保ちます。

「ヘルスチェックと再起動」はCoddyKit上の無料MCP Academyレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはMCP Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 MCP Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Servers Need a Pulse

A deployed server can hang or crash silently. A health check is a simple probe that answers the question: are you still alive? 🩺

Expose a Health Endpoint

The classic pattern is a tiny route, often /health, that returns 200 OK when the server is ready to handle work.

GET /health  ->  200 OK

Keep the Check Cheap

A health check runs constantly, so keep it lightweight. It should confirm the process responds without doing heavy real work.

Liveness vs Readiness

Two ideas matter: liveness asks is the process alive, while readiness asks is it ready to accept traffic yet. They can differ at startup.

Let Docker Watch It

Docker can run a HEALTHCHECK on a schedule. If the command fails enough times, the container is marked unhealthy.

HEALTHCHECK CMD curl -f http://localhost:8000/health || exit 1

Restart on Failure

A restart policy tells the platform to bring a dead container back automatically, so a single crash does not mean downtime.

docker run --restart unless-stopped my-mcp-server

Orchestrators Do This Too

Tools like Kubernetes use the same probes to restart unhealthy pods and to route traffic only to ready instances.

Avoid Restart Loops

If a server crashes instantly on boot, blind restarts just loop forever. Use backoff so retries slow down and you can see the real error.

Check Dependencies Wisely

A deep readiness check can ping a database, but be careful: if every server marks itself unready at once, an outage can cascade.

Drain Before You Stop

On shutdown, stop accepting new calls but let in-flight ones finish. This graceful drain prevents cutting clients off mid-request.

Self-Healing in Practice

Health checks plus restart policies give you a self-healing service that recovers from most failures with no human awake at 3am. 🌙

Quick Check

What is the difference between a liveness and a readiness check?

Recap: Health & Restarts

A cheap /health endpoint plus a restart policy makes your server self-healing: probes catch failures and the platform brings it back. 💪

よくある質問

「ヘルスチェックと再起動」レッスンは無料ですか?

はい。「ヘルスチェックと再起動」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、MCP Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 MCP Academyコースには全4レッスンが含まれています。

「ヘルスチェックと再起動」で何を学びますか?

サービスを稼働させ、自動復旧できる状態に保ちます。 ブラウザで直接実行するハンズオンコードでMCP Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

MCP Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのMCP Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。

「ヘルスチェックと再起動」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このMCP Academyレッスンでコードを書いて実行できますか?

はい。すべてのMCP Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. サーバーをDockerにパッケージ化する
  2. リバースプロキシの背後で実行する
  3. ヘルスチェックと再起動
  4. リモートクライアントを接続する
← MCP Academyに戻る