2
0
mirror of https://github.com/inventree/inventree-docs.git synced 2025-05-12 12:23:05 +00:00

Merge branch 'master' of github.com:inventree/inventree-docs

This commit is contained in:
Oliver Walters 2021-04-19 09:52:59 +10:00
commit 53a4139e97
16 changed files with 369 additions and 80 deletions

View File

@ -63,6 +63,31 @@ currencies:
- NZD - NZD
- USD - USD
# Email backend configuration
# Ref: https://docs.djangoproject.com/en/dev/topics/email/
# Available options:
# host: Email server host address
# port: Email port
# username: Account username
# password: Account password
# prefix: Email subject prefix
# tls: Enable TLS support
# ssl: Enable SSL support
# Alternatively, these options can all be set using environment variables,
# with the INVENTREE_EMAIL_ prefix:
# e.g. INVENTREE_EMAIL_HOST / INVENTREE_EMAIL_PORT / INVENTREE_EMAIL_USERNAME
# Refer to the InvenTree documentation for more information
email:
# backend: 'django.core.mail.backends.smtp.EmailBackend'
host: ''
port: 25
username: ''
password: ''
tls: False
ssl: False
# Set debug to False to run in production mode # Set debug to False to run in production mode
# Use the environment variable INVENTREE_DEBUG # Use the environment variable INVENTREE_DEBUG
debug: True debug: True
@ -95,9 +120,9 @@ cors:
# - https://sub.example.com # - https://sub.example.com
# MEDIA_ROOT is the local filesystem location for storing uploaded files # MEDIA_ROOT is the local filesystem location for storing uploaded files
# By default, it is stored under /home/inventree # By default, it is stored under /home/inventree/data/media
# Use environment variable INVENTREE_MEDIA_ROOT # Use environment variable INVENTREE_MEDIA_ROOT
media_root: '/home/inventree/media' media_root: '/home/inventree/data/media'
# STATIC_ROOT is the local filesystem location for storing static files # STATIC_ROOT is the local filesystem location for storing static files
# By default, it is stored under /home/inventree # By default, it is stored under /home/inventree
@ -116,7 +141,7 @@ static_root: '/home/inventree/static'
# Set the backup_dir parameter to store backup files in a specific location # Set the backup_dir parameter to store backup files in a specific location
# If unspecified, the local user's temp directory will be used # If unspecified, the local user's temp directory will be used
# Use environment variable INVENTREE_BACKUP_DIR # Use environment variable INVENTREE_BACKUP_DIR
backup_dir: '/home/inventree/backup/' backup_dir: '/home/inventree/data/backup/'
# Permit custom authentication backends # Permit custom authentication backends
#authentication_backends: #authentication_backends:

View File

@ -2,9 +2,9 @@ version: "3.8"
# Docker compose recipe for InvenTree # Docker compose recipe for InvenTree
# - Runs PostgreSQL as the database backend # - Runs PostgreSQL as the database backend
# - Runs Gunicorn as the web server # - Runs Gunicorn as the InvenTree web server
# - Runs the InvenTree background worker process
# - Runs nginx as a reverse proxy # - Runs nginx as a reverse proxy
# - Runs the background worker process
# --------------------------------- # ---------------------------------
# IMPORTANT - READ BEFORE STARTING! # IMPORTANT - READ BEFORE STARTING!
@ -12,6 +12,7 @@ version: "3.8"
# Before running, ensure that you change the "/path/to/data" directory, # Before running, ensure that you change the "/path/to/data" directory,
# specified in the "volumes" section at the end of this file. # specified in the "volumes" section at the end of this file.
# This path determines where the InvenTree data will be stored! # This path determines where the InvenTree data will be stored!
#
services: services:
# Database service # Database service
@ -19,12 +20,13 @@ services:
# Note: this can be changed to a different backend, # Note: this can be changed to a different backend,
# just make sure that you change the INVENTREE_DB_xxx vars below # just make sure that you change the INVENTREE_DB_xxx vars below
db: db:
container_name: db
image: postgres image: postgres
container_name: inventree_db
ports: ports:
- 5432/tcp - 5432/tcp
environment: environment:
- PGDATA=/var/lib/postgresql/data/pgdb - PGDATA=/var/lib/postgresql/data/pgdb
# The pguser and pgpassword values must be the same in the other containers
- POSTGRES_USER=pguser - POSTGRES_USER=pguser
- POSTGRES_PASSWORD=pgpassword - POSTGRES_PASSWORD=pgpassword
volumes: volumes:
@ -34,62 +36,62 @@ services:
# InvenTree web server services # InvenTree web server services
# Uses gunicorn as the web server # Uses gunicorn as the web server
inventree: inventree:
container_name: inventree
image: inventree/inventree:latest image: inventree/inventree:latest
container_name: inventree_server
expose: expose:
- 8080 - 8000
depends_on: depends_on:
- db - db
volumes: volumes:
- data:/home/inventree/data - data:/home/inventree/data
- static:/home/inventree/static - static:/home/inventree/static
environment: environment:
- INVENTREE_DB_ENGINE=postgresql # Default environment variables are configured to match the 'db' container
- INVENTREE_DB_NAME=inventree # Database permissions
- INVENTREE_DB_USER=pguser
- INVENTREE_DB_PASSWORD=pgpassword
restart: unless-stopped
# Background worker process handles long-running or periodic tasks
worker:
container_name: worker
image: inventree/inventree:latest
entrypoint: ./start_worker.sh
depends_on:
- db
- inventree
volumes:
- data:/home/inventree/data
- static:/home/inventree/static
environment:
# Default environment variables are configured to match the 'inventree' container
- INVENTREE_DB_USER=pguser - INVENTREE_DB_USER=pguser
- INVENTREE_DB_PASSWORD=pgpassword - INVENTREE_DB_PASSWORD=pgpassword
- INVENTREE_DB_PORT=5432
- INVENTREE_DB_HOST=db
restart: unless-stopped restart: unless-stopped
# nginx acts as a reverse proxy # nginx acts as a reverse proxy
# static files are served by nginx # static files are served by nginx
# web requests are redirected to gunicorn # web requests are redirected to gunicorn
nginx: # NOTE: You will need to provide a working nginx.conf file!
image: inventree/nginx:latest proxy:
container_name: inventree_proxy container_name: proxy
image: nginx
depends_on: depends_on:
- inventree - inventree
ports: ports:
# Change "1337" to the port where you want InvenTree web server to be available # Change "1337" to the port that you want InvenTree web server to be available on
- 1337:80 - 1337:80
volumes: volumes:
- static:/home/inventree/static # Provide nginx.conf file to the container
# Refer to the provided example file as a starting point
# background worker process handles long-running or periodic tasks - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
worker: # Static data volume is mounted to /var/www/static
entrypoint: ./start_worker.sh - static:/var/www/static:ro
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 restart: unless-stopped
volumes: volumes:
# Static files, shared between containers # NOTE: Change /path/to/data to a directory on your local machine
static: # Persistent data, stored external to the container(s)
# Persistent data, stored externally
data: data:
driver: local driver: local
driver_opts: driver_opts:
@ -98,3 +100,5 @@ volumes:
# This directory specified where InvenTree data are stored "outside" the docker containers # 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 # Change this path to a local system path where you want InvenTree data stored
device: /path/to/data device: /path/to/data
# Static files, shared between containers
static:

32
_includes/nginx.conf Normal file
View File

@ -0,0 +1,32 @@
server {
# Listen for connection on (internal) port 80
listen 80;
location / {
# Change 'inventree' to the name of the inventree server container,
# and '8000' to the INVENTREE_WEB_PORT (if not default)
proxy_pass http://inventree:8000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
client_max_body_size 100M;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_request_buffering off;
}
# Redirect any requests for static files
location /static/ {
alias /var/www/static/;
autoindex on;
}
}

13
docs/admin/email.md Normal file
View File

@ -0,0 +1,13 @@
---
title: Email Configured
---
## Email Settings
InvenTree can be configured to send emails to users, for various purposes.
To enable this, email configuration settings must be supplied to the InvenTree [configuration options](../../start/config#email-settings).
!!! info "Password Reset"
The *Password Reset* functionality requires the email backend to be correctly configured.

View File

@ -35,19 +35,31 @@ After the manufacturer details are loaded, click on the <span class='fas fa-tras
## Manufacturer Parts ## Manufacturer Parts
Manufacturer parts are connected to the manufacturer they belong to. Most importantly, they are **linked** to a supplier part. In other words, manufacturer parts do **not** exist without a corresponding supplier part and they are the actual "items" sold by a supplier. Manufacturer parts are linked to a manufacturer and defined as manufacturable items.
!!! warning !!! warning
**Viewing**, **adding**, **editing** and **deleting** manufacturer parts require the corresponding [Purchase Orders user permissions](../../admin/permissions) **Viewing**, **adding**, **editing** and **deleting** manufacturer parts require the corresponding [Purchase Orders user permissions](../../admin/permissions)
### Add Manufacturer Part ### Add Manufacturer Part
Adding a manufacturer part is the same process as [adding a supplier part](../supplier#add-supplier-part). To create a manufacturer part, you have the following options:
* either navigate to a Part detail page then click on the "Manufacturers" tab
* or navigate to a Manufacturer detail page then click on the "Manufactured Parts" tab.
Whichever you pick, click on the "<span class='fas fa-plus-circle'></span> New Manufacturer Part" button to load the "Create New Manufacturer Part" form. Fill out the form with the manufacturer part information then click on the "Submit" button.
### Edit Manufacturer Part ### Edit Manufacturer Part
Editing a manufacturer part is the same process as [editing a supplier part](../supplier#edit-supplier-part). To edit a manufacturer part, first access the manufacturer part detail page with one of the following options:
* either navigate to a Part detail page, click on the "Manufacturers" tab then click on the "MPN" link
* or navigate to a Manufacturer detail page, click on the "Manufactured Parts" tab then click on the "MPN" link.
After the manufacturer part details are loaded, click on the <span class='fas fa-edit'></span> icon next to the manufacturer part image. Edit the manufacturer part information then click on the "Submit" button.
### Delete Manufacturer Part ### Delete Manufacturer Part
Deleting a manufacturer part is the same process as [deleting a supplier part](../supplier#delete-supplier-part). To delete a manufacturer part, first access the manufacturer part detail page like in the [Edit Manufacturer Part](#edit-manufacturer-part) section.
After the manufacturer part details are loaded, click on the <span class='fas fa-trash-alt'></span> icon next to the manufacturer part image. Review the the information for the manufacturer part to be deleted, confirm the deletion using the checkbox then click on the "Submit" button.

View File

@ -43,8 +43,10 @@ Supplier parts are linked to a supplier and defined as purchasable items.
### Add Supplier Part ### Add Supplier Part
To create a supplier part, you have the following options: To create a supplier part, you have the following options:
* either navigate to a Part detail page then click on the "Suppliers" tab
* or navigate to a Supplier detail page then click on the "Parts" tab. 1. navigate to a Part detail page then click on the "Suppliers" tab
0. navigate to a Supplier detail page then click on the "Supplied Parts" tab
0. navigate to a Manufacturer detail page then click on the "Supplied Parts" tab.
Whichever you pick, click on the "<span class='fas fa-plus-circle'></span> New Supplier Part" button to load the "Create new Supplier Part" form. Fill out the form with the supplier part information then click on the "Submit" button. Whichever you pick, click on the "<span class='fas fa-plus-circle'></span> New Supplier Part" button to load the "Create new Supplier Part" form. Fill out the form with the supplier part information then click on the "Submit" button.
@ -52,8 +54,9 @@ Whichever you pick, click on the "<span class='fas fa-plus-circle'></span> New S
To edit a supplier part, first access the supplier part detail page with one of the following options: To edit a supplier part, first access the supplier part detail page with one of the following options:
* either navigate to a Part detail page, click on the "Suppliers" tab then click on the corresponding "Supplier Part" row value 1. navigate to a Part detail page, click on the "Suppliers" tab then click on the corresponding "Supplier Part" link
* or navigate to a Supplier detail page, click on the "Parts" tab then click on the corresponding "Supplier Part" row value. 0. navigate to a Supplier detail page, click on the "Supplied Parts" tab then click on the corresponding "Supplier Part" link
0. navigate to a Manufacturer detail page, click on the "Supplied Parts" tab then click on the corresponding "Supplier Part" link.
After the supplier part details are loaded, click on the <span class='fas fa-edit'></span> icon next to the supplier part image. Edit the supplier part information then click on the "Submit" button. After the supplier part details are loaded, click on the <span class='fas fa-edit'></span> icon next to the supplier part image. Edit the supplier part information then click on the "Submit" button.

View File

@ -29,4 +29,8 @@ Refer to the [installation guide](./start/intro) for instructions on installing
## Get the App ## 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! 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!
## Source Code
InvenTree source code is available on [GitHub](https://github.com/inventree/inventree)

View File

@ -26,7 +26,7 @@ The other major feature that `0.2.0` introduces is an officical docker installat
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. 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). To simplify this, an official InvenTree docker image is available on [DockerHub](https://hub.docker.com/r/inventree/inventree).
!!! success "Docker Is the Way" !!! success "Docker Is the Way"
Docker is now the recommended way to install InvenTree Docker is now the recommended way to install InvenTree

View File

@ -8,8 +8,35 @@ title: Release 0.2.1
## New Features ## New Features
### Email Support
[#1304](https://github.com/inventree/InvenTree/pull/1304) adds support for email support. Initially, this is used for sending users emails to perform a password reset
!!! warning "Configuration Required"
Refer to the [email configuration
options](../../start/config/#email-settings).
### Manufacturer Parts
[#1417](https://github.com/inventree/InvenTree/pull/1417) adds a new model and
database table to InvenTree: `ManufacturerPart`. In older versions, manufacturer
data was stored inside a `SupplierPart`. With this new model, the data is now
stored independently. Users can use either manufacturer or supplier parts as
sourcing information for a part. Soon, InvenTree will allow the use of
manufacturer data directly in purchase orders.
Details on how to create and manage manufacturer parts were added
[here](../../companies/manufacturer/#add-manufacturer-part).
### URL-style QR Code for StockItem
[#1462](https://github.com/inventree/InvenTree/pull/1417) adds the ability to
create a QR code containing the URL of a StockItem, which can be opened directly
on a portable device using the camera or a QR code scanner. More details [here](../../report/labels#url-style-qr-code).
## Major Bug Fixes ## Major Bug Fixes
| PR | Description | | PR | Description |
| --- | --- | | --- | --- |
| [#1453](https://github.com/inventree/InvenTree/pull/1453) | Adds *detail* API endpoint for the `PartParameter` model, which was previously missing. | | [#1453](https://github.com/inventree/InvenTree/pull/1453) | Adds *detail* API endpoint for the `PartParameter` model, which was previously missing. |
| [#1478](https://github.com/inventree/InvenTree/pull/1478) | Fixes a bug which exposed database username and password in the log files |

18
docs/releases/0.2.2.md Normal file
View File

@ -0,0 +1,18 @@
---
title: Release 0.2.2
---
## Release 0.2.2
[Release 0.2.2](https://github.com/inventree/InvenTree/releases/tag/0.2.2) provides a number of major new features and improvements, as well as some crucial bug fixes:
## New Features
### Custom Site Title
[#1481](https://github.com/inventree/InvenTree/pull/1481) adds the ability to customize the site title (which was previously hard-coded to "InvenTree")
## Major Bug Fixes
| PR | Description |
| --- | --- |

View File

@ -8,7 +8,8 @@ For information on the latest and greatest InvenTree features, refer to the rele
| Release | Date | | Release | Date |
| ------- | ---- | | ------- | ---- |
| [0.2.1](../0.2.1) | *In Development* | | [0.2.2](../0.2.2) | *In Development* |
| [0.2.1](../0.2.1) | April 2021 |
| [0.2.0](../0.2.0) | April 2021 | | [0.2.0](../0.2.0) | April 2021 |
| [0.1.8](../0.1.8) | April 2021 | | [0.1.8](../0.1.8) | April 2021 |
| [0.1.7](../0.1.7) | March 2021 | | [0.1.7](../0.1.7) | March 2021 |

View File

@ -219,11 +219,28 @@ The following variables are made available to the StockItem label template:
| part | The Part object which is referenced by the StockItem object | | part | The Part object which is referenced by the StockItem object |
| name | The `name` field of the associated Part object | | name | The `name` field of the associated Part object |
| ipn | The `IPN` field of the associated Part object | | ipn | The `IPN` field of the associated Part object |
| revision | The `revision` field of the associated Part object |
| quantity | The `quantity` field of the StockItem object | | quantity | The `quantity` field of the StockItem object |
| serial | The `serial` field of the StockItem object | | serial | The `serial` field of the StockItem object |
| uid | The `uid` field of the StockItem object | | uid | The `uid` field of the StockItem object |
| tests | Dict object of TestResult data associated with the StockItem | | tests | Dict object of TestResult data associated with the StockItem |
### URL-style QR code
Stock Item labels support [QR code](../barcodes#qr-code) containing the stock item URL, which can be
scanned and opened directly
on a portable device using the camera or a QR code scanner. To generate a URL-style QR code for stock item in the [label HTML template](../labels#label-templates), add the
following HTML tag:
``` html
{% raw %}
<img class='custom_qr_class' src='{% qrcode qr_url %}'>
{% endraw %}
```
Make sure to customize the `custom_qr_class` CSS class to define the position of the QR code
on the label.
## Stock Location Labels ## Stock Location Labels
Stock Location label templates are used to generate labels for individual Stock Locations. Stock Location label templates are used to generate labels for individual Stock Locations.

View File

@ -42,10 +42,10 @@ In addition to specifying InvenTree options via the `config.yaml` file, these op
The following basic options are available: The following basic options are available:
| Environment Variable | Settings File | Description | | Environment Variable | Settings File | Description | Default |
| --- | --- | --- | | --- | --- | --- | --- |
| INVENTREE_DEBUG | debug | Enable debug mode | | INVENTREE_DEBUG | debug | Enable debug mode | True |
| INVENTREE_LOG_LEVEL | log_level | Set level of logging to terminal | | INVENTREE_LOG_LEVEL | log_level | Set level of logging to terminal | WARNING |
## Secret Key ## Secret Key
@ -73,15 +73,30 @@ Database options are specified under the *database* heading in the configuration
The following database options can be configured: The following database options can be configured:
| Environment Variable | Settings File | Description | | Environment Variable | Settings File | Description | Default |
| --- | --- | --- | | --- | --- | --- | --- |
| INVENTREE_DB_ENGINE | database.ENGINE | Database backend | | INVENTREE_DB_ENGINE | database.ENGINE | Database backend | *Not set* |
| INVENTREE_DB_NAME | database.NAME | Database name | | INVENTREE_DB_NAME | database.NAME | Database name | *Not set* |
| INVENTREE_DB_USER | database.USER | Database username (if required) | | INVENTREE_DB_USER | database.USER | Database username (if required) | *Not set* |
| INVENTREE_DB_PASSWORD | database.PASSWORD | Database password (if required) | | INVENTREE_DB_PASSWORD | database.PASSWORD | Database password (if required) | *Not set* |
| INVENTREE_DB_HOST | database.HOST | Database host address (if required) | | INVENTREE_DB_HOST | database.HOST | Database host address (if required) | *Not set* |
| INVENTREE_DB_PORT | database.PORT | Database host port (if required) | | INVENTREE_DB_PORT | database.PORT | Database host port (if required) | *Not set* |
## Email Settings
To enable [email functionality](../../admin/email), email settings must be configured here, either via environment variables or within the configuration file.
The following email settings are available:
| Environment Variable | Settings File | Description | Default |
| --- | --- | --- | --- |
| INVENTREE_EMAIL_BACKEND | email.backend | Email backend module | django.core.mail.backends.smtp.EmailBackend |
| INVENTREE_EMAIL_HOST | email.host | Email server host | *Not set* |
| INVENTREE_EMAIL_PORT | email.port | Email server port | 25 |
| INVENTREE_EMAIL_USERNAME | email.username | Email account username | *Not set* |
| INVENTREE_EMAIL_PASSWORD | email.password | Email account password | *Not set* |
| INVENTREE_EMAIL_TLS | email.tls | Enable TLS support | False |
| INVENTREE_EMAIL_SSL | email.ssl | Enable SSL support | False |
## Allowed Hosts / CORS ## Allowed Hosts / CORS

View File

@ -4,33 +4,114 @@ title: Docker Setup
## Docker Image ## 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 most convenient method of installing and running InvenTree is to use the official [docker image](https://hub.docker.com/r/inventree/inventree), available from docker-hub.
The InvenTree docker image contains all the required system packages, python modules, and configuration files for running InvenTree. The InvenTree docker image contains all the required system packages, python modules, and configuration files for running a containerised InvenTree web server.
### Environment Variables
InvenTree run-time configuration options described in the [configuration documentation](../config) can be passed to the InvenTree container as environment variables.
Additionally, the following environment variables are used to control functionality specific to the docker container:
| Variable | Description | Default |
| --- | --- | --- |
| INVENTREE_WEB_PORT | Internal container port on which the InvenTree web server is hosted | 8000 |
The following environment variables for InvenTree server configuration are specified as part of the docker image, and can be overridden if required:
| Variable | Value |
| --- | --- |
| INVENTREE_LOG_LEVEL | INFO |
| INVENTREE_CONFIG_FILE | /home/inventree/data/config.yaml |
| INVENTREE_SECRET_KEY_FILE | /home/inventree/data/secret_key.txt |
| INVENTREE_DB_ENGINE | postgresql |
| INVENTREE_DB_NAME | inventree |
| INVENTREE_DB_HOST | db |
| INVENTREE_DB_PORT | 5432 |
The following environment variables are explicitly **not configured** and must be passed to the container instance:
- INVENTREE_DB_USER
- INVENTREE_DB_PASSWORD
### Data Directory
Persistent data (e.g. uploaded media files) should be stored outside the container instance.
InvenTree data are stored inside the container at `/home/inventree/data`.
This directory should be mounted as a volume which points to a directory on your local machine.
### Static Directory
Static files are stored internal to the container instance, at the location `/home/inventree/static`
### Configuration File
As discussed in the [configuration documentation](../config), InvenTree run-time settings can be provided in a configuration file.
By default, the docker container expects this configuration file in the location `/home/inventree/data/config.yaml`. If this file does not exist, it will be automatically created from a default template file.
As this config file is inside the "data" directory (which should be mounted as a volume) it can be edited outside the context of the container, if necessary.
### Secret Key
InvenTree uses a secret key to provide cryptographic signing for the application.
As specified in the [configuration documentation](../config/#secret-key) this can be passed to the InvenTree application directly as an environment variable, or provided via a file.
By default, the InvenTree container expects the `INVENTREE_SECRET_KEY_FILE` to exist at `/home/inventree/data/secret_key.txt`. If this file does not exist, it will be created and a new key will be randomly generated.
!!! warning "Same Key"
Each InvenTree container instance must use the same secret key value, otherwise unexpected behavior will occur.
## Docker Compose ## Docker Compose
It is strongly recommended that you use a [docker-compose](https://docs.docker.com/compose/) script to manage your InvenTree docker image.
An example docker compose script is provided below, which provides a robust "out of the box" setup for running InvenTree. An example docker compose script is provided below, which provides a robust "out of the box" setup for running InvenTree.
Firstly, here is the complete `docker-compose.yml` file which can be used "as is" or as a starting point for a custom setup:
``` yaml
{% include 'docker-compose.yml' %}
```
### Containers ### Containers
The following containers are created: The following containers are created:
#### PostgreSQL Database #### PostgreSQL Database
A postgresql database container which creates a postgres user:password combination (which can be changed) A postgresql database container which creates a postgres user:password combination (which can be changed). This uses the official [PostgreSQL image](https://hub.docker.com/_/postgres).
*__Note__: An empty database must be manually created as part of the setup (below)*.
#### Web Server #### Web Server
InvenTree web server running on a Gunicorn backend Runs an InvenTree web server instance, powered by a Gunicorn web server. In the default configuration, the web server listens on port `8000`.
#### Background Worker #### Background Worker
InvenTree background worker process manager Runs the InvenTree background worker process. This spins up a second instance of the *inventree* container, with a different entrypoint command.
#### Nginx #### Nginx
Nginx working as a reverse proxy, separating requests for static files and directing everything else to Gunicorn Nginx working as a reverse proxy, separating requests for static files and directing everything else to Gunicorn.
This container uses the official [nginx image](https://hub.docker.com/_/nginx).
An nginx configuration file must be provided to the image. Use the example configuration below as a starting point:
```
{% include 'nginx.conf' %}
```
*__Note__: You must save this conf file in the same directory as your docker-compose.yml file*
!!! info "Proxy Pass"
If you change the name (or port) of the InvenTree web server container, you will need to also adjust the `proxy_pass` setting in the nginx.conf file!
### Volumes ### Volumes
@ -47,19 +128,18 @@ InvenTree stores data which is meant to be persistent (e.g. uploaded media files
Static files are shared between multiple containers (but not exposed to the local file system). Static files are shared between multiple containers (but not exposed to the local file system).
### Docker Compose File ## Production Setup
Use the following docker-compose file as a starting point: With the docker-compose recipe above, follow the instructions below to initialize a complete production server for InvenTree.
``` yaml ### Required Files
{% include 'docker-compose.yml' %}
```
## Initial Setup Process The following files are required on your local machine (use the examples above, or edit as required):
Follow the instructions below to initialize a complete docker deployment for InvenTree. - docker-compose.yml
- nginx.conf
!!! info "Directory" !!! info "Command Directory"
It is assumed that all commands will be run from the directory where `docker-compose.yml` is located. It is assumed that all commands will be run from the directory where `docker-compose.yml` is located.
### Configure Compose File ### Configure Compose File
@ -68,7 +148,10 @@ 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. 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 !!! info "Database Credentials"
You may also wish to change the default postgresql username and password!
### Launch Database Container
Before we can create the database, we need to launch the database server container: Before we can create the database, we need to launch the database server container:
@ -80,6 +163,8 @@ This starts the database container.
### Create Database ### Create Database
As this is the first time we are interacting with the docker containers, the InvenTree database has not yet been created.
Run the following command to open a shell session for the database: Run the following command to open a shell session for the database:
``` ```
@ -91,7 +176,7 @@ docker-compose run inventree pgcli -h db -p 5432 -u pguser
You will be prompted to enter the database user password (default="pgpassword", unless altered in the compose file). 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: Once logged in, run the following command in the database shell:
``` ```
create database inventree; create database inventree;
@ -101,7 +186,7 @@ Then exit the shell with <kbd>Ctrl</kbd>+<kbd>d</kbd>
### Perform Database Migrations ### Perform Database Migrations
The database has been created, but it is empty! We need to perform the initial database migrations. The database has now been created, but it is empty! We need to perform the initial database migrations:
``` ```
docker-compose run inventree invoke migrate docker-compose run inventree invoke migrate
@ -159,3 +244,35 @@ This command launches the remaining container processes:
!!! success "Up and Running!" !!! success "Up and Running!"
You should now be able to view the InvenTree login screen at [http://localhost:1337](http://localhost:1337) You should now be able to view the InvenTree login screen at [http://localhost:1337](http://localhost:1337)
## Updating InvenTree
To update your InvenTree installation to the latest version, follow these steps:
### Stop Containers
Stop all running containers as below:
```
docker-compose down
```
### Update Images
Pull down the latest version of the InvenTree docker image
```
docker-compose pull
```
This ensures that the InvenTree containers will be running the latest version of the InvenTree source code.
### Start Containers
Now restart the containers.
As part of the server initialization process, data migrations and static file updates will be performed automatically.
```
docker-compose up -d
```

View File

@ -49,7 +49,7 @@ The InvenTree documentation assumes that the operating system is a debian based
InvenTree runs on [Python](https://python.org). InvenTree runs on [Python](https://python.org).
!!! warning "Python Version" !!! 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. InvenTree requrires Python 3.7 (or newer). If your system has an older version of Python installed, you will need to follow the update instructions for your OS.
### Invoke ### Invoke

View File

@ -90,6 +90,7 @@ nav:
- Import Data: admin/import.md - Import Data: admin/import.md
- Python Shell: admin/shell.md - Python Shell: admin/shell.md
- Error Logs: admin/logs.md - Error Logs: admin/logs.md
- Email: admin/email.md
- Background Tasks: admin/tasks.md - Background Tasks: admin/tasks.md
- Extend: - Extend:
- API: extend/api.md - API: extend/api.md