InvenTree can be self-hosted with minimal system requirements. Multiple database back-ends are supported, allowing for flexibility where required.
The InvenTree server ecosystem consists of the following components:
A persistent database is required for data storage. InvenTree can be used with any of the following database backends:
- MySQL / MariaDB
While SQLite provides a simpler setup and is useful for a development environment, we strongly recommend against using it for a production environment. Use PostgreSQL or MySQL instead
Database selection should be determined by your particular installation requirements.
Uploaded media files (images, attachments, reports, etc) are stored to a persistent storage volume.
The bulk of the InvenTree code base supports the custom web server application. The web server application services user requests and facilitates database access.
The webserver code also provides a first-party API for performing database query actions.
Once a database is setup, you need a way of accessing the data. InvenTree provides a "server" application out of the box, but this may not scale particularly well with multiple users. Instead, InvenTree can be served using a webserver such as Gunicorn. For more information see the deployment documentation.
A separate application handles management of background tasks, separate to user-facing web requests.
The InvenTree documentation assumes that the operating system is a debian based Linux OS. Some installation steps may differ for different systems.
Installing on Windows
Installation on Windows is not guaranteed to work (at all). To install on a Windows system, it is highly recommended that you install WSL, and then follow installation procedure from within the WSL environment.
Installation on any OS is simplified by following the docker setup guide.
InvenTree runs on Python.
InvenTree requrires Python 3.8 (or newer). If your system has an older version of Python installed, you will need to follow the update instructions for your OS.
InvenTree makes use of the invoke python toolkit for performing various administrative actions.
InvenTree requires invoke version 1.4.0 or newer. Some platforms may be shipped with older versions of invoke!
To display a list of the available InvenTree administration actions, run the following commands from the top level source directory:
Installing the required Python packages inside a virtual environment allows a local install separate to the system-wide Python installation. While not strictly necessary, using a virtual environment is highly recommended as it prevents conflicts between the different Python installations.
You can read more about Python virtual environments here.
The installation intstruction assume that a virtual environment is configured
cd into the InvenTree directory, and create a virtual environment with the following command:
python3 -m venv env
Activating a Virtual Environment¶
The virtual environment needs to be activated to ensure the correct python binaries and libraries are used. The InvenTree instructions assume that the virtual environment is always correctly activated.
To configure Inventree inside a virtual environment,
cd into the inventree base directory and run the following command:
Activate Virtual Environment
This will place the current shell session inside a virtual environment - the terminal should display the
InvenTree Source Code¶
InvenTree source code is distributed on GitHub, and the latest version can be downloaded (using Git) with the following command:
git clone https://github.com/inventree/inventree/
Alternatively, the source can be downloaded as a .zip archive.
Updating via Git
Downloading the source code using Git is recommended, as it allows for simple updates when a new version of InvenTree is released.
There are multiple ways to get an InvenTree server up and running, of various complexity (and robustness)!
The recommended method of installing InvenTree is to use docker. InvenTree provides out-of-the-box support for docker and docker-compose, which provides a simple, reliable and repeatable pipeline for integration into your production environment.
Refer to the following guides for further instructions:
If you do not wish to use the docker container, you will need to manually install the required packages and follow through the installation guide.
Refer to the following guides for further instructions:
By default, the InvenTree web server is configured to run in DEBUG mode.
Running in DEBUG mode provides many handy development features, however it is strongly recommended NOT to run in DEBUG mode in a production environment. This recommendation is made because DEBUG mode leaks a lot of information about your installation and may pose a security risk.
So, for a production setup, you should set
INVENTREE_DEBUG=false in the configuration options.
However, turning off DEBUG mode creates further work for the system administrator. In particular, when running in DEBUG mode, the InvenTree web server natively manages static and media files, which means that the InvenTree server can run "monolithically" without the need for a separate web server.
With DEBUG mode turned off, a separate web server is required for serving static and media files. You can find further information in the django documentation.
There are many different ways that a sysadmin might wish to handle this.
The docker production example provides an example using Nginx to serve static and media files, and redirecting other requests to the InvenTree web server itself.
You may use this as a jumping off point, or use an entirely different server setup.
Static files can be served without any need for authentication. In fact, they must be accessible without authentication, otherwise the unauthenticated views (such as the login screen) will not function correctly.
It is highly recommended that the media files are served in such a way that user authentication is required.
Refer to the docker production example for a demonstration of using nginx to serve media files only to authenticated users, and forward authentication requests to the InvenTree web server.