# Startup Checklist - House of Prayer Music Database ## Quick Health Check Run this command to verify all services: ```bash ./scripts/health-check.sh ``` ## Manual Service Verification ### 1. Frontend (Vite Dev Server) - **Port**: 5100 - **Check**: `lsof -i:5100 -sTCP:LISTEN` - **Start**: `cd frontend && npm run dev &` - **Log**: Check output or `/tmp/frontend.log` ### 2. Backend (Node/Express API) - **Port**: 8080 - **Check**: `lsof -i:8080 -sTCP:LISTEN` - **Test**: `curl http://localhost:8080/api/songs` - **Start**: `cd backend && node server.js &` ### 3. Nginx (Reverse Proxy + HTTPS) - **Port**: 443 (HTTPS), 80 (HTTP redirect) - **Check**: `sudo lsof -i:443 -sTCP:LISTEN` - **Status**: `systemctl status nginx` - **Restart**: `sudo systemctl restart nginx` ### 4. PostgreSQL Database - **Port**: 5432 - **Check**: `sudo systemctl status postgresql` - **Test**: `psql -U church_admin -d church_songlyric -c "SELECT COUNT(*) FROM songs;"` ## Common Issues & Solutions ### Issue: "Blocked request. This host is not allowed" **Root Cause**: Vite's `allowedHosts` configuration not loaded or outdated frontend process **Solution**: 1. Check `frontend/vite.config.js` has correct `allowedHosts` array 2. Kill old Vite process: `kill $(lsof -ti:5100)` 3. Restart frontend: `cd frontend && npm run dev &` 4. Test: `curl -H "Host: houseofprayer.ddns.net" http://localhost:5100/` **Prevention**: Always restart frontend after config changes ### Issue: Frontend not accessible externally **Checklist**: - [ ] DNS resolves: `nslookup houseofprayer.ddns.net` → 170.254.17.146 - [ ] Firewall allows 443: `sudo ufw status | grep 443` - [ ] Nginx running: `systemctl is-active nginx` - [ ] SSL cert valid: `sudo certbot certificates` - [ ] Frontend responds locally: `curl http://localhost:5100` ### Issue: Backend API 404 errors **Checklist**: - [ ] Backend process running: `ps aux | grep 'node server.js'` - [ ] Port 8080 listening: `lsof -i:8080` - [ ] Database connected: Check backend logs - [ ] CORS configured for domain: See `server.js` allowedOrigins ## Configuration Files to Monitor 1. **frontend/vite.config.js** - Frontend dev server settings - `allowedHosts` must include domain and wildcards - `host: true` enables network access - Restart required after changes 2. **backend/server.js** - Backend API configuration - `allowedOrigins` in CORS middleware - Database connection settings - Port 8080 3. **nginx-ssl.conf** - Reverse proxy and SSL - Proxies `/` to frontend (5100) - Proxies `/api` to backend (8080) - SSL certificates location 4. **backend/.env** - Environment variables (if exists) - Database credentials - JWT secrets - Port settings ## Testing External Access ```bash # From server (localhost) curl -H "Host: houseofprayer.ddns.net" http://localhost:5100/ # From any device on network curl http://192.168.10.130:5100/ # From internet (public) curl https://houseofprayer.ddns.net ``` ## Logs Location - **Frontend**: Terminal output or `/tmp/frontend.log` - **Backend**: Terminal output or `backend/logs/` - **Nginx Access**: `/var/log/nginx/church-music-access.log` - **Nginx Error**: `/var/log/nginx/church-music-error.log` - **PostgreSQL**: `/var/log/postgresql/` ## Emergency Recovery If site is completely down: ```bash # Kill all processes killall node kill $(lsof -ti:5100) kill $(lsof -ti:8080) # Restart PostgreSQL sudo systemctl restart postgresql # Restart Nginx sudo systemctl restart nginx # Start backend cd /media/pts/Website/Church_HOP_MusicData/new-site/backend node server.js > /tmp/backend.log 2>&1 & # Start frontend cd /media/pts/Website/Church_HOP_MusicData/new-site/frontend npm run dev > /tmp/frontend.log 2>&1 & # Verify sleep 3 lsof -i:5100 -i:8080 | grep LISTEN ``` ## Production Deployment Notes For production, replace Vite dev server with built static files: ```bash # Build frontend cd frontend npm run build # Serve with Nginx (update nginx-ssl.conf location / block) # Point to: /media/pts/Website/Church_HOP_MusicData/new-site/frontend/dist ``` --- **Last Updated**: 2026-01-26 **Site URL**: **Server IP**: 170.254.17.146