summaryrefslogtreecommitdiff
path: root/CLAUDE.md
diff options
context:
space:
mode:
authoryyamashita <yyamashita@hetzner.yyamashita.com>2026-10-31 19:40:16 +0900
committeryyamashita <yyamashita@hetzner.yyamashita.com>2026-10-31 19:40:16 +0900
commitf967c90db70a6cc983b579589185185d6be66aa6 (patch)
treea30c93619481d0b00a202563d441aaa40eebf341 /CLAUDE.md
parent1e4a737175beb504b8fcb1271955d31b670a6563 (diff)
docs: document status/ntfy setup, Caddy reload, and DNS key location
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'CLAUDE.md')
-rw-r--r--CLAUDE.md35
1 files changed, 22 insertions, 13 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index 5f8ff34..f358721 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -22,6 +22,8 @@ server/ サーバー共通設定(authorized_keys, requirements.md)
- `git push origin master` → post-receive フック → `caddy/deploy.sh` / `cgit/deploy.sh` / `mail/deploy.sh` / `hetzner-admin/deploy.sh` / `vpn/deploy.sh` / `ntfy/deploy.sh` / `status/deploy.sh` を実行
- cgit の `lighttpd.conf` / `Dockerfile` 変更はイメージ再ビルドが必要(`deploy.sh` で `--build` するため push だけで反映される)
- cgit の `cgitrc` はボリュームマウントのため push だけで反映される
+- `caddy/Caddyfile` は `caddy/deploy.sh` が `caddy reload` するため push だけで反映される(無効な Caddyfile なら reload が失敗し、旧設定のまま動き続ける)
+- `status/targets.txt` はチェックごとに再読込されるため push だけで反映される
- フック・リポジトリの変更は push 後に `bash /app/infra/git/install.sh` を手動実行
- Claude セッションの変更は push 後に `bash /app/infra/claude/sync.sh` を手動実行
- mail ドメイン変更(`mail/domains.txt`)は push 後に `bash /app/infra/mail/install.sh` を手動実行
@@ -72,13 +74,8 @@ ssh root@localhost 'bash /app/infra/git/install.sh'
ssh root@<server> 'bash /app/infra/mail/install.sh'
# → DKIM 鍵生成 + コンテナ起動。公開鍵が表示される。
-# Route 53 DNS 設定(サーバー上で実行)
-ssh root@<server>
-export AWS_ACCESS_KEY_ID=...
-export AWS_SECRET_ACCESS_KEY=...
-export HOSTED_ZONE_ID=Z...
-export SERVER_IP=<HetznerサーバーのパブリックIP>
-python3 /app/infra/mail/dns/setup-route53.py
+# Route 53 DNS 設定 → 下の「DNS 登録」参照(AWS キーの場所と実行コマンドあり。
+# HOSTED_ZONE_ID / SERVER_IP は省略時に自動検出)
# mail ドメイン追加(golive → whoisband も追加する例)
vi mail/domains.txt
@@ -140,20 +137,32 @@ ssh root@localhost 'bash /app/infra/git/install.sh' # post-receive フã
ssh root@localhost 'bash /app/infra/ntfy/deploy.sh && bash /app/infra/status/deploy.sh'
# DNS(status / ntfy の CNAME): 下の「DNS 登録」参照
ssh -t root@localhost 'bash /app/infra/ntfy/install.sh' # 管理ユーザー作成(パスワード入力)
-# → トークンを発行して status/.env に NTFY_URL / NTFY_TOKEN を書き込み、status-app を再起動
+# → status トピックを匿名読み取り可にし、トークンを発行して status/.env に NTFY_URL / NTFY_TOKEN を書き込み、status-app を再起動
+# 現サーバーの admin パスワードは /root/ntfy-admin-password(root のみ読める)
# スマホ: ntfy アプリでサーバー https://ntfy.yyamashita.com / トピック status を購読(ログイン不要)
# ディープリンク: ntfy://ntfy.yyamashita.com/status(status ページ下部にもリンクあり)
# ntfy テスト送信
ssh root@localhost 'docker exec ntfy ntfy publish --token "$(grep NTFY_TOKEN /app/infra/status/.env | cut -d= -f2)" http://localhost/status "test"'
-# DNS 登録(初回のみ。setup-route53.py に proxy が含まれている)
-ssh root@<server>
-export AWS_ACCESS_KEY_ID=...
-export AWS_SECRET_ACCESS_KEY=...
-python3 /app/infra/mail/dns/setup-route53.py
+# DNS 登録(サブドメイン追加時。WEB_SUBDOMAINS に CNAME、mail 用 TXT も UPSERT する)
+# AWS キーは /home/yyamashita/workspaces/repos/mosquitone-admin/.env にある。DKIM 鍵を読むため root で実行
+ssh root@localhost 'set -a; eval "$(grep -E "^(export )?AWS_(ACCESS_KEY_ID|SECRET_ACCESS_KEY|DEFAULT_REGION)=" /home/yyamashita/workspaces/repos/mosquitone-admin/.env)"; set +a; python3 /app/infra/mail/dns/setup-route53.py'
+# UPSERT のみで削除はしない。サブドメインを廃止したら Route 53 から手動で CNAME を消す
+# 「SKIP TXT golive.yyamashita.com」は既存レコードとの競合で、正常
```
+## ステータス・通知
+
+- ステータスページ: https://status.yyamashita.com (JSON: `/api/status`。hetzner-admin 上部にもリンク)
+- 監視対象: `status/targets.txt`(60 秒ごと。HTTP は 5xx 未満で UP、`tcp://` は接続できれば UP)
+- 通知: ntfy `https://ntfy.yyamashita.com` のトピック `status`
+ - DOWN(2 回連続失敗、優先度 高)/ recovered(優先度 普通)/ 毎朝 8:00 JST の Daily status(優先度 低)
+ - 購読はログイン不要(アプリで購読、またはディープリンク `ntfy://ntfy.yyamashita.com/status`)
+ - 送信は status-app のトークン(`status/.env`)のみ。他トピックは全拒否
+- 稼働履歴・日次集計は status-app のメモリ上のみ(コンテナ再起動でリセット。8 時以降に再起動した日のサマリーは翌朝に回る)
+- 案(未実施): ntfy の Web Push を有効化(`ntfy webpush keys` → server.yml)すると ntfy.yyamashita.com を PWA として通知受信できる
+
## VPN クライアント設定
**iOS / macOS** (ネイティブ IKEv2):