From b4ecef96fae14a92d12279927986e69c2e223180 Mon Sep 17 00:00:00 2001 From: yyamashita Date: Sat, 31 Oct 2026 13:20:27 +0900 Subject: Add status pages, ntfy alerts, and license-slot-checker repo - status/: lightweight status checker (status.yyamashita.com, /api/status) with ntfy DOWN/recovered alerts after consecutive failures - uptime-kuma/: Uptime Kuma at uptime.yyamashita.com - hetzner-admin: authenticated /status page (status-app results + docker ps -a) - ntfy/: self-hosted ntfy at ntfy.yyamashita.com (deny-all auth, install.sh creates admin user and status-app token) - Caddyfile, DNS, post-receive hook, tests/check.sh, docs updated - license-slot-checker: add to repos.txt, hook, and Claude sessions Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'CLAUDE.md') diff --git a/CLAUDE.md b/CLAUDE.md index 1ab0691..eb317bf 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -12,12 +12,15 @@ claude/ Claude Code セッション管理(sessions.txt, systemd unit, hetzner-admin/ サーバー管理 Web UI(app.py, Dockerfile, docker-compose.yml, deploy.sh) mail/ MTA(Postfix + OpenDKIM, docker-compose.yml, install.sh, dns/setup-route53.py) vpn/ strongSwan IKEv2 VPN(Dockerfile, docker-compose.yml, install.sh, renew-cert.sh) +status/ 軽量ステータスページ(app.py, targets.txt, Dockerfile, docker-compose.yml, deploy.sh) +ntfy/ ntfy 通知サーバー(server.yml, docker-compose.yml, deploy.sh, install.sh) +uptime-kuma/ Uptime Kuma 監視(docker-compose.yml, deploy.sh) 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` を実行 +- `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` / `uptime-kuma/deploy.sh` を実行 - cgit の `lighttpd.conf` / `Dockerfile` 変更はイメージ再ビルドが必要(`deploy.sh` で `--build` するため push だけで反映される) - cgit の `cgitrc` はボリュームマウントのため push だけで反映される - フック・リポジトリの変更は push 後に `bash /app/infra/git/install.sh` を手動実行 @@ -35,6 +38,8 @@ server/ サーバー共通設定(authorized_keys, requirements.md) | whois-band | /app/whois-band | | mosquitone-admin | /home/yyamashita/workspaces/repos/mosquitone-admin | | microblog | /app/microblog | +| todo | /app/todo | +| license-slot-checker | /home/yyamashita/workspaces/repos/license-slot-checker | ## よく使うコマンド @@ -123,6 +128,35 @@ docker compose -f /app/infra/vpn/docker-compose.yml restart vi caddy/docker-compose.yml # PROXY_NO_AUTH=1 を削除(VPN と同じ users.conf の Basic 認証に戻る) git push origin master +# ステータスページ(3 種類) +# - status.yyamashita.com : 公開ステータスページ(status/)。監視対象は status/targets.txt +# JSON は /api/status。targets.txt は push だけで反映(次回チェック時に再読込) +# - uptime.yyamashita.com : Uptime Kuma(uptime-kuma/)。監視設定・通知は Web UI で行う(データは volume に永続化) +# - hetzner-admin /status : 認証付き。status-app の結果 + docker ps -a のコンテナ状態 +vi status/targets.txt && git push origin master + +# ステータスページ初回セットアップ +git push origin master +ssh root@localhost 'bash /app/infra/git/install.sh' # post-receive フック更新 +ssh root@localhost 'bash /app/infra/status/deploy.sh && bash /app/infra/uptime-kuma/deploy.sh' +python3 /app/infra/mail/dns/setup-route53.py # status / uptime の CNAME 追加 +# → 直後に https://uptime.yyamashita.com を開いて管理者アカウントを作成する +# (初回アクセスした人が管理者になるため、放置しないこと) + +# ntfy 通知(ntfy.yyamashita.com)初回セットアップ +# 認証必須(deny-all)。status-app が連続 2 回失敗で DOWN、復旧で recovered をトピック "status" に通知 +git push origin master +ssh root@localhost 'bash /app/infra/git/install.sh' # post-receive フック更新 +python3 /app/infra/mail/dns/setup-route53.py # ntfy の CNAME 追加 +ssh -t root@localhost 'bash /app/infra/ntfy/install.sh' # 管理ユーザー作成(パスワード入力) +# → トークンを発行して status/.env に NTFY_URL / NTFY_TOKEN を書き込み、status-app を再起動 +# スマホ: ntfy アプリでサーバー https://ntfy.yyamashita.com を追加し、トピック status を購読(admin でログイン) +# Uptime Kuma: Settings → Notifications → ntfy +# Server URL: http://ntfy / Topic: status / Access Token: ntfy token add admin で発行したもの + +# 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@ export AWS_ACCESS_KEY_ID=... -- cgit v1.3