Troubleshooting¶
This guide covers common issues and their solutions for LabID production deployments.
Common Issues¶
Database Connection Errors¶
Symptoms:
- Django application fails to start
- Error messages about database connectivity
- FATAL: password authentication failed in logs
Diagnostics:
# Check PostgreSQL service status
sudo systemctl status postgresql
# Test database connection
sudo -u labid psql -h localhost -U labid -d labid_prod -c "SELECT 1;"
# Check database configuration
sudo -u labid -i
cd /opt/labid/labid
python manage.py check --database default
Solutions:
-
Verify database service is running:
-
Check connection parameters in
.envfile: -
Reset database user password:
-
Check firewall rules:
Celery Workers Not Processing Tasks¶
Symptoms: - Tasks queue up but don't get processed - No worker processes visible - Tasks timeout or remain in pending state
Diagnostics:
# Check Celery worker status
sudo systemctl status labid-celery-worker labid-celery-worker_archive labid-celery-worker_ingestion
# Check RabbitMQ status
sudo systemctl status rabbitmq-server
# Monitor Celery queues
sudo -u labid -i
cd /opt/labid/labid
python manage.py shell -c "
from celery import Celery
app = Celery('labid')
app.config_from_object('django.conf:settings', namespace='CELERY')
inspect = app.control.inspect()
print('Active workers:', inspect.active())
"
Solutions:
-
Restart Celery services:
-
Check RabbitMQ service:
-
Verify Celery configuration:
-
Clear stuck queues:
Static Files Not Loading¶
Symptoms: - Admin interface appears unstyled - Missing CSS/JavaScript files - 404 errors for static resources
Diagnostics:
# Check static files collection
sudo -u labid -i
cd /opt/labid/labid
python manage.py collectstatic --dry-run
# Check Nginx static file configuration
sudo nginx -t
curl -I https://your-labid.com/static/admin/css/base.css
Solutions:
-
Collect static files:
-
Check Nginx configuration:
-
Verify file permissions:
-
Restart Nginx:
UI Shows "Server is down"¶
Symptoms:
- Red "Server is down" banner on the LabID home page immediately after login
- Browser console shows: Blocked loading mixed active content "http://..."
- Network tab shows API requests going to the wrong hostname, scheme, or port (e.g. http://internal-host:8000)
Cause: The UI was compiled with the wrong VITE_API_URL baked in. Because the UI is a compiled single-page application, this value is embedded in the JavaScript bundle at build time — a mismatch (wrong scheme, internal hostname, or direct gunicorn port) causes the browser to block or mis-route API calls even if the backend itself is running correctly.
Diagnostics:
# 1. Check what API URL the browser is actually using
# Open DevTools → Network tab, reload the page, look at where /api/ requests go.
# 2. Verify nginx is proxying the API correctly end-to-end
curl -s https://your-labid.com/api/v2/version
# 3. Check what URL is baked into the current build
grep -r "VITE_API_URL\|api/v2" /opt/labid-ui/dist/assets/*.js | head -5
Fix:
- Edit
/opt/labid-ui/.envand set the correct public HTTPS URL:
!!! danger "Mixed content"
If the site is served over https:// the API URL must also start with https://. Using http:// or an internal hostname causes browsers to block the request as mixed active content.
-
Rebuild the UI:
-
Reload Nginx if needed:
Email Notifications Not Working¶
Symptoms: - No email notifications sent - SMTP connection errors in logs - Email authentication failures
Diagnostics:
# Test email configuration
sudo -u labid -i
cd /opt/labid/labid
python manage.py sendtestemail admin@your-labid.com
# Check email settings in Django shell
python manage.py shell -c "
from django.conf import settings
print('EMAIL_HOST:', settings.EMAIL_HOST)
print('EMAIL_PORT:', settings.EMAIL_PORT)
print('EMAIL_USE_TLS:', settings.EMAIL_USE_TLS)
"
Solutions:
-
Verify SMTP settings in
.env: -
Check firewall rules:
-
Test SMTP connection manually:
Log Locations¶
Application Logs¶
- Django application:
/var/log/labid/django.log - Gunicorn:
journalctl -u labid-gunicorn - Celery workers:
journalctl -u labid-celery-worker - Celery beat:
journalctl -u labid-celery-beat
System Logs¶
- Nginx:
/var/log/nginx/access.logand/var/log/nginx/error.log - PostgreSQL:
/var/log/postgresql/postgresql-*.log - RabbitMQ:
journalctl -u rabbitmq-server - System:
journalctl -xe
Log Analysis Commands¶
# Monitor real-time Django logs
tail -f /var/log/labid/django.log
# Search for errors in the last hour
journalctl -u labid-gunicorn --since "1 hour ago" | grep -i error
# Check Nginx error patterns
grep -E "(50[0-9]|40[0-9])" /var/log/nginx/access.log | tail -20
# Monitor database slow queries
sudo tail -f /var/log/postgresql/postgresql-*.log | grep "duration:"