10 - Troubleshoot
Here are some bullet points to help you when troubleshoot:
- Kontrollera att porten satt i NGINX-configen överensstämmer med miljövariabeln PORT
- Have you restarded NGINX after doing a configuration change? $
systemclt reload nginx
, $systemctl restart nginx
- What errors are node reporting? $
pm2 logs --lines 100
- Is the docker container running? $
docker ps
- Har du startat om pm2 efter det att du kopierat in uppdaterad kod? $
pm2 restart {ID}
- How many docker instances are running? If to many the machine may run out of memory and Docker will randomly shut down running instances.
- You can show all set enironment variables for a specific pm2 application: $
pm2 env {ID}
- You can add or update a environment varible in a pm2 application by: $
ENV_VAR=somethingnew pm2 restart app --update-env
- If you are using sessions (for flash-messages or auth), make sure to include SESSION_NAME and SESSION_SECRET.
För att underlätta felsökning på servern kan du också byta från NODE_ENV=production till NODE_ENV=development. Då får du ut felmeddelanden i klartext på klienten istället för bara en 500-sida. Glöm inte att byta tillbaka när du fått allt att fungera.