InvenTree should be configured for parts and stock control accuracy with secure API and BOM workflow settings. This guide covers the essential configuration options for production deployments of InvenTree version 1.2.0.
# Database engine (postgresql, mysql, sqlite3)
INVENTREE_DB_ENGINE=postgresql
INVENTREE_DB_NAME=inventree
INVENTREE_DB_USER=inventree
INVENTREE_DB_PASSWORD=replace-with-strong-password
INVENTREE_DB_HOST=localhost
INVENTREE_DB_PORT=5432
# Redis connection for caching and background tasks
INVENTREE_REDIS_URL=redis://localhost:6379
# Directory paths for media uploads and static files
INVENTREE_MEDIA_ROOT=/opt/inventree/media
INVENTREE_STATIC_ROOT=/opt/inventree/static
INVENTREE_STATICFILES_DIRS=/opt/inventree/staticfiles
# Base URL for the application
INVENTREE_BASE_URL=https://inventree.example.com
# Secret key for cryptographic operations (generate a strong random key)
INVENTREE_SECRET_KEY=replace-with-a-very-long-random-string
# Debug mode (should be False in production)
INVENTREE_DEBUG=False
# Allowed hosts
INVENTREE_ALLOWED_HOSTS=inventree.example.com,localhost,127.0.0.1
# Email settings for notifications
INVENTREE_EMAIL_HOST=smtp.example.com
INVENTREE_EMAIL_PORT=587
INVENTREE_EMAIL_HOST_USER=notifications@example.com
INVENTREE_EMAIL_HOST_PASSWORD=your-smtp-password
INVENTREE_EMAIL_USE_TLS=True
INVENTREE_DEFAULT_FROM_EMAIL=noreply@inventree.example.com
¶ Backup and Maintenance
# Backup settings
INVENTREE_BACKUP_DIR=/opt/inventree/backups
# Background task settings
INVENTREE_BACKGROUND_WORKERS=4
- Restrict stock adjustment and part merge permissions to authorized personnel only
- Implement role-based access control (RBAC) with appropriate user groups
- Configure authentication backends (LDAP, OAuth2, etc.) if needed
- Define part numbering scheme and classification system before production use
- Establish part template and category hierarchies
- Configure part parameter templates for consistent data entry
- Protect API tokens and integration credentials with appropriate permissions
- Implement rate limiting to prevent abuse
- Use API tokens with minimal required permissions
- Monitor build orders and stock reservation consistency
- Configure notification settings for build completion
- Set up automated actions for low stock alerts
InvenTree 1.2.0 supports custom fields for parts, suppliers, and stock items:
- Navigate to the admin panel to define custom fields
- Use these for organization-specific attributes
- Custom fields can be required or optional
- Configure barcode formats for scanning
- Set up automatic actions triggered by barcode scans
- Integrate with external barcode databases if needed
- Customize report templates for parts, stock, and builds
- Use Django templating language for dynamic content
- Configure automatic report generation schedules
- Manage installed plugins through the admin interface
- Configure plugin-specific settings
- Monitor plugin performance and compatibility
- Ensure proper indexing on frequently queried fields
- Regular database maintenance and vacuuming (for PostgreSQL)
- Monitor slow queries and optimize as needed
- Configure Redis appropriately for your workload
- Set cache expiration times based on data volatility
- Monitor cache hit rates and adjust as needed
- Adjust worker count based on concurrent operations
- Monitor task queue length and processing times
- Configure retry policies for failed tasks
¶ Backup and Recovery
Regularly backup your database using appropriate tools:
- PostgreSQL:
pg_dump inventree > inventree_backup.sql
- MySQL:
mysqldump inventree > inventree_backup.sql
- SQLite: Simply copy the database file
Back up database, uploaded files/assets, and configuration/secrets metadata. Store backups securely with encryption.
Validate restore procedures with:
- User login verification
- Core business transaction testing
- Report/export functionality validation
- HTTPS and secure session policy enforced
- HSTS headers configured
- Content Security Policy (CSP) implemented
- Authentication, permissions, and critical workflow events monitored
- Queue/background jobs and search/index tasks monitored
- Database performance metrics tracked
- Disk space and memory usage monitored
- API usage and error rates logged
¶ Maintenance
- Restore test run on schedule and documented
- Database maintenance performed regularly
- Log rotation configured and tested
- Update procedures tested in staging environment
- Enhanced mobile app support
- Improved plugin system
- Better performance optimizations
- Additional API endpoints
- Enhanced security features
- Review release notes for breaking changes
- Test migration in staging environment first
- Backup before performing upgrades
- Verify custom configurations remain compatible
Any questions?
Feel free to contact us. Find all contact information on our contact page.