rithub-billing recorded who paid but told nobody and never linked a payment to a Rithub login. The lifecycle timer now runs a Pro pass: email -> login link, one 'rithub pro is on' mail to the customer, an owner mail on every status change, and pro-users.json as the one list later Pro limits read. Tested on railyard-box with a fake entitlement and mail.tm inboxes: mails delivered, second run sends nothing, revoke mails the owner only. rithub-billing source copied in from the box (it only lived there). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
1.4 KiB
Bash
26 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
# Install rithub-lifecycle on railyard-box (run on the box as root, from a
|
|
# checkout or /opt/railyard).
|
|
# sudo bash apps/rithub-lifecycle/install.sh
|
|
# Needs /etc/products/rithub-lifecycle.env (see .env.example in this
|
|
# directory). Sending reuses the SMTP credentials Rithub's own password-reset
|
|
# mail already sends through (/etc/products/rago.env) and the admin API
|
|
# token already minted for rithub-mcp (/etc/products/rithub-mcp.env).
|
|
set -euo pipefail
|
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
install -d -m 755 /opt/railyard/rithub-lifecycle /var/lib/rithub-lifecycle
|
|
if [[ "$HERE" != /opt/railyard/rithub-lifecycle ]]; then
|
|
install -m 755 "$HERE/rithub-lifecycle.py" /opt/railyard/rithub-lifecycle/rithub-lifecycle.py
|
|
install -m 644 "$HERE/rithub_pro.py" /opt/railyard/rithub-lifecycle/rithub_pro.py
|
|
fi
|
|
install -m 644 "$HERE/rithub-lifecycle.service" "$HERE/rithub-lifecycle.timer" /etc/systemd/system/
|
|
test -f /etc/products/rithub-lifecycle.env || echo "WARNING: /etc/products/rithub-lifecycle.env missing (see .env.example — this job will log 'NOT CONFIGURED' instead of mailing)"
|
|
|
|
# One-time seed: never auto-"welcome" an account that already existed before
|
|
# this service went live. Safe to re-run (idempotent).
|
|
/usr/bin/python3 /opt/railyard/rithub-lifecycle/rithub-lifecycle.py --seed-existing
|
|
|
|
systemctl daemon-reload
|
|
systemctl enable --now rithub-lifecycle.timer
|
|
systemctl list-timers rithub-lifecycle.timer --no-pager | head -3
|