# 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) public/admin/scripts/main.js # Admin JavaScript (if not already there) ``` ### Verify these files exist on server: ``` public/admin/scripts/main.js # Admin functionality ``` ## Deployment Steps 1. **Copy files to server:** ```bash # 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/ # Verify admin scripts exist scp public/admin/scripts/main.js user@server:/opt/rtsda/public/admin/scripts/ ``` 2. **SSH into server:** ```bash ssh user@server cd /opt/rtsda ``` 3. **Build and restart:** ```bash npm run build pm2 restart astro-app ``` ## Testing After Deployment 1. **Test bulletin fix:** - Visit: `https://yourdomain.com/bulletin/5bebfe94-71ca-4a72-b9a8-ecd1195c8182` - Should show bulletin content, not "bulletin not found" 2. **Test admin dashboard:** - Visit: `https://yourdomain.com/admin/` - Should show login screen - Login with admin credentials - Verify all sections work: Events, Bulletins, Schedules ## Potential Issues & Solutions ### Build Errors: ```bash # 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: ```bash # 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: ```bash # 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*