
Major architecture cleanup following CLAUDE.md rules: ## Admin Panel Conversion (1843 lines → TypeScript routes) - Remove public/admin/scripts/main.js (direct API calls violation) - Add proper Astro admin routes with TypeScript API endpoints - Add missing admin functions in church-core Rust crate - Update bindings.js to expose new admin functions ## Thumbnail Field Removal - Remove thumbnail upload section from event submission form - Clean up thumbnail-related JavaScript code ## Architecture Compliance Achieved ✅ Frontend → bindings.js → Rust FFI → church-core → API ❌ Frontend → fetch() → External API (eliminated) Files: +13 admin routes, -1843 line JS file, enhanced Rust core
3 KiB
3 KiB
Deployment Instructions
Files to Copy to Server
New/Modified Files:
src/pages/admin/index.astro # Main admin dashboard page
src/components/admin/Login.astro # Admin login component
src/pages/bulletin/[id].astro # Fixed bulletin detail page (SSR)
src/pages/admin/ # New Astro admin routes (TypeScript)
Verify these files exist on server:
src/pages/admin/ # New admin routes using Rust bindings
Deployment Steps
-
Copy files to server:
# Copy new admin components scp -r src/pages/admin/ user@server:/opt/rtsda/src/pages/ scp -r src/components/admin/ user@server:/opt/rtsda/src/components/ # Copy fixed bulletin page scp src/pages/bulletin/[id].astro user@server:/opt/rtsda/src/pages/bulletin/ # Copy new admin API routes scp -r src/pages/admin/api/ user@server:/opt/rtsda/src/pages/admin/
-
SSH into server:
ssh user@server cd /opt/rtsda
-
Build and restart:
npm run build pm2 restart astro-app
Testing After Deployment
-
Test bulletin fix:
- Visit:
https://yourdomain.com/bulletin/5bebfe94-71ca-4a72-b9a8-ecd1195c8182
- Should show bulletin content, not "bulletin not found"
- Visit:
-
Test admin dashboard:
- Visit:
https://yourdomain.com/admin/
- Should show login screen
- Login with admin credentials
- Verify all sections work: Events, Bulletins, Schedules
- Visit:
Potential Issues & Solutions
Build Errors:
# If node version issues:
node --version # Should be 20.x
npm --version
# If dependency issues:
rm -rf node_modules package-lock.json
npm install
npm run build
Permission Issues:
# Fix ownership
sudo chown -R $USER:$USER /opt/rtsda
chmod -R 755 /opt/rtsda
# Fix specific file permissions
chmod 644 src/pages/admin/index.astro
chmod 644 src/components/admin/Login.astro
chmod 644 src/pages/bulletin/[id].astro
Admin Route Not Working:
- Check if
/admin/
route is accessible - Verify admin files were copied correctly
- Check PM2 logs:
pm2 logs astro-app
Styles Not Loading:
- Hard refresh browser (Ctrl+F5)
- Check if build completed successfully
- Verify no CSS compilation errors in build output
Rollback Plan
If something breaks:
# Quick rollback
git status
git checkout -- src/pages/bulletin/[id].astro
rm -rf src/pages/admin/
rm -rf src/components/admin/
npm run build
pm2 restart astro-app
Success Indicators
✅ Build completes without errors
✅ Bulletin pages show content instead of "not found"
✅ /admin/
shows login screen
✅ Admin dashboard fully functional after login
✅ Site loads normally for regular visitors
Notes
- Admin dashboard is completely hidden from public navigation
- Only accessible via direct URL:
/admin/
- Requires valid JWT authentication
- All original functionality preserved
- Styling matches main site theme
"It should be simple, but it probably won't be." - Murphy's Law of Deployment