[feat] デプロイ時にコミットSHAを焼き込み /healthz で識別できるようにする - #9
Merged
Conversation
/healthz は version に GIT_SHA を返すが、これを設定する仕組みが無く、
本番が常に {"ok":true,"version":"dev"} を返していた。障害対応中に
どのコミットが動いているか判別できない状態だった。
deploy スクリプトを scripts/deploy.mjs 経由に変え、wrangler deploy に
--var GIT_SHA:<short-sha> を渡す。未コミットの変更があるときは -dirty を
付け、稼働中のコードがそのコミットと同一でないことを示す。
package.json に $(git rev-parse --short HEAD) を直接書かないのは、pnpm が
Windows では cmd.exe でスクリプトを実行し、コマンド置換が働かないため。
README のデプロイ方法が「main への push で自動デプロイ」となっていたが、
実際はローカルからの手動デプロイなので実態に合わせ、ヘルスチェックの
エンドポイント一覧と監視先の注意点もあわせて記載する。
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
ありがとうございます! これ、healthzとreadyzはどちらもボットに呼ばせる感じですか? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/healthz は version に GIT_SHA を返すが、これを設定する仕組みが無く、
本番が常に {"ok":true,"version":"dev"} を返していた。障害対応中に
どのコミットが動いているか判別できない状態だった。
deploy スクリプトを scripts/deploy.mjs 経由に変え、wrangler deploy に --var GIT_SHA: を渡す。未コミットの変更があるときは -dirty を 付け、稼働中のコードがそのコミットと同一でないことを示す。
package.json に $(git rev-parse --short HEAD) を直接書かないのは、pnpm が Windows では cmd.exe でスクリプトを実行し、コマンド置換が働かないため。
README のデプロイ方法が「main への push で自動デプロイ」となっていたが、
実際はローカルからの手動デプロイなので実態に合わせ、ヘルスチェックの
エンドポイント一覧と監視先の注意点もあわせて記載する。
What & why
How this was tested
pnpm lintpnpm typecheckpnpm buildwrangler devScreenshots (if UI change)