Skip to main content

Deployment Troubleshooting

IssueCause & Resolution
502 Bad Gateway from NginxGunicorn not running. Check: sudo systemctl status proenergia. View logs: sudo journalctl -u proenergia -n 50
PMTiles not generatingCelery worker not running. Check: sudo systemctl status proenergia-celery. Also verify RabbitMQ: sudo rabbitmqctl status
Connection refused to RabbitMQRabbitMQ stopped. Run: sudo systemctl start rabbitmq-server
Database connection errorsCheck DATABASE_URL in .env. Verify PostgreSQL: sudo systemctl status postgresql
Settings import errors at startupDJANGO_SECRET_KEY is not set. Verify .env exists and is readable by the proenergia user.
Static files returning 404Run: python manage.py collectstatic --noinput. Verify Nginx serves the STATIC_ROOT path.
Migrations fail on restartRun migrate manually and check for errors before restarting services.
Translation errors (compilemessages)gettext tools may be missing. Install: sudo apt install gettext. Then rerun compilemessages.
SSL certificate issuesRun: sudo certbot renew --dry-run. Check Nginx config: sudo nginx -t
Webhook not triggeringCheck: sudo systemctl status proenergia-webhook. View secret: sudo cat /var/www/proenergia/webhook_secret.txt. Check GitHub webhook delivery logs.
Database cache table missingRun: python manage.py createcachetable. The table summaries_cache_table must exist for the application to start.