# DNS Switchover Instructions - MAD Lawsuit v2.0 ## Overview This document provides step-by-step instructions to switch `mad-lawsuit.org` from v1.0 (Next.js) to v2.0 (Laravel). ## Pre-Switchover Checklist - ✅ v2.0 fully tested at https://v2.mad-lawsuit.org - ✅ All data migrated (63 entries, 63 documents, 28 subscribers) - ✅ Admin dashboard functional - ✅ PDF uploads working - ✅ iOS/iPad PDF viewing fixed - ✅ .env updated with mad-lawsuit.org URLs - ✅ docker-compose.yml updated to use port 806 - ✅ Caddyfile updated on server ## Deployment Steps ### 1. SSH to Production Server ```bash ssh chaulmark@10.4.0.205 ``` ### 2. Stop v1.0 Containers (Old mad-lawsuit.org) ```bash cd ~/websites/mad-lawsuit.org docker compose down ``` ### 3. Pull Latest v2.0 Code ```bash cd ~/websites/v2.mad-lawsuit.org git pull origin main ``` ### 4. Rebuild v2.0 Container with New Port ```bash docker compose down docker compose up -d --build ``` ### 5. Verify Container is Running on Port 806 ```bash docker compose ps # Should show mad-lawsuit-v2 running on 0.0.0.0:806->80/tcp ``` ### 6. Clear Laravel Cache ```bash docker exec mad-lawsuit-v2 php artisan config:clear docker exec mad-lawsuit-v2 php artisan cache:clear docker exec mad-lawsuit-v2 php artisan route:clear ``` ### 7. Reload Caddy Configuration ```bash docker exec caddy caddy reload --config /etc/caddy/Caddyfile ``` ### 8. Test the Switchover ```bash # Test from command line curl -I https://mad-lawsuit.org # Should return HTTP/2 200 # Should show Laravel headers ``` ### 9. Browser Testing Open https://mad-lawsuit.org in multiple browsers: - ✅ Desktop Chrome/Firefox/Safari - ✅ Mobile Chrome/Safari - ✅ iPad Safari (test PDF viewing) ### 10. Verify All Functionality - [ ] Home page loads correctly - [ ] Docket entries display properly - [ ] PDF documents open correctly - [ ] iPad PDF viewing works (opens in new tab) - [ ] Admin login works: https://mad-lawsuit.org/admin/login - [ ] Admin dashboard accessible - [ ] Can create/edit/delete docket entries - [ ] Can upload PDFs - [ ] Email subscription works ## Configuration Details ### Port Mapping - **v1.0 (Old)**: Port 806 (now stopped) - **v2.0 (New)**: Port 806 (same port, different container) ### Caddyfile Configuration ```caddyfile # MAD Lawsuit V2 (Production) www.mad-lawsuit.org { redir https://mad-lawsuit.org{uri} permanent } mad-lawsuit.org { reverse_proxy 172.18.0.6:806 } # Old v2 subdomain redirects to main domain v2.mad-lawsuit.org { redir https://mad-lawsuit.org{uri} permanent } www.v2.mad-lawsuit.org { redir https://mad-lawsuit.org{uri} permanent } ``` ### Docker Network - **Network**: `caddy_network` (external) - **Container IP**: 172.18.0.6 - **Container Port**: 80 (internal) - **Host Port**: 806 (external) ## Rollback Plan (If Needed) If issues arise, you can quickly rollback to v1.0: ### 1. Stop v2.0 Container ```bash cd ~/websites/v2.mad-lawsuit.org docker compose down ``` ### 2. Restore Original Caddyfile ```bash # Download backup Caddyfile (if you made one) # Or manually edit to point back to v1.0 ``` ### 3. Start v1.0 Containers ```bash cd ~/websites/mad-lawsuit.org docker compose up -d ``` ### 4. Reload Caddy ```bash docker exec caddy caddy reload --config /etc/caddy/Caddyfile ``` ## Post-Switchover Tasks ### Immediate (Within 24 hours) - [ ] Monitor error logs: `docker logs mad-lawsuit-v2 -f` - [ ] Check database connections - [ ] Verify email notifications work - [ ] Test all admin functions ### Within 1 Week - [ ] Remove v1.0 containers permanently - [ ] Clean up old v1.0 files (optional backup first) - [ ] Update documentation - [ ] Notify Eliza of successful switchover ### Optional Enhancements - [ ] Set up automated backups - [ ] Configure monitoring/alerts - [ ] Implement email notifications for new entries - [ ] Add Redis caching for performance ## Troubleshooting ### Issue: Site not loading **Solution**: Check container status ```bash docker compose ps docker logs mad-lawsuit-v2 --tail 50 ``` ### Issue: 502 Bad Gateway **Solution**: Verify Caddy can reach container ```bash docker exec caddy caddy validate --config /etc/caddy/Caddyfile docker network inspect caddy_network ``` ### Issue: Database connection errors **Solution**: Check PostgreSQL container ```bash docker compose ps postgres docker logs mad-lawsuit-v2-db --tail 50 ``` ### Issue: PDFs not loading **Solution**: Check file permissions and storage ```bash docker exec mad-lawsuit-v2 ls -la storage/app/public/documents docker exec mad-lawsuit-v2 php artisan storage:link ``` ## Important Notes 1. **SSL Certificates**: Caddy automatically handles SSL for mad-lawsuit.org (Let's Encrypt) 2. **Database**: PostgreSQL data persists in Docker volume `postgres_data` 3. **PDF Files**: Stored in `./storage/app/public/documents` (bind mount) 4. **No Downtime**: Switchover should be nearly instant (< 1 minute) 5. **DNS**: No DNS changes needed - same domain, different backend ## Success Criteria ✅ https://mad-lawsuit.org loads v2.0 application ✅ All 63 docket entries visible ✅ All 63 PDFs accessible ✅ Admin dashboard functional ✅ iPad PDF viewing works correctly ✅ No errors in logs ✅ SSL certificate valid ## Contact If issues arise: - Check logs: `docker logs mad-lawsuit-v2 -f` - Review this document - Rollback if necessary (see Rollback Plan above) --- **Last Updated**: December 19, 2025 **Version**: 2.0 **Status**: Ready for deployment