3.6 KiB
3.6 KiB
SkyArtShop Site Recovery Guide
Issues Fixed (January 23, 2026)
Root Causes Identified
- Rate Limiter IPv6 Error - Backend was crashing on startup
- Database Permission Denied - User
ptscouldn't access tables - Database Connection Pool Errors - Connections being terminated
Fixes Applied
1. Fixed Rate Limiter (rateLimiter.js)
Problem: Custom keyGenerator was not IPv6-compliant, causing backend crashes
Solution: Removed custom keyGenerator to use express-rate-limit defaults
// REMOVED the custom keyGenerator that was causing IPv6 validation errors
// Now using default IP handling which is IPv6-safe
2. Fixed Database Permissions
Problem: User pts had no permissions on database tables
Solution:
sudo -u postgres psql -d skyartshop -f backend/scripts/fix-db-permissions.sql
This grants:
- SELECT, INSERT, UPDATE, DELETE on all tables
- USAGE, SELECT on all sequences
- EXECUTE on all functions
- Default privileges for future objects
3. Database Connection Stability
Problem: Database pool errors causing disconnections
Solution: Restarted backend after permission fixes
pm2 restart skyartshop
Monitoring & Prevention
Health Monitor Script
Run anytime to check system status:
/media/pts/Website/SkyArtShop/backend/scripts/health-monitor.sh
Checks:
- PM2 process status
- Backend port availability
- Database connectivity
- Database permissions
- HTTP/HTTPS responses
- CSS asset loading
- Recent error counts
Quick Troubleshooting Commands
Check if site is accessible
curl -I https://skyartshop.dynns.com
Check backend status
pm2 status
pm2 logs skyartshop --lines 20
Check database connection
psql -U pts -d skyartshop -c "SELECT COUNT(*) FROM pages WHERE isactive = true;"
Restart backend
pm2 restart skyartshop
Fix database permissions
sudo -u postgres psql -d skyartshop -f /media/pts/Website/SkyArtShop/backend/scripts/fix-db-permissions.sql
Prevention Measures
1. Always check logs after restart
pm2 logs skyartshop --lines 50 --nostream
2. Run health monitor before and after changes
./backend/scripts/health-monitor.sh
3. Keep database permissions script ready
Location: /media/pts/Website/SkyArtShop/backend/scripts/fix-db-permissions.sql
4. Monitor for these error patterns
ERR_ERL_KEY_GEN_IPV6- Rate limiter issuespermission denied- Database permission issuesterminating connection- Database pool issuesRoute not found- Routing configuration issues
Symptoms & Solutions
| Symptom | Likely Cause | Solution |
|---|---|---|
| Pink background, no content | Backend crash/not running | Check PM2 logs, restart backend |
| 502 Bad Gateway | Backend not listening | Restart PM2: pm2 restart skyartshop |
| Database errors in logs | Permission issues | Run fix-db-permissions.sql |
| Backend crashes on startup | Code error (check error.log) | Review recent code changes, check logs |
| CSS not loading | Nginx/static file issue | Check nginx config, restart nginx |
Current Status (2026-01-23 22:52)
✅ All systems operational ✅ Backend running (PM2) ✅ Database connected ✅ Permissions fixed ✅ Site accessible at https://skyartshop.dynns.com ✅ CSS and assets loading correctly
Contact & Support
- Backend logs:
/media/pts/Website/SkyArtShop/backend/logs/ - Health monitor:
./backend/scripts/health-monitor.sh - DB permissions:
./backend/scripts/fix-db-permissions.sql