Automatic maintenance page redirector for sub domains using Cloudflare Workers and Better Stack monitoring.
During maintenance, visitors are redirected to the maintenance page served by yamisskey-down (MAINTENANCE_URL in wrangler.toml).
- Clone and install dependencies:
git clone https://github.com/yamisskey-dev/yamioti.git
cd yamioti
npm install- Configure KV namespace:
wrangler kv:namespace create MAINTENANCE_KVAdd the output ID to wrangler.toml
- Set Better Stack API key:
wrangler secret put BETTERSTACK_API_KEY- Deploy:
wrangler deploy- Configure routes in Cloudflare dashboard:
- Workers & Pages > yamioti > Triggers
- Add Routes such as
(hoge.)yami.ski/*for your sub domains
Enable:
wrangler kv:key put --binding=MAINTENANCE_KV maintenance_mode "true"Disable:
wrangler kv:key put --binding=MAINTENANCE_KV maintenance_mode "false"Check status:
wrangler kv:key get --binding=MAINTENANCE_KV maintenance_modeThe worker automatically redirects to maintenance page when:
- Manual maintenance mode is enabled
- Better Stack detects downtime for monitored domains