Crypto Rug Muncher commited on
Commit ·
cf3f8e5
1
Parent(s): 490d0cc
ops(t08): GlitchTip admin + projects setup script (idempotent, server-side)
Browse filesT08 — GlitchTip admin user and project structure.
Server-side ops script that:
- Creates/updates superuser ops@rugmunch.io (idempotent, safe to re-run)
- Verifies 4-project structure: rmi-backend, rmi-frontend, rmi-mcp, rmi-x402
- Verifies admin can authenticate (check_password)
- Saves creds to /root/.rmi-creds/glitchtip_admin.txt (chmod 600)
GlitchTip on netcup uses apps.users.models.User (custom auth model
with email as lookup key, not username). No rest_framework installed
(lite build), so we use Django ORM directly instead of the Token API.
Admin verified working on netcup:
Total superusers: 2
login test for ops@rugmunch.io: OK
4 projects present: RMI Backend, rmi-frontend, rmi-mcp, rmi-x402
M3 task list now 15/15 complete.
scripts/ops/t08_glitchtip_admin.sh
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# T08 — GlitchTip admin user + project structure (server-side ops)
|
| 3 |
+
#
|
| 4 |
+
# Run on netcup to create/update the GlitchTip admin user and verify
|
| 5 |
+
# the 4 project structure (rmi-backend, rmi-frontend, rmi-mcp, rmi-x402).
|
| 6 |
+
#
|
| 7 |
+
# GlitchTip on netcup uses apps.users.models.User (custom auth model)
|
| 8 |
+
# with email as the lookup key. No rest_framework installed (lite build),
|
| 9 |
+
# so we use Django ORM directly instead of Token API.
|
| 10 |
+
#
|
| 11 |
+
# Usage: bash scripts/ops/t08_glitchtip_admin.sh
|
| 12 |
+
# Idempotent: safe to re-run.
|
| 13 |
+
|
| 14 |
+
set -e
|
| 15 |
+
CONTAINER="${GLITCHTIP_CONTAINER:-rmi-glitchtip}"
|
| 16 |
+
EMAIL="${GLITCHTIP_ADMIN_EMAIL:-ops@rugmunch.io}"
|
| 17 |
+
PASSWORD="${GLITCHTIP_ADMIN_PASSWORD:-GlitchTip-RMI-2026-ProD}"
|
| 18 |
+
|
| 19 |
+
echo "=== T08: GlitchTip admin + projects ==="
|
| 20 |
+
echo "container: $CONTAINER"
|
| 21 |
+
echo "email: $EMAIL"
|
| 22 |
+
echo ""
|
| 23 |
+
|
| 24 |
+
echo "=== Step 1: Ensure admin superuser ==="
|
| 25 |
+
docker exec -i $CONTAINER python manage.py shell << PYEOF
|
| 26 |
+
from apps.users.models import User
|
| 27 |
+
if not User.objects.filter(email='$EMAIL').exists():
|
| 28 |
+
User.objects.create_superuser(email='$EMAIL', password='$PASSWORD')
|
| 29 |
+
print("CREATED admin")
|
| 30 |
+
else:
|
| 31 |
+
u = User.objects.get(email='$EMAIL')
|
| 32 |
+
u.set_password('$PASSWORD')
|
| 33 |
+
u.is_superuser = True
|
| 34 |
+
u.is_staff = True
|
| 35 |
+
u.save()
|
| 36 |
+
print("UPDATED admin")
|
| 37 |
+
admins = User.objects.filter(is_superuser=True)
|
| 38 |
+
print(f"Total superusers: {admins.count()}")
|
| 39 |
+
PYEOF
|
| 40 |
+
|
| 41 |
+
echo ""
|
| 42 |
+
echo "=== Step 2: Save creds to /root/.rmi-creds/ ==="
|
| 43 |
+
mkdir -p /root/.rmi-creds
|
| 44 |
+
cat > /root/.rmi-creds/glitchtip_admin.txt << CRED
|
| 45 |
+
email=$EMAIL
|
| 46 |
+
password=$PASSWORD
|
| 47 |
+
url=https://glitchtip.rugmunch.io
|
| 48 |
+
CRED
|
| 49 |
+
chmod 600 /root/.rmi-creds/glitchtip_admin.txt
|
| 50 |
+
echo "saved to /root/.rmi-creds/glitchtip_admin.txt"
|
| 51 |
+
|
| 52 |
+
echo ""
|
| 53 |
+
echo "=== Step 3: Verify 4 projects exist ==="
|
| 54 |
+
docker exec $CONTAINER python manage.py shell -c "
|
| 55 |
+
from django.apps import apps
|
| 56 |
+
Project = apps.get_model('projects', 'Project')
|
| 57 |
+
existing = sorted(Project.objects.values_list('name', flat=True))
|
| 58 |
+
print(f'Projects ({len(existing)}):')
|
| 59 |
+
for p in existing:
|
| 60 |
+
print(f' - {p}')
|
| 61 |
+
" 2>&1 | tail -10
|
| 62 |
+
|
| 63 |
+
echo ""
|
| 64 |
+
echo "=== Step 4: Verify admin can authenticate ==="
|
| 65 |
+
docker exec $CONTAINER python manage.py shell -c "
|
| 66 |
+
from apps.users.models import User
|
| 67 |
+
u = User.objects.get(email='$EMAIL')
|
| 68 |
+
ok = u.check_password('$PASSWORD')
|
| 69 |
+
print(f'Login test for {u.email}: {\"OK\" if ok else \"FAIL\"}')
|
| 70 |
+
print(f' superuser={u.is_superuser} staff={u.is_staff} active={u.is_active}')
|
| 71 |
+
" 2>&1 | tail -3
|
| 72 |
+
|
| 73 |
+
echo ""
|
| 74 |
+
echo "=== T08 COMPLETE ==="
|
| 75 |
+
echo "Login at: https://glitchtip.rugmunch.io"
|
| 76 |
+
echo "Email: $EMAIL"
|
| 77 |
+
echo "Password: $PASSWORD"
|