docs(infra): 運用手順を private runbook へ移し README には境界だけ残す - #112
Merged
Conversation
Public Repository Hygiene は「deploy / restore の具体手順は commit しない、 docs では設計意図と境界を説明する」と定めているが、踏み台と DB 初期構築の 2 節が コマンド列をそのまま持っていた。置き場 (.claude/commands/private-production-runbook.md) は .gitignore に登録済みで未使用だったので、そちらへ移す。 あわせて、今回の作業で判明した 2 点を境界の説明として書き直す。 - 踏み台が admin 専用なのは設計。role に boundary を付けられず (boundary が ssmmessages:* を Deny)、boundary 無しの role 作成を terraform-apply が拒否する。 CI 経路で通らないのは fail-closed が効いた結果で、穴を開けて通すものではない。 - トンネル越しに verify-full を保つ方法が client で違う。libpq は host/hostaddr を 分離できるが asyncpg / pg には無い。検証を落として解決しない (db_ssl は 「検証なし TLS を持たない」と宣言しており、手順書に抜け道を作ると宣言が 意味を失う)。旧記述の「内側の TLS は require で足りる」は誤り。 DB 初期構築節は手順を落とし、順序を決めている制約 (schema 作成主体が Better Auth CLI と alembic に割れている / 統合テストは create_all なので この順序依存が現れない) を残す。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
「DB 初期構築」節は README から private runbook へ移したため、コメントの参照が 存在しない節を指していた。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
背景
CLAUDE.md の Public Repository Hygiene はこう定めている。
しかし
infra/aws/README.mdの「DB 踏み台」「DB 初期構築」の 2 節は、コマンド列をそのまま持っていた。置き場である.claude/commands/private-production-runbook.mdは.gitignoreに登録済みだったが未使用だったので、そちらへ移す。本番へ z10 / z11 を適用する作業で、この 2 節の記述が実地とズレていることも判明したため、あわせて境界の説明として書き直す。
移したもの (private runbook 側)
踏み台の生成 / トンネル / 撤去、hosts の追加削除、alembic の実行 URL、
db-provision.sqlと Better Auth CLI の実行、instance-id / endpoint の取り方。残したもの (境界と設計判断)
踏み台
ssmmessages:*を Deny)、boundary 無しの role 作成をterraform-applyがDenyRoleCreationWithoutBoundaryで拒否する。ssm:StartSessionも持たない。CI 経路で通らないのは fail-closed が効いた結果で、穴を開けて通すものではないverify-fullを保つ方法が client で違う。 libpq はhost/hostaddrを分離できるが asyncpg / pg には無い。証明書の検証を落として解決しない —db_ssl.pyは「検証なし TLS というモードを持たない」と宣言しており、手順書に抜け道を作るとその宣言が意味を失う旧記述の「内側の TLS は require で足りる」は誤りだった。
requireはdb_sslが verify-full に格上げするため CN 不一致で落ちる。逆にsslmodeを省くと asyncpg 既定のpreferに落ち、検証なし TLS で繋がってしまう (rds.force_ssl=1は満たすので気づけない)。DB の構築と migration
create_allで焼くため、この順序依存は migration 経路でしか現れないMIGRATION_KINDとscripts/migration_gate.py公開範囲
実 endpoint 名・アカウント ID・instance-id は README に含まない (
grepで 0 件を確認)。private runbook 側は gitignored で、そこにも秘密の値そのもの (password / token) は書かず取り出し方だけを置いている。経緯
先行して #111 を出していたが、あちらは運用手順を公開 README に厚く書き足す方向だったため取り下げた。
🤖 Generated with Claude Code