Merge branch 'master' of github.com:inventree/inventree-docs
@ -7,11 +7,9 @@
|
||||
# with the prefix INVENTREE_DB_
|
||||
# e.g INVENTREE_DB_NAME / INVENTREE_DB_USER / INVENTREE_DB_PASSWORD
|
||||
database:
|
||||
# Default configuration - sqlite filesystem database
|
||||
ENGINE: sqlite3
|
||||
NAME: '../inventree_default_db.sqlite3'
|
||||
|
||||
# For more complex database installations, further parameters are required
|
||||
# Uncomment (and edit) one of the database configurations below,
|
||||
# or specify database options using environment variables
|
||||
|
||||
# Refer to the django documentation for full list of options
|
||||
|
||||
# --- Available options: ---
|
||||
@ -27,14 +25,22 @@ database:
|
||||
|
||||
# --- Example Configuration - sqlite3 ---
|
||||
# ENGINE: sqlite3
|
||||
# NAME: '/path/to/database.sqlite3'
|
||||
# NAME: '/home/inventree/database.sqlite3'
|
||||
|
||||
# --- Example Configuration - MySQL ---
|
||||
#ENGINE: django.db.backends.mysql
|
||||
#ENGINE: mysql
|
||||
#NAME: inventree
|
||||
#USER: inventree_username
|
||||
#USER: inventree
|
||||
#PASSWORD: inventree_password
|
||||
#HOST: '127.0.0.1'
|
||||
#HOST: 'localhost'
|
||||
#PORT: '3306'
|
||||
|
||||
# --- Example Configuration - Postgresql ---
|
||||
#ENGINE: postgresql
|
||||
#NAME: inventree
|
||||
#USER: inventree
|
||||
#PASSWORD: inventree_password
|
||||
#HOST: 'localhost'
|
||||
#PORT: '5432'
|
||||
|
||||
# Select default system language (default is 'en-us')
|
||||
@ -43,6 +49,7 @@ language: en-us
|
||||
# System time-zone (default is UTC)
|
||||
# Reference: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
# Select an option from the "TZ database name" column
|
||||
# Use the environment variable INVENTREE_TIMEZONE
|
||||
timezone: UTC
|
||||
|
||||
# List of currencies supported by default.
|
||||
@ -57,6 +64,7 @@ currencies:
|
||||
- USD
|
||||
|
||||
# Set debug to False to run in production mode
|
||||
# Use the environment variable INVENTREE_DEBUG
|
||||
debug: True
|
||||
|
||||
# Set debug_toolbar to True to enable a debugging toolbar for InvenTree
|
||||
@ -65,6 +73,7 @@ debug: True
|
||||
debug_toolbar: False
|
||||
|
||||
# Configure the system logging level
|
||||
# Use environment variable INVENTREE_LOG_LEVEL
|
||||
# Options: DEBUG / INFO / WARNING / ERROR / CRITICAL
|
||||
log_level: WARNING
|
||||
|
||||
@ -86,13 +95,14 @@ cors:
|
||||
# - https://sub.example.com
|
||||
|
||||
# MEDIA_ROOT is the local filesystem location for storing uploaded files
|
||||
# By default, it is stored in a directory named 'inventree_media' local to the InvenTree directory
|
||||
# This should be changed for a production installation
|
||||
media_root: '../inventree_media'
|
||||
# By default, it is stored under /home/inventree
|
||||
# Use environment variable INVENTREE_MEDIA_ROOT
|
||||
media_root: '/home/inventree/media'
|
||||
|
||||
# STATIC_ROOT is the local filesystem location for storing static files
|
||||
# By default it is stored in a directory named 'inventree_static' local to the InvenTree directory
|
||||
static_root: '../inventree_static'
|
||||
# By default, it is stored under /home/inventree
|
||||
# Use environment variable INVENTREE_STATIC_ROOT
|
||||
static_root: '/home/inventree/static'
|
||||
|
||||
# Optional URL schemes to allow in URL fields
|
||||
# By default, only the following schemes are allowed: ['http', 'https', 'ftp', 'ftps']
|
||||
@ -105,7 +115,8 @@ static_root: '../inventree_static'
|
||||
# Backup options
|
||||
# Set the backup_dir parameter to store backup files in a specific location
|
||||
# If unspecified, the local user's temp directory will be used
|
||||
#backup_dir: '/home/inventree/backup/'
|
||||
# Use environment variable INVENTREE_BACKUP_DIR
|
||||
backup_dir: '/home/inventree/backup/'
|
||||
|
||||
# Permit custom authentication backends
|
||||
#authentication_backends:
|
||||
|
100
_includes/docker-compose.yml
Normal file
@ -0,0 +1,100 @@
|
||||
version: "3.8"
|
||||
|
||||
# Docker compose recipe for InvenTree
|
||||
# - Runs PostgreSQL as the database backend
|
||||
# - Runs Gunicorn as the web server
|
||||
# - Runs nginx as a reverse proxy
|
||||
# - Runs the background worker process
|
||||
|
||||
# ---------------------------------
|
||||
# IMPORTANT - READ BEFORE STARTING!
|
||||
# ---------------------------------
|
||||
# Before running, ensure that you change the "/path/to/data" directory,
|
||||
# specified in the "volumes" section at the end of this file.
|
||||
# This path determines where the InvenTree data will be stored!
|
||||
|
||||
services:
|
||||
# Database service
|
||||
# Use PostgreSQL as the database backend
|
||||
# Note: this can be changed to a different backend,
|
||||
# just make sure that you change the INVENTREE_DB_xxx vars below
|
||||
db:
|
||||
image: postgres
|
||||
container_name: inventree_db
|
||||
ports:
|
||||
- 5432/tcp
|
||||
environment:
|
||||
- PGDATA=/var/lib/postgresql/data/pgdb
|
||||
- POSTGRES_USER=pguser
|
||||
- POSTGRES_PASSWORD=pgpassword
|
||||
volumes:
|
||||
- data:/var/lib/postgresql/data/
|
||||
restart: unless-stopped
|
||||
|
||||
# InvenTree web server services
|
||||
# Uses gunicorn as the web server
|
||||
inventree:
|
||||
image: inventree/inventree:latest
|
||||
container_name: inventree_server
|
||||
expose:
|
||||
- 8080
|
||||
depends_on:
|
||||
- db
|
||||
volumes:
|
||||
- data:/home/inventree/data
|
||||
- static:/home/inventree/static
|
||||
environment:
|
||||
- INVENTREE_DB_ENGINE=postgresql
|
||||
- INVENTREE_DB_NAME=inventree
|
||||
- INVENTREE_DB_USER=pguser
|
||||
- INVENTREE_DB_PASSWORD=pgpassword
|
||||
- INVENTREE_DB_PORT=5432
|
||||
- INVENTREE_DB_HOST=db
|
||||
restart: unless-stopped
|
||||
|
||||
# nginx acts as a reverse proxy
|
||||
# static files are served by nginx
|
||||
# web requests are redirected to gunicorn
|
||||
nginx:
|
||||
image: inventree/nginx:latest
|
||||
container_name: inventree_proxy
|
||||
depends_on:
|
||||
- inventree
|
||||
ports:
|
||||
# Change "1337" to the port where you want InvenTree web server to be available
|
||||
- 1337:80
|
||||
volumes:
|
||||
- static:/home/inventree/static
|
||||
|
||||
# background worker process handles long-running or periodic tasks
|
||||
worker:
|
||||
entrypoint: ./start_worker.sh
|
||||
image: inventree/inventree:latest
|
||||
container_name: inventree_worker
|
||||
depends_on:
|
||||
- db
|
||||
- inventree
|
||||
volumes:
|
||||
- data:/home/inventree/data
|
||||
- static:/home/inventree/static
|
||||
environment:
|
||||
- INVENTREE_DB_ENGINE=postgresql
|
||||
- INVENTREE_DB_NAME=inventree
|
||||
- INVENTREE_DB_USER=pguser
|
||||
- INVENTREE_DB_PASSWORD=pgpassword
|
||||
- INVENTREE_DB_PORT=5432
|
||||
- INVENTREE_DB_HOST=db
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
# Static files, shared between containers
|
||||
static:
|
||||
# Persistent data, stored externally
|
||||
data:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: none
|
||||
o: bind
|
||||
# This directory specified where InvenTree data are stored "outside" the docker containers
|
||||
# Change this path to a local system path where you want InvenTree data stored
|
||||
device: /path/to/data
|
@ -12,7 +12,7 @@ In the admin interface, select the "Errors" view:
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
!!! note "URL"
|
||||
!!! info "URL"
|
||||
Alternatively, navigate to the error list view at /admin/error_report/error/
|
||||
|
||||
A list of error logs is presented.
|
||||
@ -21,7 +21,7 @@ A list of error logs is presented.
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
!!! note "Deleting Logs"
|
||||
!!! info "Deleting Logs"
|
||||
Error logs should be deleted periodically
|
||||
|
||||
## Reporting Errors
|
||||
|
29
docs/admin/tasks.md
Normal file
@ -0,0 +1,29 @@
|
||||
---
|
||||
title: Background Tasks
|
||||
---
|
||||
|
||||
## Background Tasks
|
||||
|
||||
In addition to managing the database and providing a web interface, InvenTree runs various background tasks;
|
||||
|
||||
### Blocking Operations
|
||||
|
||||
Some tasks (such as sending emails or performing bulk database actions) may take a significant amount of time. Instead of delaying the response to the user, these tasks are handled by the background task manager.
|
||||
|
||||
### Periodic Tasks
|
||||
|
||||
Some tasks must be performed on a regular, periodic basis.
|
||||
|
||||
## Django Q
|
||||
|
||||
InvenTree uses the [django-q](https://django-q.readthedocs.io/en/latest/) background task manager.
|
||||
|
||||
### Running Worker
|
||||
|
||||
The Django Q work must run separately to the web server. This is started as a separate process, as part of the InvenTree installation instructions.
|
||||
|
||||
If the worker is not running, a warning indicator is displayed in the InvenTree menu bar.
|
||||
|
||||
## Admin Interface
|
||||
|
||||
Scheduled tasks can be viewed in the InvenTree admin interface.
|
108
docs/app/app.md
@ -6,7 +6,7 @@ title: InvenTree Mobile App
|
||||
|
||||
The InvenTree Mobile App brings stock control to your pocket. Integrating seamlessly with the [InvenTree API](../../extend/api), the app provides immediate access to inventory data without requiring physical access to a computer.
|
||||
|
||||
Native barcode support provides a multitude of context-sensitive stock control actions, allowing streamlined inventory management at your fingertips.
|
||||
Native barcode support provides a multitude of context-sensitive stock control actions, allowing streamlined inventory management at your fingertips. The app has been optimized for speed, providing instant access to stock knowledge and handy on-site functionality.
|
||||
|
||||
## Download
|
||||
|
||||
@ -23,24 +23,102 @@ The InvenTree App can be downloaded for Android devices via the [Play Store](htt
|
||||
|
||||
Use of the InvenTree app assumes that you (the user) have access to an InvenTree server.
|
||||
|
||||
!!! success "Profiles"
|
||||
The app supports multiple user profiles, providing simple switching between different InvenTree servers and/or account profiles.
|
||||
When first running the app, no profile has been configured. A message is displayed at the bottom of the screen, indicting that a server profile needs to be configured.
|
||||
|
||||
!!! todo "Add Screenshot"
|
||||
Add screenshot of "Profiles" screen
|
||||
{% with id="no_server", url="app/initial_home_screen.jpg", maxheight="240px", description="No server configured" %}
|
||||
{% include "img.html" %}
|
||||
{% endwith %}
|
||||
|
||||
!!! todo "Add Screenshot"
|
||||
Add screenshot of "connection failed" screen
|
||||
Press on the mesage to navigate to the server selection view:
|
||||
|
||||
!!! todo "Add Screenshot"
|
||||
Add screenshow of "connection success" screen
|
||||
### Create Server
|
||||
|
||||
## Index Page
|
||||
!!! success "Server Profiles"
|
||||
The app supports multiple server profiles, providing simple switching between different InvenTree servers and/or account profiles.
|
||||
|
||||
!!! todo "TODO"
|
||||
This section requires further work
|
||||
Press the <span class='fas fa-plus-circle blue'></span> button in the bottom-right corner of the screen to create a new server profile.
|
||||
|
||||
## Menu Bar
|
||||
{% with id="add_profile", url="app/add_server_profile.jpg", maxheight="240px", description="Add server" %}
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
!!! todo "TODO"
|
||||
This section requires further work
|
||||
Enter the required server details:
|
||||
|
||||
| Parameter | Description |
|
||||
| --- | --- |
|
||||
| Name | Name for the server profile (can be any value, simply for reference) |
|
||||
| Server | InvenTree server address (including port, if required). e.g. `http://inventree.myserver.com:8080` |
|
||||
| Username | Your account username (case sensitive) |
|
||||
| Password | Your account password (case sensitive) |
|
||||
|
||||
### Connect to Server
|
||||
|
||||
Once the server profile is created, you need to connect to the server. Simply short press on the server profile to connect.
|
||||
|
||||
Alternatively, long press on the server profile to activate the context menu, then select *Connect to Server*.
|
||||
|
||||
When the app successfully connects to the server, a success message is briefly displayed at the bottom of the screen. A green <span class='fas fa-check-circle green'></span> icon next to the server profile indicate that the profile is currently *selected* and also the connection was successful.
|
||||
|
||||
{% with id="connected", url="app/connected.jpg", maxheight="240px", description="Connected to server" %}
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
### Connection Failure
|
||||
|
||||
If (for whatever reason) the app does not successfully connect to the InvenTree server, a failure message is displayed, and a red <span class='fas fa-times-circle red'></span> icon is displayed next to the server profile.
|
||||
|
||||
{% with id="failed", url="app/unauthorized.jpg", maxheight="240px", description="Connection failure" %}
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
In this case, the error message displayed at the bottom of the screen provides context as to why the app could not successfully connect to the server.
|
||||
|
||||
To edit the server profile details, long press on the server profile, and select *Edit Server Profile*:
|
||||
|
||||
{% with id="edit", url="app/edit_server.jpg", maxheight="240px", description="Edit server profile" %}
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
## Drawer Menu
|
||||
|
||||
The *Drawer Menu* is accessible from all top-level app views, and provides quick access to important app features. To open the drawer menu, select the <span class='fas fa-bars'></span> icon in the top-left corner of the screen (where available).
|
||||
|
||||
{% with id="drawer", url="app/drawer.jpg", maxheight="240px", description="Open drawer menu" %}
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
The *Drawer Menu* provides instant access to the following views:
|
||||
|
||||
### InvenTree
|
||||
|
||||
Select *InvenTree* to navigate to the [home screen](#home-screen).
|
||||
|
||||
### Scan Barcode
|
||||
|
||||
Select *Scan Barcode* to open the barcode scanner, and scan an InvenTree stock item or location to instantly jump to the relevent view. Refer to the [barcode documentation](./barcode) for more information.
|
||||
|
||||
### Search
|
||||
|
||||
Select *Search* to open a global search screen.
|
||||
|
||||
### Parts
|
||||
|
||||
Select *Parts* to navigate to the [Parts](./parts) view.
|
||||
|
||||
### Stock
|
||||
|
||||
Select *Stock* to navigate to the [Stock](./stock) view.
|
||||
|
||||
### Settings
|
||||
|
||||
Select *Settings* to navigate to the app [settings](./settings) menu.
|
||||
|
||||
## Home Screen
|
||||
|
||||
The app *home screen* provides quick-access buttons for stock view and actions.
|
||||
|
||||
Additionally, the connection status of the server is displayed at the bottom of the screen.
|
||||
|
||||
{% with id="home", url="app/home.jpg", maxheight="240px", description="Home screen" %}
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
54
docs/app/settings.md
Normal file
@ -0,0 +1,54 @@
|
||||
---
|
||||
title: App Settings
|
||||
---
|
||||
|
||||
## Settings
|
||||
|
||||
The *Settings* view provides access to user configurable settings, in addition to information about the app itself.
|
||||
|
||||
The main settings view is shown below, and provides the following options:
|
||||
|
||||
- **Server** - Configure and select server profile
|
||||
- **App Settings** - Configure app settings
|
||||
- **About** - Information about the InvenTree app
|
||||
- **Documentation** - Opens the InvenTree documentation in an external browser
|
||||
|
||||
{% with id="settings_view", url="app/settings.jpg", maxheight="240px", description="Settings view" %}
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
## App Settings
|
||||
|
||||
The *App Settings* view provides configuration options for the InvenTree app:
|
||||
|
||||
{% with id="app_settings", url="app/app_settings.jpg", maxheight="240px", description="App Settings" %}
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
### Sounds
|
||||
|
||||
Configure audible app notifications:
|
||||
|
||||
- **Server Error** - Play an audible tone when a server error occurs
|
||||
- **Barcode Tones** - Play audible tones when scanning barcodes
|
||||
|
||||
## About
|
||||
|
||||
The *About* view provides details about the app itself:
|
||||
|
||||
{% with id="about_app", url="app/about.jpg", maxheight="240px", description="About the InvenTree app" %}
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
### Server Details
|
||||
|
||||
- **Address** - URL of the currently connected server
|
||||
- **Version** - Version of InvenTree software running on the server
|
||||
- **Server Instance** - Instance name of the server
|
||||
|
||||
### App Details
|
||||
|
||||
- **Package Name** - Package identifier for the compiled app
|
||||
- **Version** - App software version
|
||||
- **Release Notes** - Select to view app release notes
|
||||
- **Credits** - Select to view additional app credits
|
BIN
docs/assets/images/api/api_roles.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
docs/assets/images/api/api_roles_2.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
docs/assets/images/app/about.jpg
Normal file
After Width: | Height: | Size: 200 KiB |
BIN
docs/assets/images/app/add_server_profile.jpg
Normal file
After Width: | Height: | Size: 168 KiB |
BIN
docs/assets/images/app/app_settings.jpg
Normal file
After Width: | Height: | Size: 128 KiB |
BIN
docs/assets/images/app/connected.jpg
Normal file
After Width: | Height: | Size: 113 KiB |
BIN
docs/assets/images/app/details.jpg
Normal file
After Width: | Height: | Size: 200 KiB |
BIN
docs/assets/images/app/drawer.jpg
Normal file
After Width: | Height: | Size: 106 KiB |
BIN
docs/assets/images/app/edit_server.jpg
Normal file
After Width: | Height: | Size: 148 KiB |
BIN
docs/assets/images/app/home.jpg
Normal file
After Width: | Height: | Size: 123 KiB |
BIN
docs/assets/images/app/initial_home_screen.jpg
Normal file
After Width: | Height: | Size: 124 KiB |
BIN
docs/assets/images/app/select_server.jpg
Normal file
After Width: | Height: | Size: 95 KiB |
BIN
docs/assets/images/app/settings.jpg
Normal file
After Width: | Height: | Size: 137 KiB |
BIN
docs/assets/images/app/unauthorized.jpg
Normal file
After Width: | Height: | Size: 110 KiB |
BIN
docs/assets/images/part/part_ipn_editing.png
Normal file
After Width: | Height: | Size: 87 KiB |
@ -15,7 +15,7 @@ To access the manufacturer page, click on the "Buy" navigation tab and click on
|
||||
|
||||
Once the manufacturer page is loaded, click on the "<span class='fas fa-plus-circle'></span> New Manufacturer" button: the "Create new Manufacturer" form opens. Fill-in the manufacturer informations (`Company name` and `Company description` are required) then click on the "Submit" button.
|
||||
|
||||
!!! note "Manufacturer vs Supplier"
|
||||
!!! info "Manufacturer vs Supplier"
|
||||
In the case the manufacturer sells directly to customers, you may want to enable the checkbox `is supplier` before submitting the form (you can also enable it later on). Purchase orders rely exclusively on [supplier parts](../supplier#supplier-parts), therefore the manufacturer will need to be set as a supplier too.
|
||||
|
||||
### Edit Manufacturer
|
||||
|
@ -15,7 +15,7 @@ To access the supplier page, click on the "Buy" navigation tab and click on "Sup
|
||||
|
||||
Once the supplier page is loaded, click on the "<span class='fas fa-plus-circle'></span> New Supplier" button: the "Create new Supplier" form opens. Fill-in the supplier informations (`Company name` and `Company description` are required) then click on the "Submit" button.
|
||||
|
||||
!!! note "Supplier vs Manufacturer"
|
||||
!!! info "Supplier vs Manufacturer"
|
||||
In the case the supplier is a manufacturer who sells directly to customers, you may want to enable the checkbox `is manufacturer` before submitting the form (you can also enable it later on).
|
||||
|
||||
### Edit Supplier
|
||||
|
@ -75,4 +75,30 @@ headers = {
|
||||
'AUTHORIZATION': f'Token {token}'
|
||||
}
|
||||
response = request.get('http://localhost:8080/api/part/', data=data, headers=headers)
|
||||
```
|
||||
```
|
||||
|
||||
## Authorization
|
||||
|
||||
### User Roles
|
||||
|
||||
Users can only perform REST API actions which align with their assigned [role permissions](../../admin/permissions/#roles).
|
||||
Once a user has *authenticated* via the API, a list of the available roles can be retrieved from:
|
||||
|
||||
`/api/user/roles/`
|
||||
|
||||
For example, when accessing the API from a *superuser* account:
|
||||
|
||||
{% with id="api_roles", url="api/api_roles.png", description="API superuser roles" %}
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
Or, when accessing the API from an account which has read-only permissions:
|
||||
|
||||
{% with id="api_roles_2", url="api/api_roles_2.png", description="API user roles" %}
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
### Permission Denied
|
||||
|
||||
If an API action outside of the user's role(s) is attempted, the server will respond with a 403 permission error message.
|
||||
|
||||
|
@ -13,7 +13,3 @@ A list of known third-party InvenTree extensions is provided below. If you have
|
||||
### PK2InvenTree
|
||||
|
||||
[PK2InvenTree](https://github.com/rgilham/PK2InvenTree) is an open-source tool for migrating an existing [PartKeepr](https://github.com/partkeepr/PartKeepr) database to InvenTree.
|
||||
|
||||
### inventree-docker
|
||||
|
||||
[inventree-docker](https://github.com/Zeigren/inventree-docker) provides Docker support for InvenTree
|
@ -88,6 +88,8 @@ stock_item.uploadTestResult("Firmware", True, value="0x12345678", attachment="de
|
||||
```python
|
||||
from inventree.part import Part, PartCategory
|
||||
from inventree.stock import StockItem
|
||||
from inventree.base import Parameter
|
||||
from inventree.base import ParameterTemplate
|
||||
|
||||
## Create a new PartCategory object,
|
||||
## underneath the existing category with pk 7
|
||||
@ -108,12 +110,91 @@ couch = Part.create(api, {
|
||||
## Note - You do not have to fill out *all* fields
|
||||
})
|
||||
|
||||
## Create a new StockItem
|
||||
item = StockItem.create(api, {
|
||||
'part': couch.pk,
|
||||
'quantity': 5,
|
||||
'notes': 'A stack of couches',
|
||||
'location': 10, ## PK of a StockLocation already in the database...
|
||||
})
|
||||
## Before we can add parameters to the couch, we neeed to create the parameter templates
|
||||
## These parameter templates need to be defined only once and can be used for all other parts.
|
||||
LengthTemplate = ParameterTemplate.create(api, { 'name' : 'Length', 'units' : 'Meters' })
|
||||
WeightTemplate = ParameterTemplate.create(api, { 'name' : 'Weight', 'units' : 'kg' })
|
||||
|
||||
## Now we create the parameters
|
||||
ParameterLength = Parameter.create(api, { 'part': couch.pk, 'template': LengthTemplate.pk, 'data' : 2 })
|
||||
ParameterWeight = Parameter.create(api, { 'part': couch.pk, 'template': WeightTemplate.pk, 'data' : 60 })
|
||||
|
||||
## Add a picture to the part
|
||||
couch.upload_image('my_nice_couch.jpg')
|
||||
```
|
||||
|
||||
#### Adding a location to the sofa
|
||||
|
||||
If we have several sofas on stock we need to know there we have stored them. So let’s add stock locations to the part. Stock locations can be organized in a hierarchical manner e.g. boxes in shelves in aisles in rooms. So each location can have a parent. Let’s assume we have 10 sofas in box 12 and 3 sofas in box 13 located in shelve 43 aisle 3. First we have to create the locations, afterwards we can put the sofas inside.
|
||||
|
||||
```python
|
||||
|
||||
from inventree.stock import StockLocation
|
||||
from inventree.stock import StockItem
|
||||
|
||||
...
|
||||
|
||||
## Create the stock locations. Leave the parent empty for top level hierarchy
|
||||
Aisle3 = StockLocation.create(api, {'name':'Aisle 3','description':'Aisle for sofas','parent':''})
|
||||
Shelve43 = StockLocation.create(api, {'name':'Shelve 43','description':'Shelve for sofas','parent':Aisle3.pk})
|
||||
Box12 = StockLocation.create(api, {'name':'Box 12','description':'green box','parent':Shelve43.pk})
|
||||
Box13 = StockLocation.create(api, {'name':'Box 13','description':'red box','parent':Shelve43.pk})
|
||||
|
||||
## Now fill them with items
|
||||
Id1 = StockItem.create(api, { 'part': sofa.pk, 'quantity': 10, 'notes': 'new ones', 'location': Box12.pk, ‘status’:10 })
|
||||
Id2 = StockItem.create(api, { 'part': sofa.pk, 'quantity': 3, 'notes': 'old ones', 'location': Box13.pk, ‘status’:55 })
|
||||
|
||||
```
|
||||
Please recognize the different status flags. 10 means OK, 55 means damaged. We have the following choices:
|
||||
|
||||
* 10: OK
|
||||
* 50: Attention needed
|
||||
* 55: Damaged
|
||||
* 60: Destroyed
|
||||
* 65: Rejected
|
||||
* 70: Lost
|
||||
* 85: Returned
|
||||
|
||||
#### Adding manufacturers and supplier
|
||||
|
||||
We can add manufacturers and suppliers to parts. If we add a manufacturer, a supplier is also mandatory. So we first need to create two companies, ACME (manufacturer) and X-Store (supplier).
|
||||
|
||||
```python
|
||||
from inventree.company import Company
|
||||
|
||||
...
|
||||
|
||||
acme = Company.create(api, {
|
||||
'name' : 'ACME',
|
||||
'description':'A Company that makes everything',
|
||||
'website':'https://www.acme.bla',
|
||||
'is_customer':0,
|
||||
'is_manufacturer':1,
|
||||
'is_supplier':0
|
||||
})
|
||||
xstore = Company.create(api, {
|
||||
'name' : 'X-Store',
|
||||
'description':'A really cool online store',
|
||||
'website':'https://www.xst.bla',
|
||||
'is_customer':0,
|
||||
'is_manufacturer':0,
|
||||
'is_supplier':1
|
||||
})
|
||||
```
|
||||
|
||||
Please recognize the different flag settings for is_supplier and is_manufacturer. Now lets add those to our couch:
|
||||
|
||||
```python
|
||||
from inventree.company import SupplierPart
|
||||
|
||||
...
|
||||
|
||||
SupplierPart.create(api,{
|
||||
'part':couch.pk,
|
||||
'supplier':xstore.pk,
|
||||
'SKU':'some_code',
|
||||
'manufacturer':acme.pk
|
||||
})
|
||||
```
|
||||
|
||||
Supplier and manufacturer are added with just one command. The SKU is the code under which the couch is listed in the store.
|
||||
|
51
docs/faq.md
Normal file
@ -0,0 +1,51 @@
|
||||
---
|
||||
title: FAQ
|
||||
---
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
### Feature *x* is not visible after update
|
||||
|
||||
If a particular menu / item is not visible after updating InvenTree, it may be due to your internet browser caching old versions of CSS and JavaScript files.
|
||||
|
||||
Before [raising an issue](https://github.com/inventree/inventree/issues), try hard-refreshing the browser cache:
|
||||
|
||||
<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>R</kbd>
|
||||
|
||||
or
|
||||
|
||||
<kbd>Ctrl</kbd> + <kbd>F5</kbd>
|
||||
|
||||
### Problems Installing on Windows
|
||||
|
||||
InvenTree installation is not officially supported natively on Windows. Install using the WSL framework.
|
||||
|
||||
### Command 'inv' / 'invoke' not found
|
||||
|
||||
If the `inv` or `invoke` command does not work, it means that the [invoke](https://pypi.org/project/invoke/) python library has not been correctly installed.
|
||||
|
||||
Update the installed python packages with PIP:
|
||||
|
||||
```
|
||||
pip3 install -U -r requirements.txt
|
||||
```
|
||||
|
||||
### ModuleNotFoundError: No module named 'django'
|
||||
|
||||
Most likely you are trying to run the InvenTree server from outside the context of the virtual environment where the required python libraries are installed.
|
||||
|
||||
Always activate the virtual environment before running server commands!
|
||||
|
||||
### Background Worker "Not Running"
|
||||
|
||||
The background worker process must be started separately to the web-server application.
|
||||
|
||||
From the top-level source directory, run the following command from a separate terminal, while the server is already running:
|
||||
|
||||
```
|
||||
invoke worker
|
||||
```
|
||||
|
||||
!!! info "Supervisor"
|
||||
|
||||
A better option is to manage the background worker process using a process manager such as supervisor. Refer to the [production server guide](../start/production).
|
45
docs/features.md
Normal file
@ -0,0 +1,45 @@
|
||||
---
|
||||
title: Features
|
||||
---
|
||||
|
||||
## Organize Parts
|
||||
|
||||
Parts are the fundamental element of any inventory. InvenTree groups parts into structured categories which allow you to arrange parts to meet your particular needs.
|
||||
|
||||
[Read more...](./part/part)
|
||||
|
||||
## Manage Suppliers
|
||||
|
||||
InvenTree allows you to easily create, modify or delete suppliers and supplier items linked to any part in your inventory.
|
||||
|
||||
[Read more...](./buy/supplier)
|
||||
|
||||
## Instant Stock Knowledge
|
||||
|
||||
Instantly view current stock for a certain part, in a particular location, or required for an individual build. Stock items are organized in cascading locations and sub-locations, allowing flexible inspection of stock under any location. Stock items can be serialized for tracking of individual items, and test results can be stored against a serialized stock item for the purpose of acceptance testing and commissioning.
|
||||
|
||||
[Read more...](./stock/stock)
|
||||
|
||||
## BOM Management
|
||||
|
||||
Intelligent BOM (Bill of Material) management provides a clear understanding of the sub-parts required to make a new part.
|
||||
InvenTree allows you to upload simple BOM files in multiple formats, and download a detailed BOM with all the information stored in its database.
|
||||
|
||||
[Read more...](./build/bom)
|
||||
|
||||
## Build Parts
|
||||
|
||||
Inventree features a build management system to help you track the progress of your builds.
|
||||
Builds consume stock items to make new parts, you can decide to automatically or manually allocate parts from your current inventory.
|
||||
|
||||
[Read more...](./build/build)
|
||||
|
||||
## Report
|
||||
|
||||
Generate a wide range of reports using custom templates. [Read more...](./report/report)
|
||||
|
||||
## Extend and Customize
|
||||
|
||||
InvenTree is designed to be highly extensible. If the core InvenTree functionality does not meet your particular need, InvenTree provides a RESTful API, a native Python library, and a powerful plugin system.
|
||||
|
||||
[Read more...](./extend/api)
|
@ -2,7 +2,12 @@
|
||||
title: InvenTree
|
||||
---
|
||||
|
||||
## InvenTree - Intuitive Inventory Management
|
||||
## Intuitive Inventory Management
|
||||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://github.com/inventree/inventree)
|
||||
[](https://hub.docker.com/r/inventree/inventree)
|
||||
|
||||
|
||||
InvenTree is an open-source inventory management system which provides intuitive parts management and stock control.
|
||||
|
||||
@ -16,48 +21,12 @@ InvenTree is designed to allow for a flexible installation. You could run the In
|
||||
|
||||
## Features
|
||||
|
||||
### Organize Parts
|
||||
|
||||
Parts are the fundamental element of any inventory. InvenTree groups parts into structured categories which allow you to arrange parts to meet your particular needs.
|
||||
|
||||
[Read more...](./part/part)
|
||||
|
||||
### Manage Suppliers
|
||||
|
||||
InvenTree allows you to easily create, modify or delete suppliers and supplier items linked to any part in your inventory.
|
||||
|
||||
[Read more...](./buy/supplier)
|
||||
|
||||
### Instant Stock Knowledge
|
||||
|
||||
Instantly view current stock for a certain part, in a particular location, or required for an individual build. Stock items are organized in cascading locations and sub-locations, allowing flexible inspection of stock under any location. Stock items can be serialized for tracking of individual items, and test results can be stored against a serialized stock item for the purpose of acceptance testing and commissioning.
|
||||
|
||||
[Read more...](./stock/stock)
|
||||
|
||||
### BOM Management
|
||||
|
||||
Intelligent BOM (Bill of Material) management provides a clear understanding of the sub-parts required to make a new part.
|
||||
InvenTree allows you to upload simple BOM files in multiple formats, and download a detailed BOM with all the information stored in its database.
|
||||
|
||||
[Read more...](./build/bom)
|
||||
|
||||
### Build Parts
|
||||
|
||||
Inventree features a build management system to help you track the progress of your builds.
|
||||
Builds consume stock items to make new parts, you can decide to automatically or manually allocate parts from your current inventory.
|
||||
|
||||
[Read more...](./build/build)
|
||||
|
||||
### Report
|
||||
|
||||
Generate a wide range of reports using custom templates. [Read more...](./report/report)
|
||||
|
||||
### Extend and Customize
|
||||
|
||||
InvenTree is designed to be highly extensible. If the core InvenTree functionality does not meet your particular need, InvenTree provides a RESTful API, a native Python library, and a powerful plugin system.
|
||||
|
||||
[Read more...](./extend/api)
|
||||
Refer to the [features](./features) page for a rundown on the features that InvenTree provides out of the box.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Refer to the [installation guide](./start/install) for instructions on installing InvenTree. The server where InvenTree is to be installed will need to meet some basic package requirements, and a certain level of system administration understanding is assumed.
|
||||
Refer to the [installation guide](./start/intro) for instructions on installing InvenTree. The server where InvenTree is to be installed will need to meet some basic package requirements, and a certain level of system administration understanding is assumed.
|
||||
|
||||
## Get the App
|
||||
|
||||
InvenTree is supported by a [companion mobile app](./app/app) which is tightly integrated with the InvenTree database. Lightning fast stock control, in your pocket!
|
@ -42,5 +42,5 @@ Select the parameter `Template` you would like to use for this parameter, fill-o
|
||||
|
||||
### Parametric Tables
|
||||
|
||||
!!! note "Future Feature Proposal"
|
||||
!!! info "Future Feature Proposal"
|
||||
Allow parts to be filtered using parameters. Narrow down the list of parameters to the parts found in each category.
|
||||
|
@ -4,7 +4,7 @@ title: Release 0.1.7
|
||||
|
||||
## Release 0.1.7
|
||||
|
||||
[Release 0.1.7](https://github.com/inventree/InvenTree/releases/tag/0.1.7) (WIP) provides a number of major new features and improvements, as well as some crucial bug fixes:
|
||||
[Release 0.1.7](https://github.com/inventree/InvenTree/releases/tag/0.1.7) provides a number of major new features and improvements, as well as some crucial bug fixes:
|
||||
|
||||
## New Features
|
||||
|
||||
@ -17,7 +17,43 @@ Label printing functionality has been simplified and brought into line with the
|
||||
!!! info "More Information"
|
||||
Refer to the [label printing documentation](../../report/labels) for further details.
|
||||
|
||||
### Display Sub Builds
|
||||
|
||||
[#1344](https://github.com/inventree/InvenTree/pull/1344) adds display of sub-builds under the build detail
|
||||
|
||||
### Recently Updated Stock
|
||||
|
||||
[#1350](https://github.com/inventree/InvenTree/pull/1350) adds *Recently Updated Stock* view to the index page
|
||||
|
||||
### Menubar Improvements
|
||||
|
||||
[#1352](https://github.com/inventree/InvenTree/pull/1354) provides a *significant* visual improvement for displaying menubars on various pages. The previous *tab style* navigation has been removed, and replaced with a vertical menu which can be toggled between icon-and-text or icon-only.
|
||||
|
||||
### API Permissions
|
||||
|
||||
[#1363](https://github.com/inventree/InvenTree/pull/1363) enforces user role permissions onto the REST API endpoints. Authenticated users can now only perform REST actions which align with their allocated role(s). Refer to the [API documentation](../../extend/api/#authorization) for further information.
|
||||
|
||||
### Query Pagination
|
||||
|
||||
[#1373](https://github.com/inventree/InvenTree/pull/1373) *finally* introduces server-side pagination of large querysets, resulting in a significantly improved user experience. For larger data sets, retrieval time has been reduced from multiple seconds to ~100ms.
|
||||
|
||||
### Search Results
|
||||
|
||||
[#1385](https://github.com/inventree/InvenTree/pull/1385) adds some additional search results to the *Search* page. Users can now search:
|
||||
|
||||
- Build Orders
|
||||
- Purchase Orders
|
||||
- Sales Orders
|
||||
|
||||
## Major Bug Fixes
|
||||
|
||||
| PR | Description |
|
||||
| --- | --- |
|
||||
| [#1341](https://github.com/inventree/InvenTree/pull/1341) | Fixes display issue with Part variant table |
|
||||
| [#1351](https://github.com/inventree/InvenTree/pull/1351) | Fixes bug which prevented filtering of reports and labels to work correctly |
|
||||
| [#1352](https://github.com/inventree/InvenTree/pull/1352) | Fixes bug updating part "trackable" status |
|
||||
| [#1353](https://github.com/inventree/InvenTree/pull/1353) | Fixes bug which caused error when "special" regex characters were used for part search |
|
||||
| [#1371](https://github.com/inventree/InvenTree/pull/1371) | Fixes a *very* long-running bug whereby API requests for invalid endpoints were redirected to the web-view index page |
|
||||
| [#1379](https://github.com/inventree/InvenTree/pull/1379) | Fixes an obtuse bug introduced by the new server-side pagination feature |
|
||||
| [#1381](https://github.com/inventree/InvenTree/pull/1381) | Fixes permissions error caused by incorrect table name lookup |
|
||||
|
||||
|
43
docs/releases/0.1.8.md
Normal file
@ -0,0 +1,43 @@
|
||||
---
|
||||
title: Release 0.1.8
|
||||
---
|
||||
|
||||
## Release 0.1.8
|
||||
|
||||
[Release 0.1.8](https://github.com/inventree/InvenTree/releases/tag/0.1.8) provides a number of major new features and improvements, as well as some crucial bug fixes:
|
||||
|
||||
## New Features
|
||||
|
||||
### Order Responsibility
|
||||
|
||||
[#1395](https://github.com/inventree/InvenTree/pull/1395) adds the concept of *responsibility* for Purchase Orders and Sales Orders. Orders can be assigned to either an individual user, or an entire group.
|
||||
|
||||
### Order Reports
|
||||
|
||||
[#1397](https://github.com/inventree/InvenTree/pull/1397) adds the ability to generate PDF Reports against Purchase Orders and Sales Orders. This new feature provides a framework for generating reports such as invoices, sales orders, packing lists, etc. While it provides the framework for such reports, generic templates for these report types have not yet been created.
|
||||
|
||||
### Global Setting for Part IPN Edit
|
||||
[#1400](https://github.com/inventree/InvenTree/pull/1400) adds the ability to disable IPN field when editing part information for **all** parts and **all** users. This global setting is located in the "Part" section of the InvenTree settings. Toggling it off means the IPN field cannot be edited manually anymore after a part is created (the field is greyed out). Only admin users retain the ability to edit this field.
|
||||
|
||||
{% with id="disable_ipn_edit", url="part/part_ipn_editing.png", description="Disable Edit of Part IPN Field" %}
|
||||
{% include 'img.html' %}
|
||||
{% endwith %}
|
||||
|
||||
### Image Download
|
||||
|
||||
[#1410](https://github.com/inventree/InvenTree/pull/1410) introduces a new feature which allows thumbnail images (e.g. for *Part* and *Company* objects) to be downloaded from a remote URL (by the server). This feature is disabled by default, and must be enabled in the *Global Settings* menu.
|
||||
|
||||
### Assign by Serial Number
|
||||
|
||||
[#1426](https://github.com/inventree/InvenTree/pull/1426) introduces a new feature which allows stock items to be allocated to a sales order using serial number references. This provides a much more streamlined user experience. Refer to the [sales order documentation](../../companies/so/) for further information.
|
||||
|
||||
## Major Bug Fixes
|
||||
|
||||
| PR | Description |
|
||||
| --- | --- |
|
||||
| [#1407](https://github.com/inventree/InvenTree/pull/1407) | Fixes unncessary column requirement when importing BOM |
|
||||
| [#1430](https://github.com/inventree/InvenTree/pull/1430) | Fixes error thrown when migrating from very old data set |
|
||||
| [#1441](https://github.com/inventree/InvenTree/pull/1441) | Fixes template rendering error if git not available on system path |
|
||||
| [#1446](https://github.com/inventree/InvenTree/pull/1446) | Fixes bug exporting BOM to YAML format |
|
||||
| [#1449](https://github.com/inventree/InvenTree/pull/1449) | Fixes bug which prevented transfer of serialized stock items |
|
||||
|
34
docs/releases/0.2.0.md
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
title: Release 0.2.0
|
||||
---
|
||||
|
||||
## Release 0.2.0
|
||||
|
||||
[Release 0.2.0](https://github.com/inventree/InvenTree/releases/tag/0.2.0) introduces some major new features!
|
||||
|
||||
## Background Worker
|
||||
|
||||
This release adds a "background worker" - a separately managed process which allows long-running or asynchronous tasks to be handled separately to web server requests.
|
||||
|
||||
This feature is critical for the InvenTree development path, allowing (in future releases) for complex tasks to be handled, such as email support, automatic report generation, and integration with third party services.
|
||||
|
||||
For more information on the background worker, refer to the [background tasks documentation](../../admin/tasks).
|
||||
|
||||
!!! info "Installation"
|
||||
Instructions for managing the background worker process are included in the [installation guide](../../start/install).
|
||||
|
||||
!!! warning "Upgrading"
|
||||
If you are upgrading your InvenTree installation from an older version, you will need to ensure that you are also now running the background worker process!
|
||||
|
||||
## Docker
|
||||
|
||||
The other major feature that `0.2.0` introduces is an officical docker installation guide.
|
||||
|
||||
The addition of the *Background Worker* process significantly increases the complexity of an InvenTree installation. Further, a robust *production grade* server requires a lot of work.
|
||||
|
||||
To simplify this, an official InvenTree docker image is available on [DockerHub](https://hub.docker.com/inventree/inventree).
|
||||
|
||||
!!! success "Docker Is the Way"
|
||||
Docker is now the recommended way to install InvenTree
|
||||
|
||||
Refer to the [docker setup guide](../../start/docker) for further information!
|
15
docs/releases/0.2.1.md
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
title: Release 0.2.1
|
||||
---
|
||||
|
||||
## Release 0.2.1
|
||||
|
||||
[Release 0.2.1](https://github.com/inventree/InvenTree/releases/tag/0.2.1) provides a number of major new features and improvements, as well as some crucial bug fixes:
|
||||
|
||||
## New Features
|
||||
|
||||
## Major Bug Fixes
|
||||
|
||||
| PR | Description |
|
||||
| --- | --- |
|
||||
| [#1453](https://github.com/inventree/InvenTree/pull/1453) | Adds *detail* API endpoint for the `PartParameter` model, which was previously missing. |
|
@ -8,7 +8,10 @@ For information on the latest and greatest InvenTree features, refer to the rele
|
||||
|
||||
| Release | Date |
|
||||
| ------- | ---- |
|
||||
| [0.1.7](../0.1.7) | *In Development* |
|
||||
| [0.2.1](../0.2.1) | *In Development* |
|
||||
| [0.2.0](../0.2.0) | April 2021 |
|
||||
| [0.1.8](../0.1.8) | April 2021 |
|
||||
| [0.1.7](../0.1.7) | March 2021 |
|
||||
| [0.1.6](../0.1.6) | February 2021 |
|
||||
| [0.1.5](../0.1.5) | January 2021 |
|
||||
| [0.1.4](../0.1.4) | November 2020 |
|
||||
|
@ -27,8 +27,10 @@ Below is a reasonably simple example of a label template which demostrates much
|
||||
{% raw %}
|
||||
<style>
|
||||
@page {
|
||||
size: 75mm 24mm;
|
||||
width: 75mm;
|
||||
height: 24mm;
|
||||
padding: 1mm;
|
||||
margin: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
.location {
|
||||
@ -55,7 +57,7 @@ Below is a reasonably simple example of a label template which demostrates much
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
{% load barcode %}
|
||||
<img class='qr' src="{% qrcode location.format_barcode %}"/>
|
||||
|
||||
<div class='location'>
|
||||
|
@ -6,16 +6,20 @@ title: Database Configuration
|
||||
|
||||
Admin users will need to adjust the InvenTree installation to meet the particular needs of their setup. For example, pointing to the correct database backend, or specifying a list of allowed hosts.
|
||||
|
||||
The Django configuration parameters are found in the normal place (*settings.py*). However the settings presented in this file should not be adjusted as they will alter the core behaviour of the InvenTree application.
|
||||
InvenTree system settings can be specified in a configuration file, or via environment variables.
|
||||
|
||||
!!! info "Environment Variables"
|
||||
Settings specified using environment variables take priority
|
||||
|
||||
### Configuration File
|
||||
|
||||
To support install specific settings, a simple configuration file ``config.yaml`` is provided. This configuration file is loaded by the InvenTree server at runtime. Settings specific to a given install should be adjusted in ``config.yaml``.
|
||||
|
||||
!!! info "Config file location"
|
||||
The InvenTree config file is located at `./InvenTree/config.yaml`
|
||||
The default InvenTree config file is located at `./InvenTree/config.yaml`
|
||||
|
||||
The default configuration file launches a *DEBUG* configuration with a simple SQLITE database backend. This default configuration file is shown below:
|
||||
However, the config file can be placed elsewhere, and specified with the `INVENTREE_CONFIG_FILE` environment variable.
|
||||
|
||||
The default configuration file file is shown below:
|
||||
|
||||
``` yaml
|
||||
{% include 'config.yaml' %}
|
||||
@ -34,7 +38,7 @@ In addition to specifying InvenTree options via the `config.yaml` file, these op
|
||||
!!! warning Available Variables
|
||||
Some configuration options cannot be set via environment variables. Refer to the documentation below.
|
||||
|
||||
### Basic Options
|
||||
## Basic Options
|
||||
|
||||
The following basic options are available:
|
||||
|
||||
@ -43,7 +47,7 @@ The following basic options are available:
|
||||
| INVENTREE_DEBUG | debug | Enable debug mode |
|
||||
| INVENTREE_LOG_LEVEL | log_level | Set level of logging to terminal |
|
||||
|
||||
### Secret Key
|
||||
## Secret Key
|
||||
|
||||
InvenTree requires a secret key for providing cryptographic signing - this should be a secret (and unpredictable) value.
|
||||
|
||||
@ -61,7 +65,7 @@ A file containing the secret key can be passed via the environment variable `INV
|
||||
|
||||
If not specified via environment variables, the fallback secret_key file (automatically generated as part of InvenTree installation) will be used.
|
||||
|
||||
### Database Options
|
||||
## Database Options
|
||||
|
||||
InvenTree provides support for multiple database backends - any backend supported natively by Django can be used.
|
||||
|
||||
@ -78,50 +82,8 @@ The following database options can be configured:
|
||||
| INVENTREE_DB_HOST | database.HOST | Database host address (if required) |
|
||||
| INVENTREE_DB_PORT | database.PORT | Database host port (if required) |
|
||||
|
||||
Instructions for particular database backends are provided below:
|
||||
|
||||
#### SQLite
|
||||
By default, InvenTree uses an sqlite database file : `inventree_db.sqlite3`. This provides a simple, portable database file that is easy to use for debug and testing purposes.
|
||||
|
||||
#### MySQL
|
||||
MySQL database backend is supported with the native Django implemetation. To run InvenTree with the MySQL backend, a number of extra packages need to be installed:
|
||||
|
||||
* mysql-server - *MySQL backend server*
|
||||
* libmysqlclient-dev - *Required for connecting to the MySQL database in Python*
|
||||
* (pip) mysqlclient - *Python package for communication with MySQL database*
|
||||
|
||||
To install these required packages, run the following command:
|
||||
|
||||
```
|
||||
inv mysql
|
||||
```
|
||||
|
||||
It is then up to the database adminstrator to create a new MySQL database to store inventree data, in addition to a username/password to access the data.
|
||||
|
||||
!!! info "MySQL Collation"
|
||||
When creating the MySQL database, the adminstrator must ensure that the collation option is set to **utf8_unicode_520_ci** to ensure that InvenTree features function correctly.
|
||||
|
||||
The database options (in the `config.yaml` file) then need to be adjusted to communicate the MySQL backend. Refer to the [Django docs](https://docs.djangoproject.com/en/dev/ref/databases/) for further information.
|
||||
|
||||
#### PostgreSQL
|
||||
PostgreSQL database backend is supported with the native Django implementation. Note that to use this backend, the following system packages must be installed:
|
||||
|
||||
* postgresql
|
||||
* postgresql-contrib
|
||||
* libpq-dev
|
||||
* (pip3) psycopg2
|
||||
|
||||
To install these required packages, run the following commands:
|
||||
|
||||
```
|
||||
inv postgresql
|
||||
```
|
||||
|
||||
It is then up to the database adminstrator to create a new PostgreSQL database to store inventree data, in addition to a username/password to access the data.
|
||||
|
||||
The database options (in the `config.yaml` file) then need to be adjusted to communicate the PostgreSQL backend. Refer to the [Django docs](https://docs.djangoproject.com/en/dev/ref/databases/) for further information.
|
||||
|
||||
### Allowed Hosts / CORS
|
||||
## Allowed Hosts / CORS
|
||||
|
||||
By default, all hosts are allowed, and CORS requests are enabled from any origin. **This is not secure and should be adjusted for your installation**. These options can be changed in the configuration file.
|
||||
|
||||
@ -130,24 +92,28 @@ For further information, refer to the following documentation:
|
||||
* [Django ALLOWED_HOSTS](https://docs.djangoproject.com/en/2.2/ref/settings/#allowed-hosts)
|
||||
* [Django CORS headers](https://github.com/OttoYiu/django-cors-headers)
|
||||
|
||||
## File Storage Locations
|
||||
|
||||
### Static File Storage
|
||||
|
||||
By default, static files are stored in the local directory `./inventree_static`. This directory should be changed by specifying the `static_root` option in the config file based on the particular installation requirements.
|
||||
By default, static files are stored in the local directory `/home/inventree/static`. This directory should be changed by specifying the `static_root` option in the config file based on the particular installation requirements.
|
||||
|
||||
Alternatively this location can be specified with the `INVENTREE_STATIC_ROOT` environment variable.
|
||||
|
||||
### Uploaded File Storage
|
||||
|
||||
By default, uploaded media files are stored in the local directory `./inventree_media`. This directory should be changed by specifying the `media_root` option in the config file based on the particular installation requirements.
|
||||
By default, uploaded media files are stored in the local directory `/home/inventree/media`. This directory should be changed by specifying the `media_root` option in the config file based on the particular installation requirements.
|
||||
|
||||
Alternatively this location can be specified with the `INVENTREE_MEDIA_ROOT` environment variable.
|
||||
|
||||
### Backup Location
|
||||
|
||||
The default behaviour of the database backup is to generate backup files for database tables and media files to the user's temporary directory. The target directory can be overridden by setting the `backup_dir` parameter in the config file.
|
||||
The default behaviour of the database backup is to generate backup files for database tables and media files to `/home/inventree/backup`. The target directory can be overridden by setting the `backup_dir` parameter in the config file.
|
||||
|
||||
Alternatively this location can be specified with the `INVENTREE_BACKUP_DIR` environment variable.
|
||||
|
||||
## Other Options
|
||||
|
||||
### Authentication Backends
|
||||
|
||||
Custom authentication backends can be used by specifying them here
|
||||
|
@ -1,82 +0,0 @@
|
||||
---
|
||||
title: Deploy InvenTree
|
||||
---
|
||||
|
||||
## Deploying InvenTree
|
||||
|
||||
The development server provided by the Django ecosystem may be fine for a testing environment or small contained setups. However special consideration must be given when deploying InvenTree in a real-world environment.
|
||||
|
||||
Django apps provide multiple deployment methods - see the [Django documentation](https://docs.djangoproject.com/en/2.2/howto/deployment/).
|
||||
|
||||
There are also numerous online tutorials describing how to deploy a Django application either locally or on an online platform.
|
||||
|
||||
### Development Server
|
||||
|
||||
The InvenTree development server is useful for testing and configuration - and it may be wholly sufficient for a small-scale installation.
|
||||
|
||||
#### Running on a Local Machine
|
||||
|
||||
To run the development server on a local machine, run the command:
|
||||
|
||||
```
|
||||
inv server -a 127.0.0.1:8000
|
||||
```
|
||||
|
||||
Serving on the address `127.0.0.1` means that InvenTree will only be available *on that computer*. The server will be accessible from a web browser on the same computer, but not from any other computers on the local network.
|
||||
|
||||
#### Running on a Local Network
|
||||
|
||||
To enable access to the InvenTree server from other computers on a local network, you need to know the IP of the computer running the server. For example, if the server IP address is `192.168.120.1`:
|
||||
|
||||
```
|
||||
inv server -a 192.168.120.1:8000
|
||||
```
|
||||
|
||||
!!! warning "Not For Production"
|
||||
It should be noted that the *development server* provided with django / InvenTree is probably not suitable for your production environment. Instead, use a proper web-server (such as Gunicorn, below).
|
||||
|
||||
## Gunicorn
|
||||
|
||||
Following is a simple tutorial on serving InvenTree using [Gunicorn](https://gunicorn.org/). Gunicorn is a Python WSGI server which provides a multi-worker server which is well suited to handling multiple simultaneous requests. Gunicorn is a solid choice for a production server which is easy to configure and performs well in a multi-user environment.
|
||||
|
||||
### Install Gunicorn
|
||||
|
||||
Gunicorn can be installed using PIP:
|
||||
|
||||
```
|
||||
pip3 install gunicorn
|
||||
```
|
||||
|
||||
!!! warning "Python Environment"
|
||||
Ensure that gunicorn is installed within the same python environment context as the InvenTree install - otherwise gunicorn will not be able to import the correct python modules.
|
||||
|
||||
### Configure Static Directories
|
||||
|
||||
Directories for storing *media* files and *static* files should be specified in the ``config.yaml`` configuration file. These directories are the ``MEDIA_ROOT`` and ``STATIC_ROOT`` paths required by the Django app. Ensure that both of these directories are correctly configured for your setup.
|
||||
|
||||
### Collect Static Files
|
||||
|
||||
The required static files must be collected into the specified ``STATIC_ROOT`` directory:
|
||||
|
||||
```
|
||||
inv static
|
||||
```
|
||||
|
||||
This command collects all of the required static files (including script and css files) into the specified directory ready to be served.
|
||||
|
||||
### Configure Gunicorn
|
||||
|
||||
The Gunicorn server can be configured with a simple configuration file (e.g. python script). An example configuration file is provided in ``InvenTree/gunicorn.conf.py``
|
||||
|
||||
``` python
|
||||
{% include 'gunicorn.conf.py' %}
|
||||
```
|
||||
|
||||
This file can be used to configure the Gunicorn server to match particular requirements.
|
||||
|
||||
### Run Gunicorn
|
||||
|
||||
```
|
||||
cd InvenTree
|
||||
gunicorn -c gunicorn.conf.py InvenTree.wsgi
|
||||
```
|
58
docs/start/development.md
Normal file
@ -0,0 +1,58 @@
|
||||
---
|
||||
title: Development Server
|
||||
---
|
||||
|
||||
## Development Server
|
||||
|
||||
!!! warning "Installation"
|
||||
Before continuing, ensure that the [installation steps](../install) have been completed.
|
||||
|
||||
InvenTree includes a simple server application, suitable for use in a development environment.
|
||||
|
||||
!!! warning "Deployment"
|
||||
Refer to the [production server instructions](../production) to implement a much more robust server setup.
|
||||
|
||||
### Running on a Local Machine
|
||||
|
||||
To run the development server on a local machine, run the command:
|
||||
|
||||
```
|
||||
(env) inv server
|
||||
```
|
||||
|
||||
This will launch the InvenTree web interface at `http://127.0.0.1:8000`.
|
||||
|
||||
A different port can be specified using the `-a` flag:
|
||||
|
||||
```
|
||||
(env) inv server -a 127.0.0.1:8123
|
||||
```
|
||||
|
||||
Serving on the address `127.0.0.1` means that InvenTree will only be available *on that computer*. The server will be accessible from a web browser on the same computer, but not from any other computers on the local network.
|
||||
|
||||
### Running on a Local Network
|
||||
|
||||
To enable access to the InvenTree server from other computers on a local network, you need to know the IP of the computer running the server. For example, if the server IP address is `192.168.120.1`:
|
||||
|
||||
```
|
||||
(env) inv server -a 192.168.120.1:8000
|
||||
```
|
||||
|
||||
## Background Worker
|
||||
|
||||
The backgroun task manager must also be started. The InvenTree server is already running in the foreground, so open a *new shell window* to start the server.
|
||||
|
||||
### Activate Virtual Environment
|
||||
|
||||
```
|
||||
cd /home/inventree
|
||||
source ./env/bin/activate
|
||||
```
|
||||
|
||||
### Start Background Worker
|
||||
|
||||
```
|
||||
(env) invoke worker
|
||||
```
|
||||
|
||||
This will start the background process manager in the current shell.
|
161
docs/start/docker.md
Normal file
@ -0,0 +1,161 @@
|
||||
---
|
||||
title: Docker Setup
|
||||
---
|
||||
|
||||
## Docker Image
|
||||
|
||||
The most convenient method of installing and running InvenTree is to use the official [docker image](https://hub.docker.com/inventree/inventree).
|
||||
|
||||
The InvenTree docker image contains all the required system packages, python modules, and configuration files for running InvenTree.
|
||||
|
||||
## Docker Compose
|
||||
|
||||
An example docker compose script is provided below, which provides a robust "out of the box" setup for running InvenTree.
|
||||
|
||||
### Containers
|
||||
|
||||
The following containers are created:
|
||||
|
||||
#### PostgreSQL Database
|
||||
|
||||
A postgresql database container which creates a postgres user:password combination (which can be changed)
|
||||
|
||||
#### Web Server
|
||||
|
||||
InvenTree web server running on a Gunicorn backend
|
||||
|
||||
#### Background Worker
|
||||
|
||||
InvenTree background worker process manager
|
||||
|
||||
#### Nginx
|
||||
|
||||
Nginx working as a reverse proxy, separating requests for static files and directing everything else to Gunicorn
|
||||
|
||||
### Volumes
|
||||
|
||||
There are two container volumes created:
|
||||
|
||||
#### Data
|
||||
|
||||
InvenTree stores data which is meant to be persistent (e.g. uploaded media files, database data, etc) in a volume which is mapped to a local system directory.
|
||||
|
||||
!!! info "Data Directory"
|
||||
Make sure you change the path to the local directory where you want persistent data to be stored.
|
||||
|
||||
#### Static
|
||||
|
||||
Static files are shared between multiple containers (but not exposed to the local file system).
|
||||
|
||||
### Docker Compose File
|
||||
|
||||
Use the following docker-compose file as a starting point:
|
||||
|
||||
``` yaml
|
||||
{% include 'docker-compose.yml' %}
|
||||
```
|
||||
|
||||
## Initial Setup Process
|
||||
|
||||
Follow the instructions below to initialize a complete docker deployment for InvenTree.
|
||||
|
||||
!!! info "Directory"
|
||||
It is assumed that all commands will be run from the directory where `docker-compose.yml` is located.
|
||||
|
||||
### Configure Compose File
|
||||
|
||||
Save and edit the `docker-compose.yml` file as required.
|
||||
|
||||
The only **required** change is to ensure that the `/path/to/data` entry (at the end of the file) points to the correct directory on your local file system, where you want InvenTree data to be stored.
|
||||
|
||||
### Launch Database Server
|
||||
|
||||
Before we can create the database, we need to launch the database server container:
|
||||
|
||||
```
|
||||
docker-compose up -d db
|
||||
```
|
||||
|
||||
This starts the database container.
|
||||
|
||||
### Create Database
|
||||
|
||||
Run the following command to open a shell session for the database:
|
||||
|
||||
```
|
||||
docker-compose run inventree pgcli -h db -p 5432 -u pguser
|
||||
```
|
||||
|
||||
!!! info "User"
|
||||
If you have changed the `POSTGRES_USER` variable in the compose file, replace `pguser` with the different user.
|
||||
|
||||
You will be prompted to enter the database user password (default="pgpassword", unless altered in the compose file).
|
||||
|
||||
Next, run the following command in the database shell:
|
||||
|
||||
```
|
||||
create database inventree;
|
||||
```
|
||||
|
||||
Then exit the shell with <kbd>Ctrl</kbd>+<kbd>d</kbd>
|
||||
|
||||
### Perform Database Migrations
|
||||
|
||||
The database has been created, but it is empty! We need to perform the initial database migrations.
|
||||
|
||||
```
|
||||
docker-compose run inventree invoke migrate
|
||||
```
|
||||
|
||||
This will perform the required schema updates to create the required database tables.
|
||||
|
||||
### Collect Static Files
|
||||
|
||||
On first run, the required static files must be collected into the `static` volume:
|
||||
|
||||
```
|
||||
docker-compose run inventree invoke static
|
||||
```
|
||||
|
||||
### Create Admin Account
|
||||
|
||||
You need to create an admin (superuser) account for the database. Run the command below, and follow the prompts:
|
||||
|
||||
```
|
||||
docker-compose run inventree invoke superuser
|
||||
```
|
||||
|
||||
### Configure InvenTree Options
|
||||
|
||||
By default, all required InvenTree settings are specified in the docker compose file, with the `INVENTREE_DB_` prefix.
|
||||
|
||||
You are free to skip this step, if these InvenTree settings meet your requirements.
|
||||
|
||||
If you wish to tweak the InvenTree configuration options, you can either:
|
||||
|
||||
#### Environment Variables
|
||||
|
||||
Alter (or add) environment variables into the docker-compose `environment` section
|
||||
|
||||
#### Configuration File
|
||||
|
||||
A configuration file `config.yaml` has been created in the data volume (at the location specified on your local disk).
|
||||
|
||||
Edit this file (as per the [configuration guidelines](../config)).
|
||||
|
||||
### Run Web Server
|
||||
|
||||
Now that the database has been created, migrations applied, and you have created an admin account, we are ready to launch the web server:
|
||||
|
||||
```
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
This command launches the remaining container processes:
|
||||
|
||||
- `inventree` - InvenTree web server
|
||||
- `worker` - Background worker
|
||||
- `nginx` - Nginx reverse proxy
|
||||
|
||||
!!! success "Up and Running!"
|
||||
You should now be able to view the InvenTree login screen at [http://localhost:1337](http://localhost:1337)
|
@ -2,212 +2,256 @@
|
||||
title: Install InvenTree
|
||||
---
|
||||
|
||||
## Introduction
|
||||
## Initial Setup
|
||||
|
||||
The InvenTree server application communicates with a backend database, and serves data to the user(s) via a web framework and an API. Before users can interact with the InvenTree system, the server must be installed and properly configured, and then the server process must be started (at a network location which is accessible to the users).
|
||||
Follow the instructions below to install the requried system packages, python modules, and InvenTree source code.
|
||||
|
||||
### Supported Databases
|
||||
### Install System Packages
|
||||
|
||||
InvenTree can be used by any database backend which is supported by the [Django framework](https://docs.djangoproject.com/en/3.0/ref/databases/):
|
||||
Install required system packages (as superuser):
|
||||
|
||||
* SQLite
|
||||
* PostgreSQL
|
||||
* MariaDB
|
||||
* MySQL
|
||||
* Oracle
|
||||
|
||||
Database selection should be determined by your particular installation requirements. By default, InvenTree uses SQLite which provides a simple file-based database that allows a quick setup for development and testing.
|
||||
|
||||
### Serving Data
|
||||
|
||||
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](https://gunicorn.org/). For more information see the [deployment documentation](./deploy).
|
||||
|
||||
## OS Requirements
|
||||
|
||||
To install a complete *development* environment for InvenTree, follow the steps presented below. A production environment will require further work as per the particular application requirements.
|
||||
|
||||
Installing and running InvenTree should be possible on most operating systems, as it requires only cross-platform Python libraries.
|
||||
|
||||
On some systems, the dependencies for the `weasyprint` package might not be installed. Consider running through the [weasyprint installation steps](https://weasyprint.readthedocs.io/en/stable/install.html) before moving forward.
|
||||
|
||||
### Linux
|
||||
|
||||
The InvenTree documentation assumes that the operating system is a Linux variant. To install the required python packages to get started on a Linux system, run the following commands:
|
||||
!!! warning "OS Specific Requirements"
|
||||
The following packages are required on a debian system. A different distribution may require a slightly different set of packages
|
||||
|
||||
```
|
||||
sudo apt-get update
|
||||
sudo apt-get install python3 python3-dev
|
||||
sudo apt-get install python3-pip python3-invoke
|
||||
sudo apt-get install python3-pip python3-invoke python3-venv
|
||||
```
|
||||
|
||||
!!! warning "Sudo"
|
||||
`apt-get` commands will (most likely) be required to run under sudo. Take care not to run the installation scripts under sudo, as this may alter the system python path and cause the InvenTree installation to not work correctly
|
||||
!!! warning "Weasyprint"
|
||||
On some systems, the dependencies for the `weasyprint` package might not be installed. Consider running through the [weasyprint installation steps](https://weasyprint.readthedocs.io/en/stable/install.html) before moving forward.
|
||||
|
||||
### Windows
|
||||
|
||||
InvenTree can be installed and run from the Windows command line, assuming the following binaries are available in the system PATH:
|
||||
### Create InvenTree User
|
||||
|
||||
- python3
|
||||
- pip3
|
||||
- invoke
|
||||
|
||||
!!! info "WSL"
|
||||
|
||||
Alternatively, if you are running under the Windows operating system you can install and run InvenTree using the [WSL (Windows Subsystem for Linux)](https://docs.microsoft.com/en-us/windows/wsl/install-win10) framework. Running under WSL provides a Linux compatible layer which simplifies InvenTree installation.
|
||||
|
||||
### FreeBSD
|
||||
|
||||
If you are running the FreeBSD operating system, run the following commands to install the required Python packages:
|
||||
!!! warning "Running as Root"
|
||||
It is highly recommended that the InvenTree server is not run under root. The deployment instructions assume that InvenTree is installed and run from a different user account.
|
||||
|
||||
Create a user account from which we will run the server:
|
||||
|
||||
```
|
||||
pkg install python
|
||||
pkg install py37-pip
|
||||
pkg install py37-wheel
|
||||
pkg install py37-invoke
|
||||
sudo useradd -m -d /home/inventree -s /bin/bash inventree
|
||||
```
|
||||
|
||||
## Python Setup
|
||||
InvenTree source code, log files, etc will be located under the `/home/inventree/` directory.
|
||||
|
||||
To install InvenTree you will need python3 (>3.6) installed, as well as PIP (the Python package manager), and the Invoke tool.
|
||||
|
||||
!!! warning "Python Version"
|
||||
InvenTree requrires Python 3.6 (or newer). If your system has an older version of Python installed, you will need to follow the update instructions for your OS.
|
||||
|
||||
### Python Virtual Environment
|
||||
|
||||
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](https://docs.python.org/3/tutorial/venv.html).
|
||||
|
||||
To configure Inventree inside a virtual environment, ``cd`` into the inventree base directory and run the following commands:
|
||||
Switch to the `inventree` user so commands are performed in the correct context:
|
||||
|
||||
```
|
||||
sudo apt-get install python3-venv
|
||||
python3 -m venv inventree-env
|
||||
source inventree-env/bin/activate
|
||||
sudo su inventree
|
||||
```
|
||||
|
||||
!!! note "Virtual Environment on Windows"
|
||||
To create and activate a virtual environment in Windows, run the following commands:
|
||||
```
|
||||
py -m venv inventree-env
|
||||
.\inventree-env\Scripts\activate
|
||||
```
|
||||
|
||||
Refer to the [official Python documentation](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/) to setup a virtual environment on Windows.
|
||||
|
||||
This will place the current shell session inside a virtual environment - the terminal should display the ``(inventree-env)`` prefix.
|
||||
|
||||
!!! warning "Activate virtual environment"
|
||||
Remember to activate the virtual environment when starting each shell session, before running Inventree commands. This will ensure that the correct environment is being used.
|
||||
|
||||
### Invoke
|
||||
|
||||
InvenTree setup is performed using the [invoke](https://www.pyinvoke.org/) Python build tool. Various useful scripts are defined in the `tasks.py` file.
|
||||
|
||||
Install invoke as follows:
|
||||
### Create Required Directories
|
||||
|
||||
```
|
||||
pip3 install invoke
|
||||
cd /home/inventree
|
||||
mkdir log static data
|
||||
```
|
||||
|
||||
!!! warning "Invoke Version"
|
||||
InvenTree requires invoke version 1.4.0 or newer. Some platforms may be shipped with older versions of invoke!
|
||||
This step creates directories required by InvenTree:
|
||||
|
||||
To display a list of the available configuration scripts, run the following command:
|
||||
* `/home/inventree/log` - Store InvenTree log files
|
||||
* `/home/inventree/static` - Location of static files for the web server
|
||||
* `/home/inventre/data` - Location of stored media and backup files
|
||||
|
||||
### Download Source Code
|
||||
|
||||
Download InvenTree source code, into the `./src` directory:
|
||||
|
||||
```
|
||||
inv --list
|
||||
git clone https://github.com/inventree/inventree src
|
||||
```
|
||||
|
||||
## Download Source Code
|
||||
### Create Virtual Environment
|
||||
|
||||
Download the InvenTree source code to a local directory. It is recommended to perform this step using git, as this allows the InvenTree installation to be easily updated to the latest version.
|
||||
Create a python virtual environment for installing required Python packages and binaries:
|
||||
|
||||
```
|
||||
git clone https://github.com/inventree/inventree/
|
||||
python3 -m venv env
|
||||
source ./env/bin/activate
|
||||
```
|
||||
|
||||
Alternatively, the source can be downloaded as a [.zip archive](https://github.com/inventree/InvenTree/archive/master.zip).
|
||||
!!! info "(env) prefix"
|
||||
The shell prompt should now display the `(env)` prefix, showing that you are operating within the context of the python virtual environment
|
||||
|
||||
Once the source is downloaded, cd into the source directory:
|
||||
### Install InvenTree Packages
|
||||
|
||||
The Python packages required by the InvenTree server must be installed into the virtual environment.
|
||||
|
||||
```
|
||||
cd /path/to/inventree/
|
||||
```
|
||||
|
||||
*(substitute /path/to/inventree/ with the directory where you have downloaded the source code)*.
|
||||
|
||||
## Installation
|
||||
|
||||
Now that the source code is downloaded (and optionally you have configured a Python virtual environment), the Python packages required to run InvenTree can be installed. InvenTree is a Python/Django application and relies on the pip package manager. All packages required to develop and test InvenTree are installed via pip. Package requirements can be found in ``requirements.txt``.
|
||||
|
||||
|
||||
To setup the InvenTree environment, run the following commands (from the InvenTree source directory):
|
||||
|
||||
```
|
||||
inv install
|
||||
pip install -U -r src/requirements.txt
|
||||
```
|
||||
|
||||
This installs all required Python packages using pip package manager. It also creates a (default) database configuration file which needs to be edited to meet user needs before proceeding (see next step below).
|
||||
|
||||
Additionally, this step creates a *SECRET_KEY* file which is used for the django authentication framework.
|
||||
## Create Database
|
||||
|
||||
!!! warning "Keep it secret, keep it safe"
|
||||
The SECRET_KEY file should never be shared or made public.
|
||||
As part of the initial setup, an empty database needs to be created. Follow the instructions below particular to your database engine of choice:
|
||||
|
||||
### Database Configuration
|
||||
### SQLite
|
||||
|
||||
Once the required packages are installed, the database configuration must be adjusted to suit your particular needs. InvenTree provides a simple default setup which should work *out of the box* for testing and debug purposes.
|
||||
SQLite uses a simple portable database file which is easy to use for debug and testing purposes.
|
||||
|
||||
As part of the previous *install* step, a configuration file (**config.yaml**) is created. The configuration file provides administrators control over various setup options without digging into the Django *settings.py* script. The default setup uses a local sqlite database with *DEBUG* mode enabled.
|
||||
Install required packages as follows:
|
||||
|
||||
For further information on installation configuration, refer to the [Configuration](../config) section.
|
||||
!!! info "Sudo Actions"
|
||||
Perform sudo actions from a separate shell, as 'inventree' user does not have sudo access
|
||||
|
||||
```
|
||||
sudo apt-get install sqlite3
|
||||
```
|
||||
|
||||
A `.sqlite3` database file will be automatically created, at the location specified in the configuration options. No further steps necessary.
|
||||
|
||||
### PostgreSQL
|
||||
|
||||
#### Install PostgreSQL
|
||||
|
||||
Install required system packages:
|
||||
|
||||
!!! info "Sudo Actions"
|
||||
Perform sudo actions from a separate shell, as 'inventree' user does not have sudo access
|
||||
|
||||
```
|
||||
sudo apt-get install postgresql postgresql-contrib libpq-dev
|
||||
```
|
||||
|
||||
And start the postgresql service:
|
||||
|
||||
```
|
||||
sudo service postgresql start
|
||||
```
|
||||
|
||||
#### Create Database and User
|
||||
|
||||
We need to create new database, and a postgres user to allow database access.
|
||||
|
||||
```
|
||||
sudo -u postgres psql
|
||||
```
|
||||
|
||||
You should now be in an interactive database shell:
|
||||
|
||||
```
|
||||
create database inventree;
|
||||
create user myuser with encrypted password 'mypass';
|
||||
grant all privileges on database inventree to myuser;
|
||||
```
|
||||
|
||||
!!! info "Username / Password"
|
||||
You should change the username and password from the values specified above. This username and password will also be for the InvenTree database connection configuration.
|
||||
|
||||
#### Install Python Bindings
|
||||
|
||||
The PostgreSQL python binding must also be installed (into your virtual environment):
|
||||
|
||||
```
|
||||
pip3 install psycopg2 pgcli
|
||||
```
|
||||
|
||||
### MySQL / MariaDB
|
||||
|
||||
#### Install Backend
|
||||
|
||||
To run InvenTree with the MySQL or MariaDB backends, a number of extra packages need to be installed:
|
||||
|
||||
!!! info "Sudo Actions"
|
||||
Perform sudo actions from a separate shell, as 'inventree' user does not have sudo access
|
||||
|
||||
```
|
||||
sudo apt-get install mysql-server libmysqlclient-dev
|
||||
```
|
||||
|
||||
#### Install Python Bindings
|
||||
|
||||
Install the python bindings for MySQL (into the python virtual environment).
|
||||
|
||||
```
|
||||
pip3 install mysqlclient mariadb
|
||||
```
|
||||
|
||||
#### Create Database
|
||||
|
||||
Assuming the MySQL server is installed and running, login to the MySQL server as follows:
|
||||
|
||||
```
|
||||
sudo mysql -u root
|
||||
```
|
||||
|
||||
Create a new database as follows:
|
||||
|
||||
```
|
||||
mysql> CREATE DATABASE inventree;
|
||||
```
|
||||
|
||||
Create a new user with complete access to the database:
|
||||
|
||||
```
|
||||
mysql> CREATE USER 'myuser'@'%' IDENTIFIED WITH mysql_native_password BY 'mypass';
|
||||
mysql> GRANT ALL ON blog_data.* TO 'djangouser'@'%';
|
||||
mysql> FLUSH PRIVILEGES;
|
||||
```
|
||||
|
||||
Exit the mysql shell:
|
||||
|
||||
```
|
||||
mysql> EXIT;
|
||||
```
|
||||
|
||||
!!! info "Username / Password"
|
||||
You should change the username and password from the values specified above. This username and password will also be for the InvenTree database connection configuration.
|
||||
|
||||
## Configure InvenTree Options
|
||||
|
||||
Once the required software packages are installed and the database has been created, the InvenTree server options must be configured.
|
||||
|
||||
InvenTree configuration can be performed using environment variables, or the `config.yaml` file (or a combination of both).
|
||||
|
||||
Edit the configuration file at `/home/inventree/src/InvenTree/config.yaml`.
|
||||
|
||||
!!! info "Config Guidelines"
|
||||
Refer to the [configuration guidelines](../config) for full details.
|
||||
|
||||
!!! warning "Configure Database"
|
||||
Ensure database settings are correctly configured in `config.yaml` before proceeding to the next step!
|
||||
Ensure database settings are correctly configured before proceeding to the next step! In particular, check that the database connection settings match the database you have created in the previous step.
|
||||
|
||||
### Initialize Database
|
||||
## Initialize Database
|
||||
|
||||
Once install settings are correctly configured (in *config.yaml*) run the initial setup script:
|
||||
The database has been configured above, but is currently empty.
|
||||
|
||||
### Schema Migrations
|
||||
|
||||
Run the following command to initialize the database with the required tables.
|
||||
|
||||
```
|
||||
inv migrate
|
||||
cd /home/inventree/src
|
||||
invoke update
|
||||
```
|
||||
|
||||
This performs the initial database migrations, creating the required tables, etc.
|
||||
|
||||
The database should now be installed!
|
||||
|
||||
### Create Admin Account
|
||||
|
||||
Create an initial superuser (administrator) account for the InvenTree instance:
|
||||
Create a superuser (admin) account for the InvenTree installation:
|
||||
|
||||
```
|
||||
inv superuser
|
||||
invoke superuser
|
||||
```
|
||||
|
||||
!!! warning "Solving Cairo Errors"
|
||||
In the case the above command returns errors with the `Cairo` package, it implies that dependencies for the `weasyprint` package are not installed on the system. To solve them, run through the [weasyprint installation steps](https://weasyprint.readthedocs.io/en/stable/install.html) then re-run `inv install` and `inv superuser`.
|
||||
!!! success "Ready to Serve"
|
||||
The InvenTree database is now fully configured, and ready to go.
|
||||
|
||||
### Run Development Server
|
||||
## Start Server
|
||||
|
||||
### Development Server
|
||||
|
||||
The InvenTree database is now setup and ready to run. A simple development server can be launched from the command line.
|
||||
|
||||
To launch the development server, run the following commands:
|
||||
The InvenTree development server is useful for testing and configuration - and it may be wholly sufficient for a small-scale installation.
|
||||
|
||||
```
|
||||
inv server
|
||||
```
|
||||
Refer to the [development server instructions](../development) for further information.
|
||||
|
||||
For more server options, run:
|
||||
### Production Server
|
||||
|
||||
```
|
||||
inv server -h
|
||||
```
|
||||
In a production environment, a more robust server setup is required.
|
||||
|
||||
This will launch the InvenTree web interface at `http://127.0.0.1:8000`. For other options refer to the [django docs](https://docs.djangoproject.com/en/2.2/ref/django-admin/)
|
||||
|
||||
### Run Production Server
|
||||
|
||||
For a production install, refer to [deployment instructions](../deploy).
|
||||
Refer to the [production server instructions](../production) for further information.
|
||||
|
130
docs/start/intro.md
Normal file
@ -0,0 +1,130 @@
|
||||
---
|
||||
title: Setup Introduction
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
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:
|
||||
|
||||
### Database
|
||||
|
||||
A persistent database is required to store stock information. The database backend must be installed and configured separately to the InvenTree application.
|
||||
|
||||
InvenTree can be used with any of the following database backends:
|
||||
|
||||
* SQLite
|
||||
* PostgreSQL
|
||||
* MariaDB
|
||||
* MySQL
|
||||
|
||||
Database selection should be determined by your particular installation requirements.
|
||||
|
||||
### Media Files
|
||||
|
||||
Uploaded media files (images, attachments, reports, etc) are stored to a persistent storage volume.
|
||||
|
||||
### Web Server
|
||||
|
||||
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](https://gunicorn.org/). For more information see the [deployment documentation](../deploy).
|
||||
|
||||
### Background Tasks
|
||||
|
||||
A separate application handles management of [background tasks](../../admin/tasks), separate to user-facing web requests.
|
||||
|
||||
## OS Requirements
|
||||
|
||||
The InvenTree documentation assumes that the operating system is a debian based Linux OS. Some installation steps may differ for different systems.
|
||||
|
||||
!!! warning "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](https://docs.microsoft.com/en-us/windows/wsl/install-win10#manual-installation-steps), and then follow installation procedure from within the WSL environment.
|
||||
|
||||
## Python Requirements
|
||||
|
||||
InvenTree runs on [Python](https://python.org).
|
||||
|
||||
!!! warning "Python Version"
|
||||
InvenTree requrires Python 3.6 (or newer). If your system has an older version of Python installed, you will need to follow the update instructions for your OS.
|
||||
|
||||
### Invoke
|
||||
|
||||
InvenTree makes use of the [invoke](https://www.pyinvoke.org/) python toolkit for performing various administrative actions.
|
||||
|
||||
!!! warning "Invoke Version"
|
||||
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:
|
||||
|
||||
```
|
||||
inv --list
|
||||
```
|
||||
|
||||
### Virtual Environment
|
||||
|
||||
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](https://docs.python.org/3/tutorial/venv.html).
|
||||
|
||||
!!! info "Virtual Environment"
|
||||
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:
|
||||
|
||||
```
|
||||
source env/bin/activate
|
||||
```
|
||||
|
||||
!!! info "Activate Virtual Environment"
|
||||
if
|
||||
```
|
||||
source env/bin/activate
|
||||
```
|
||||
is not working try
|
||||
```
|
||||
. env/bin/activate
|
||||
```
|
||||
|
||||
This will place the current shell session inside a virtual environment - the terminal should display the ``(env)`` prefix.
|
||||
|
||||
|
||||
## Downloading Source Code
|
||||
|
||||
InvenTree source code is distributed on [GitHub](https://github.com/inventree/inventree/), 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](https://github.com/inventree/InvenTree/archive/master.zip).
|
||||
|
||||
!!! info "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.
|
||||
|
||||
## Installation Guides
|
||||
|
||||
There are multiple ways to get an InvenTree server up and running, of various complexity (and robustness)!
|
||||
|
||||
### Docker
|
||||
|
||||
The recommended method of installing InvenTree is to use [docker](https://www.docker.com). 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 [docker setup instructions](../docker) for further information.
|
||||
|
||||
### Bare Metal
|
||||
|
||||
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 [InvenTree installation instructions](../install) for more details.
|
94
docs/start/production.md
Normal file
@ -0,0 +1,94 @@
|
||||
---
|
||||
title: Production Server
|
||||
---
|
||||
|
||||
## Production Server
|
||||
|
||||
!!! warning "Installation"
|
||||
Before continuing, ensure that the [installation steps](../install) have been completed.
|
||||
|
||||
The following instructions provide a reasonably performant server, using [gunicorn](https://gunicorn.org/) as a webserver, and [supervisor](http://supervisord.org/) as a process manager.
|
||||
|
||||
For alternative deployment methods, django apps provide multiple deployment methods - see the [Django documentation](https://docs.djangoproject.com/en/2.2/howto/deployment/).
|
||||
|
||||
There are also numerous online tutorials describing how to deploy a Django application either locally or on an online platform.
|
||||
|
||||
### Gunicorn
|
||||
|
||||
The InvenTree web server is hosted using [Gunicorn](https://gunicorn.org/). Gunicorn is a Python WSGI server which provides a multi-worker server which is well suited to handling multiple simultaneous requests. Gunicorn is a solid choice for a production server which is easy to configure and performs well in a multi-user environment.
|
||||
|
||||
### Supervisor
|
||||
|
||||
[Supervisor](http://supervisord.org/) is a process control system which monitors and controls multiple background processes. It is used in the InvenTree production setup to ensure that the server and background worker processes are always running.
|
||||
|
||||
## Gunicorn
|
||||
|
||||
Gunicorn should have already been installed (within the python virtual environment) as part of the installation procedure.
|
||||
|
||||
A simple gunicorn configuration file is also provided. This configuration file can be edited if different server settings are required
|
||||
|
||||
### Test Gunicorn Server
|
||||
|
||||
First, let's confirm that the gunicorn server is operational.
|
||||
|
||||
!!! info "Virtual Environment"
|
||||
Don't forget to activate the python virtual environment
|
||||
|
||||
```
|
||||
cd /home/InvenTree
|
||||
source ./env/bin/activate
|
||||
|
||||
cd src/InvenTree
|
||||
/home/inventree/env/bin/gunicorn -c gunicorn.conf.py InvenTree.wsgi -b 127.0.0.1:8000
|
||||
```
|
||||
|
||||
This should start the gunicorn server as a foreground process.
|
||||
|
||||
Check that you can access the InvenTree web server [in your browser](http://127.0.0.1:8000):
|
||||
|
||||
### Stop Gunicorn Server
|
||||
|
||||
Once the gunicorn server is operational, kill the server with <kbd>Ctrl</kbd>+<kbd>c</kbd>
|
||||
|
||||
## Supervisor
|
||||
|
||||
We will use [supervisor](http://supervisord.org/) as a process monitor, to ensure the web server and background worker processes are automatically started, and restarted if something goes wrong.
|
||||
|
||||
### Install Supervisor
|
||||
|
||||
!!! info "Sudo Actions"
|
||||
Perform sudo actions from a separate shell, as 'inventree' user does not have sudo access
|
||||
|
||||
```
|
||||
sudo apt-get install supervisor
|
||||
```
|
||||
|
||||
### Configure Supervisor
|
||||
|
||||
!!! warning "Configuration Override"
|
||||
If you already have supervisor installed on your system, you will not want to override your existing configuration file.
|
||||
In this case, edit the existing configuration file at `/etc/supervisord.conf` to integrate the InvenTree processes
|
||||
|
||||
Copy the supervisor configuration file:
|
||||
|
||||
```
|
||||
sudo cp /home/inventree/src/deploy/supervisord.conf /etc/supervisord.conf
|
||||
```
|
||||
|
||||
### Start Supervisor Daemon
|
||||
|
||||
```
|
||||
sudo supervisord
|
||||
```
|
||||
|
||||
### Check Server
|
||||
|
||||
Check that the InvenTree [web server is running](http://localhost:8000).
|
||||
|
||||
### View Process Status
|
||||
|
||||
The process status can be viewed [in your web browser](http://localhost:9001).
|
||||
|
||||
## Production Ready
|
||||
|
||||
The InvenTree server (and background task manager) should now be running!
|
@ -13,6 +13,9 @@ Administrators wishing to update InvenTree to the latest version should follow t
|
||||
|
||||
Ensure the InvenTree server is stopped. This will depend on the particulars of your database installation.
|
||||
|
||||
!!! info "Stop Server"
|
||||
The method by which the InvenTree server is stopped depends on your particular installation!
|
||||
|
||||
### Update Source Code
|
||||
|
||||
Update the InvenTree source code to the latest version (or a particular commit if required).
|
||||
|
@ -46,7 +46,7 @@ Setting the owner of stock location will automatically:
|
||||
* Set the owner of all children locations to the same owner.
|
||||
* Set the owner of all stock items at this location to the same owner.
|
||||
|
||||
!!! note
|
||||
!!! info
|
||||
If the owner of a children location or a stock item is a subset of the specified owner (eg. a user linked to the specified group), the owner won't be updated.
|
||||
|
||||
### Set Stock Item Owner
|
||||
|
@ -67,4 +67,16 @@ p {
|
||||
/* Remove top margin for first h2 header */
|
||||
.md-typeset h2:first-of-type {
|
||||
margin-top: 0em;
|
||||
}
|
||||
|
||||
.red {
|
||||
color: #C55;
|
||||
}
|
||||
|
||||
.green {
|
||||
color: #5C5;
|
||||
}
|
||||
|
||||
.blue {
|
||||
color: #55C;
|
||||
}
|
15
mkdocs.yml
@ -38,12 +38,17 @@ extra_javascript:
|
||||
nav:
|
||||
- InvenTree:
|
||||
- About InvenTree: index.md
|
||||
- Features: features.md
|
||||
- What's New: releases/new.md
|
||||
- FAQ: faq.md
|
||||
- Contribute: contribute.md
|
||||
- Getting Started:
|
||||
- Installation: start/install.md
|
||||
- Installation:
|
||||
- Introduction: start/intro.md
|
||||
- Configuration: start/config.md
|
||||
- Deploying: start/deploy.md
|
||||
- Docker Installation: start/docker.md
|
||||
- Manual Installation: start/install.md
|
||||
- Development Server: start/development.md
|
||||
- Production Server: start/production.md
|
||||
- Updating: start/update.md
|
||||
- Migrating: start/migrate.md
|
||||
- Parts:
|
||||
@ -85,6 +90,7 @@ nav:
|
||||
- Import Data: admin/import.md
|
||||
- Python Shell: admin/shell.md
|
||||
- Error Logs: admin/logs.md
|
||||
- Background Tasks: admin/tasks.md
|
||||
- Extend:
|
||||
- API: extend/api.md
|
||||
- Python Interface: extend/python.md
|
||||
@ -95,7 +101,8 @@ nav:
|
||||
- InvenTree App: app/app.md
|
||||
- Barcodes: app/barcode.md
|
||||
- Parts: app/part.md
|
||||
- Stock: app/barcode.md
|
||||
- Stock: app/stock.md
|
||||
- Settings: app/settings.md
|
||||
- Privacy: app/privacy.md
|
||||
- Translation: app/translation.md
|
||||
- Suggestions: app/issues.md
|
||||
|