RTSDA-Website/DEPLOYMENT.md
Benjamin Slingo 91a1bb7a54 Restructure project and update gitignore
- Flatten directory structure by moving files from astro-church-website/ to root
- Remove church-core subdirectory in favor of inline Rust library
- Update .gitignore to properly exclude build artifacts, generated files, and dependencies
- Add environment variables, IDE files, and coverage reports to gitignore
- Include generated CSS files and native bindings in ignore patterns
2025-08-30 08:59:27 -04:00

124 lines
3 KiB
Markdown

# 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
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/
# Copy new admin API routes
scp -r src/pages/admin/api/ user@server:/opt/rtsda/src/pages/admin/
```
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*