crisis/metrics.py: CrisisMetrics class — aggregate crisis detection metrics Privacy-first: stores only counts, never user content Daily JSONL files in ~/.the-door/metrics/ get_summary(days) → AggregateMetrics get_report(days) → human-readable report get_json(days) → JSON export CLI: python3 -m crisis.metrics --summary/--json crisis/__init__.py: Export CrisisMetrics, AggregateMetrics Makefile: make metrics → summary report make metrics-json → JSON export tests/test_crisis_metrics.py: 6 tests record_session, summary, report, JSON export
57 lines
1.7 KiB
Makefile
57 lines
1.7 KiB
Makefile
# The Door — Makefile
|
|
# Crisis front door deployment commands
|
|
#
|
|
# Usage:
|
|
# make deploy # Full VPS provisioning via Ansible
|
|
# make deploy-bash # Run deploy.sh on VPS directly
|
|
# make check # Check deployment health
|
|
# make ssl # Setup SSL on VPS
|
|
# make push # Push site files only (fast update)
|
|
|
|
VPS := alexanderwhitestone.com
|
|
DOMAIN := alexanderwhitestone.com
|
|
DEPLOY_DIR := deploy
|
|
|
|
.PHONY: help deploy deploy-bash check ssl push service metrics
|
|
|
|
help:
|
|
@echo "The Door — Deployment Commands"
|
|
@echo ""
|
|
@echo " make deploy Full VPS provisioning (Ansible)"
|
|
@echo " make deploy-bash Run deploy.sh on VPS (SSH)"
|
|
@echo " make push Push site files only (fast)"
|
|
@echo " make check Check deployment status"
|
|
@echo " make ssl Setup SSL on VPS"
|
|
@echo " make service Install/restart hermes-gateway service"
|
|
@echo " make metrics View crisis metrics summary"
|
|
@echo " make metrics-json Export crisis metrics as JSON"
|
|
@echo ""
|
|
|
|
deploy:
|
|
cd $(DEPLOY_DIR) && ansible-playbook -i inventory.ini playbook.yml
|
|
|
|
deploy-bash:
|
|
scp -r ./* root@$(VPS):/opt/the-door/
|
|
ssh root@$(VPS) "cd /opt/the-door && bash deploy/deploy.sh"
|
|
|
|
push:
|
|
rsync -avz --exclude='.git' --exclude='deploy' \
|
|
index.html manifest.json sw.js about.html crisis-offline.html testimony.html system-prompt.txt \
|
|
root@$(VPS):/var/www/the-door/
|
|
ssh root@$(VPS) "chown -R www-data:www-data /var/www/the-door"
|
|
|
|
check:
|
|
ssh root@$(VPS) "bash /opt/the-door/deploy/deploy.sh --check"
|
|
|
|
ssl:
|
|
ssh root@$(VPS) "certbot --nginx -d $(DOMAIN) -d www.$(DOMAIN)"
|
|
|
|
service:
|
|
ssh root@$(VPS) "cd /opt/the-door && bash deploy/deploy.sh --service"
|
|
|
|
metrics:
|
|
python3 -m crisis.metrics --summary
|
|
|
|
metrics-json:
|
|
python3 -m crisis.metrics --json
|