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 --- ntfy/install.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 ntfy/install.sh (limited to 'ntfy/install.sh') diff --git a/ntfy/install.sh b/ntfy/install.sh new file mode 100755 index 0000000..f65f867 --- /dev/null +++ b/ntfy/install.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# 初回セットアップ: コンテナ起動 → 管理ユーザー作成 → status-app 用トークン発行 +set -euo pipefail +cd "$(dirname "$0")" + +USER_NAME="${1:-admin}" +TOPIC="${NTFY_TOPIC:-status}" +STATUS_ENV="$(pwd)/../status/.env" + +bash ./deploy.sh +sleep 2 + +if docker exec ntfy ntfy user list 2>&1 | grep -q "^user $USER_NAME "; then + echo "User $USER_NAME already exists" +else + echo "Creating ntfy admin user: $USER_NAME" + docker exec -it ntfy ntfy user add --role=admin "$USER_NAME" +fi + +if grep -q '^NTFY_TOKEN=' "$STATUS_ENV" 2>/dev/null; then + echo "NTFY_TOKEN already set in $STATUS_ENV" +else + TOKEN=$(docker exec ntfy ntfy token add --label=status-app "$USER_NAME" | grep -o 'tk_[a-z0-9]*') + { + echo "NTFY_URL=http://ntfy/$TOPIC" + echo "NTFY_TOKEN=$TOKEN" + } >> "$STATUS_ENV" + chmod 600 "$STATUS_ENV" + echo "Token written to $STATUS_ENV" + bash ../status/deploy.sh +fi + +echo "" +echo "購読: ntfy アプリで サーバー https://ntfy.yyamashita.com / トピック $TOPIC / ユーザー $USER_NAME でログイン" -- cgit v1.3