Skip to content

Advanced

Advanced Configuration

Advanced configuration options and customization for TrikuSec.

Custom Settings

Logging Configuration

Customize logging levels and handlers in Django settings.

Static Files

Configure static file serving:

# Collect static files
docker compose run --rm trikusec-manager python manage.py collectstatic --no-input

Media Files

Configure media file storage and serving.

API Configuration

API Versioning

TrikuSec supports API versioning:

  • Versioned API: /api/v1/lynis/upload/, /api/v1/lynis/license/
  • Legacy API: /api/lynis/upload/, /api/lynis/license/

Both endpoints route to the same views for backward compatibility.

Rate Limiting

Customize rate limits per endpoint in Django settings.

Database Optimization

Connection Pooling

For PostgreSQL, configure connection pooling:

DATABASES = {
    'default': {
        'CONN_MAX_AGE': 600,  # Persistent connections
    }
}

Performance Tuning

Caching

Configure caching for better performance:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.redis.RedisCache',
        'LOCATION': 'redis://127.0.0.1:6379/1',
    }
}

Database Queries

Monitor and optimize database queries:

# Enable query logging
DJANGO_DEBUG=True  # Development only

Troubleshooting

Debug Mode

For troubleshooting, temporarily enable debug mode:

DJANGO_DEBUG=True

Development Only

Never enable debug mode in production.

Database Shell

Access database directly:

docker compose exec trikusec python manage.py dbshell

Django Shell

Interactive Python shell:

docker compose exec trikusec python manage.py shell

Additional Resources