Advanced Topics
Version Information¶
Starting with version 0.12 (and later), InvenTree includes more version information.
To view this information, navigate to the "About" page in the top menu bar and select "copy version information" on the bottom corner.
Contained Information¶
The version information contains the following information extracted form the instance:
| Name | Always | Sample | Source |
|---|---|---|---|
| InvenTree-Version | Yes | 0.12.0 dev | instance |
| Django Version | Yes | 3.2.19 | instance |
| Commit Hash | No | aebff26 | environment: INVENTREE_COMMIT_HASH, git |
| Commit Date | No | 2023-06-10 | environment: INVENTREE_COMMIT_DATE, git |
| Commit Branch | No | master | environment: INVENTREE_PKG_BRANCH, git |
| Database | Yes | postgresql | environment: INVENTREE_DB_*, config: database - see config |
| Debug-Mode | Yes | False | environment: INVENTREE_DEBUG, config: config - see config |
| Deployed using Docker | Yes | True | environment: INVENTREE_DOCKER |
| Platform | Yes | Linux-5.15.0-67-generic-x86_64 | instance |
| Installer | Yes | PKG | environment: INVENTREE_PKG_INSTALLER, instance |
| Target | No | ubuntu:20.04 | environment: INVENTREE_PKG_TARGET |
| Active plugins | Yes | [{'name': 'InvenTreeBarcode', 'slug': 'inventreebarcode', 'version': '2.0.0'}] | instance |
Installer codes¶
The installer code is used to identify the way InvenTree was installed. If you vendor InvenTree, you can and should set the installer code to your own value to make sure debugging goes smoothly.
| Code | Description | Official |
|---|---|---|
| PKG | Installed using a package manager | Yes |
| GIT | Installed using git | Yes |
| DOC | Installed using docker | Yes |
| DIO | Installed using digital ocean marketplace[^1] | No |
[^1]: Starting with fresh installs of 0.12.0 this code is set. Versions installed before 0.12.0 do not have this code set even after upgrading to 0.12.0.
Authentication¶
LDAP¶
You can link your InvenTree server to an LDAP server.
Important
This feature is currently only available for docker installs.
Next you can start configuring the connection. Either use the config file or set the environment variables.
| Environment Variable | Configuration File | Default | Description |
|---|---|---|---|
INVENTREE_LDAP_ENABLED |
ldap.enabled |
False | Enable LDAP support |
INVENTREE_LDAP_DEBUG |
ldap.debug |
False | Set this to True to activate debug mode, useful for troubleshooting ldap configurations. |
INVENTREE_LDAP_SERVER_URI |
ldap.server_uri |
LDAP Server URI, e.g. ldaps://example.org |
|
INVENTREE_LDAP_START_TLS |
ldap.start_tls |
Enable TLS encryption over the standard LDAP port, see. (You can set TLS options via ldap.global_options) |
|
INVENTREE_LDAP_BIND_DN |
ldap.bind_dn |
LDAP bind dn, e.g. cn=admin,dc=example,dc=org |
|
INVENTREE_LDAP_BIND_PASSWORD |
ldap.bind_password |
LDAP bind password | |
INVENTREE_LDAP_SEARCH_BASE_DN |
ldap.search_base_dn |
LDAP search base dn, e.g. cn=Users,dc=example,dc=org |
|
INVENTREE_LDAP_USER_DN_TEMPLATE |
ldap.user_dn_template |
use direct bind as auth user, ldap.bind_dn and ldap.bin_password is not necessary then, e.g. uid=%(user)s,dc=example,dc=org |
|
INVENTREE_LDAP_GLOBAL_OPTIONS |
ldap.global_options |
set advanced options as dict, e.g. TLS settings. For a list of all available options, see python-ldap docs. (keys and values starting with OPT_ get automatically converted to python-ldap keys) |
|
INVENTREE_LDAP_SEARCH_FILTER_STR |
ldap.search_filter_str |
LDAP search filter str, default: uid=%(user)s |
|
INVENTREE_LDAP_USER_ATTR_MAP |
ldap.user_attr_map |
LDAP <-> InvenTree user attribute map, can be json if used as env, in yml directly specify the object. default: {"first_name": "givenName", "last_name": "sn", "email": "mail"} |
|
INVENTREE_LDAP_ALWAYS_UPDATE_USER |
ldap.always_update_user |
Always update the user on each login, default: true |
|
INVENTREE_LDAP_CACHE_TIMEOUT |
ldap.cache_timeout |
cache timeout to reduce traffic with LDAP server, default: 3600 (1h) |
|
INVENTREE_LDAP_GROUP_SEARCH |
ldap.group_search |
Base LDAP DN for group searching; required to enable group features | |
INVENTREE_LDAP_GROUP_OBJECT_CLASS |
ldap.group_object_class |
The string to pass to the LDAP group search (objectClass=<...>), default: groupOfUniqueNames |
|
INVENTREE_LDAP_MIRROR_GROUPS |
ldap.mirror_groups |
If True, mirror a user's LDAP group membership in the Django database, default: False |
|
INVENTREE_LDAP_GROUP_TYPE_CLASS |
ldap.group_type_class |
The group class to be imported from django_auth_ldap.config as a string, default: 'GroupOfUniqueNamesType' |
|
INVENTREE_LDAP_GROUP_TYPE_CLASS_ARGS |
ldap.group_type_class_args |
A list of positional args to pass to the LDAP group type class, default [] |
|
INVENTREE_LDAP_GROUP_TYPE_CLASS_KWARGS |
ldap.group_type_class_kwargs |
A dict of keyword args to pass to the LDAP group type class, default {'name_attr': 'cn'} |
|
INVENTREE_LDAP_REQUIRE_GROUP |
ldap.require_group |
If set, users must be in this group to log in to InvenTree | |
INVENTREE_LDAP_DENY_GROUP |
ldap.deny_group |
If set, users must not be in this group to log in to InvenTree | |
INVENTREE_LDAP_USER_FLAGS_BY_GROUP |
ldap.user_flags_by_group |
LDAP group to InvenTree user flag map, can be json if used as env, in yml directly specify the object. See config template for example, default: {} |
Tracing support¶
Starting with 0.14.0 InvenTree supports sending traces, logs and metrics to OpenTelemetry compatible endpoints (both HTTP and gRPC). A list of vendors is available on the project site. This can be used to track usage and performance of the InvenTree backend and connected services like databases, caches and more.
| Environment Variable | Configuration File | Default | Description |
|---|---|---|---|
INVENTREE_TRACING_ENABLED |
tracing.enabled |
False | Enable OpenTelemetry |
INVENTREE_TRACING_ENDPOINT |
tracing.endpoint |
Not Specified | General endpoint for information (not specific trace/log url) |
INVENTREE_TRACING_HEADERS |
tracing.headers |
Not Specified | HTTP headers that should be send with every request (often used for authentication). Format as a dict. |
INVENTREE_TRACING_AUTH |
tracing.auth |
Not Specified | Auth headers that should be send with every requests (will be encoded to b64 and overwrite auth headers) |
INVENTREE_TRACING_IS_HTTP |
tracing.is_http |
True | Are the endpoints HTTP (True, default) or gRPC (False) |
INVENTREE_TRACING_APPEND_HTTP |
tracing.append_http |
True | Append default url routes (v1) to tracing.endpoint |
INVENTREE_TRACING_CONSOLE |
tracing.console |
False | Print out all exports (additionally) to the console for debugging. Do not use in production |
INVENTREE_TRACING_RESOURCES |
tracing.resources |
Not Specified | Add additional resources to all exports. This can be used to add custom tags to the traces. Format as a dict. |
An endpoint is required
Setting INVENTREE_TRACING_ENABLED to True is not enough on its own. INVENTREE_TRACING_ENDPOINT must also be set to a reachable OpenTelemetry collector - without it, InvenTree logs a warning at startup and does not send any traces, logs, or metrics.
Tracing is configured once when the InvenTree backend and worker processes start, so any change to these settings requires a full restart (not just a reload) to take effect.
Example: sending traces to a local collector¶
The following environment variables send traces, logs and metrics via gRPC to an OpenTelemetry Collector running alongside InvenTree, for example as an additional service in your docker-compose.yml:
INVENTREE_TRACING_ENABLED=True
INVENTREE_TRACING_ENDPOINT=otel-collector:4317
INVENTREE_TRACING_IS_HTTP=False
Troubleshooting¶
If traces don't seem to be reaching your collector:
- Confirm
INVENTREE_TRACING_ENDPOINTis set - tracing silently does nothing without it, even ifINVENTREE_TRACING_ENABLEDisTrue. - Set
INVENTREE_TRACING_CONSOLE=Trueand check the InvenTree logs for exported spans. This confirms the OpenTelemetry SDK is generating and exporting data locally, independent of whether your collector endpoint is reachable. - Restart the InvenTree backend and worker processes after changing any tracing setting - it is only read at process startup.
- Check that
INVENTREE_TRACING_IS_HTTPmatches the protocol your collector endpoint expects. It defaults toTrue(HTTP) - set it toFalseif your endpoint only accepts gRPC.
Multi Site Support¶
If your InvenTree instance is used in a multi-site environment, you can enable multi-site support. Note that supporting multiple sites is well outside the scope of most InvenTree installations. If you know what you are doing, and have a good reason to enable multi-site support, you can do so by setting the INVENTREE_SITE_MULTI environment variable to True.
Django Documentation
For more information on multi-site support, refer to the Django documentation.
| Environment Variable | Configuration File | Default | Description |
|---|---|---|---|
INVENTREE_SITE_MULTI |
site_multi |
False | Enable multiple sites |
INVENTREE_SITE_ID |
site_id |
Not Specified | Specify a fixed site ID |