mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge branch 'inventree:master' into matmair/issue2694
This commit is contained in:
commit
b118890676
@ -282,6 +282,7 @@ INSTALLED_APPS = [
|
||||
|
||||
MIDDLEWARE = CONFIG.get('middleware', [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'x_forwarded_for.middleware.XForwardedForMiddleware',
|
||||
'user_sessions.middleware.SessionMiddleware', # db user sessions
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
@ -545,11 +546,19 @@ if "sqlite" in db_engine:
|
||||
# Provide OPTIONS dict back to the database configuration dict
|
||||
db_config['OPTIONS'] = db_options
|
||||
|
||||
# Set testing options for the database
|
||||
db_config['TEST'] = {
|
||||
'CHARSET': 'utf8',
|
||||
}
|
||||
|
||||
# Set collation option for mysql test database
|
||||
if 'mysql' in db_engine:
|
||||
db_config['TEST']['COLLATION'] = 'utf8_general_ci'
|
||||
|
||||
DATABASES = {
|
||||
'default': db_config
|
||||
}
|
||||
|
||||
|
||||
_cache_config = CONFIG.get("cache", {})
|
||||
_cache_host = _cache_config.get("host", os.getenv("INVENTREE_CACHE_HOST"))
|
||||
_cache_port = _cache_config.get(
|
||||
@ -662,6 +671,7 @@ LANGUAGE_CODE = CONFIG.get('language', 'en-us')
|
||||
|
||||
# If a new language translation is supported, it must be added here
|
||||
LANGUAGES = [
|
||||
('cs', _('Czech')),
|
||||
('de', _('German')),
|
||||
('el', _('Greek')),
|
||||
('en', _('English')),
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*! jQuery UI - v1.12.1 - 2021-07-18
|
||||
/*! jQuery UI - v1.13.0 - 2021-10-07
|
||||
* http://jqueryui.com
|
||||
* Includes: widget.js, position.js, disable-selection.js, keycode.js, unique-id.js, widgets/resizable.js, widgets/autocomplete.js, widgets/menu.js, widgets/mouse.js
|
||||
* Copyright jQuery Foundation and other contributors; Licensed MIT */
|
||||
@ -17,11 +17,11 @@
|
||||
|
||||
$.ui = $.ui || {};
|
||||
|
||||
var version = $.ui.version = "1.12.1";
|
||||
var version = $.ui.version = "1.13.1";
|
||||
|
||||
|
||||
/*!
|
||||
* jQuery UI Widget 1.12.1
|
||||
* jQuery UI Widget 1.13.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
@ -744,7 +744,7 @@ var widget = $.widget;
|
||||
|
||||
|
||||
/*!
|
||||
* jQuery UI Position 1.12.1
|
||||
* jQuery UI Position 1.13.1
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
@ -1232,7 +1232,7 @@ var position = $.ui.position;
|
||||
|
||||
|
||||
/*!
|
||||
* jQuery UI Disable Selection 1.12.1
|
||||
* jQuery UI Disable Selection 1.13.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
@ -1268,7 +1268,7 @@ var disableSelection = $.fn.extend( {
|
||||
|
||||
|
||||
/*!
|
||||
* jQuery UI Keycode 1.12.1
|
||||
* jQuery UI Keycode 1.13.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
@ -1303,7 +1303,7 @@ var keycode = $.ui.keyCode = {
|
||||
|
||||
|
||||
/*!
|
||||
* jQuery UI Unique ID 1.12.1
|
||||
* jQuery UI Unique ID 1.13.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
@ -1347,7 +1347,7 @@ var uniqueId = $.fn.extend( {
|
||||
var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
|
||||
|
||||
/*!
|
||||
* jQuery UI Mouse 1.12.1
|
||||
* jQuery UI Mouse 1.13.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
@ -1368,7 +1368,7 @@ $( document ).on( "mouseup", function() {
|
||||
} );
|
||||
|
||||
var widgetsMouse = $.widget( "ui.mouse", {
|
||||
version: "1.12.1",
|
||||
version: "1.13.0",
|
||||
options: {
|
||||
cancel: "input, textarea, button, select, option",
|
||||
distance: 1,
|
||||
@ -1592,7 +1592,7 @@ var plugin = $.ui.plugin = {
|
||||
|
||||
|
||||
/*!
|
||||
* jQuery UI Resizable 1.12.1
|
||||
* jQuery UI Resizable 1.13.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
@ -1612,7 +1612,7 @@ var plugin = $.ui.plugin = {
|
||||
|
||||
|
||||
$.widget( "ui.resizable", $.ui.mouse, {
|
||||
version: "1.12.1",
|
||||
version: "1.13.0",
|
||||
widgetEventPrefix: "resize",
|
||||
options: {
|
||||
alsoResize: false,
|
||||
@ -2806,7 +2806,7 @@ var safeActiveElement = $.ui.safeActiveElement = function( document ) {
|
||||
|
||||
|
||||
/*!
|
||||
* jQuery UI Menu 1.12.1
|
||||
* jQuery UI Menu 1.13.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
@ -2826,7 +2826,7 @@ var safeActiveElement = $.ui.safeActiveElement = function( document ) {
|
||||
|
||||
|
||||
var widgetsMenu = $.widget( "ui.menu", {
|
||||
version: "1.12.1",
|
||||
version: "1.13.0",
|
||||
defaultElement: "<ul>",
|
||||
delay: 300,
|
||||
options: {
|
||||
@ -3461,7 +3461,7 @@ var widgetsMenu = $.widget( "ui.menu", {
|
||||
|
||||
|
||||
/*!
|
||||
* jQuery UI Autocomplete 1.12.1
|
||||
* jQuery UI Autocomplete 1.13.0
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
@ -3481,7 +3481,7 @@ var widgetsMenu = $.widget( "ui.menu", {
|
||||
|
||||
|
||||
$.widget( "ui.autocomplete", {
|
||||
version: "1.12.1",
|
||||
version: "1.13.0",
|
||||
defaultElement: "<input>",
|
||||
options: {
|
||||
appendTo: null,
|
||||
|
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
||||
"name": "jquery-ui",
|
||||
"title": "jQuery UI",
|
||||
"description": "A curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library.",
|
||||
"version": "1.12.1",
|
||||
"version": "1.13.0",
|
||||
"homepage": "http://jqueryui.com",
|
||||
"author": {
|
||||
"name": "jQuery Foundation and other contributors",
|
||||
|
BIN
InvenTree/locale/cs/LC_MESSAGES/django.mo
Normal file
BIN
InvenTree/locale/cs/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
10114
InvenTree/locale/cs/LC_MESSAGES/django.po
Normal file
10114
InvenTree/locale/cs/LC_MESSAGES/django.po
Normal file
File diff suppressed because it is too large
Load Diff
@ -777,7 +777,8 @@ class Part(MPTTModel):
|
||||
# User can decide whether duplicate IPN (Internal Part Number) values are allowed
|
||||
allow_duplicate_ipn = common.models.InvenTreeSetting.get_setting('PART_ALLOW_DUPLICATE_IPN')
|
||||
|
||||
if self.IPN is not None and not allow_duplicate_ipn:
|
||||
# Raise an error if an IPN is set, and it is a duplicate
|
||||
if self.IPN and not allow_duplicate_ipn:
|
||||
parts = Part.objects.filter(IPN__iexact=self.IPN)
|
||||
parts = parts.exclude(pk=self.pk)
|
||||
|
||||
@ -798,6 +799,10 @@ class Part(MPTTModel):
|
||||
|
||||
super().clean()
|
||||
|
||||
# Strip IPN field
|
||||
if type(self.IPN) is str:
|
||||
self.IPN = self.IPN.strip()
|
||||
|
||||
if self.trackable:
|
||||
for part in self.get_used_in().all():
|
||||
|
||||
|
@ -349,6 +349,26 @@ class PartSettingsTest(TestCase):
|
||||
part = Part(name='Hello', description='A thing', IPN='IPN123', revision='C')
|
||||
part.full_clean()
|
||||
|
||||
# Any duplicate IPN should raise an error
|
||||
Part.objects.create(name='xyz', revision='1', description='A part', IPN='UNIQUE')
|
||||
|
||||
# Case insensitive, so variations on spelling should throw an error
|
||||
for ipn in ['UNiquE', 'uniQuE', 'unique']:
|
||||
with self.assertRaises(ValidationError):
|
||||
Part.objects.create(name='xyz', revision='2', description='A part', IPN=ipn)
|
||||
|
||||
with self.assertRaises(ValidationError):
|
||||
Part.objects.create(name='zyx', description='A part', IPN='UNIQUE')
|
||||
|
||||
# However, *blank* / empty IPN values should be allowed, even if duplicates are not
|
||||
# Note that leading / trailling whitespace characters are trimmed, too
|
||||
Part.objects.create(name='abc', revision='1', description='A part', IPN=None)
|
||||
Part.objects.create(name='abc', revision='2', description='A part', IPN='')
|
||||
Part.objects.create(name='abc', revision='3', description='A part', IPN=None)
|
||||
Part.objects.create(name='abc', revision='4', description='A part', IPN=' ')
|
||||
Part.objects.create(name='abc', revision='5', description='A part', IPN=' ')
|
||||
Part.objects.create(name='abc', revision='6', description='A part', IPN=' ')
|
||||
|
||||
|
||||
class PartSubscriptionTests(TestCase):
|
||||
|
||||
|
@ -94,6 +94,14 @@ class IntegrationPluginBase(MixinBase, plugin_base.InvenTreePluginBase):
|
||||
"""
|
||||
return getattr(self, 'is_package', False)
|
||||
|
||||
@property
|
||||
def is_sample(self):
|
||||
"""
|
||||
Is this plugin part of the samples?
|
||||
"""
|
||||
path = str(self.package_path)
|
||||
return path.startswith('plugin/samples/')
|
||||
|
||||
# region properties
|
||||
@property
|
||||
def slug(self):
|
||||
|
@ -453,10 +453,12 @@ class StockItem(MPTTModel):
|
||||
|
||||
super().clean()
|
||||
|
||||
if self.serial is not None and type(self.serial) is str:
|
||||
# Strip serial number field
|
||||
if type(self.serial) is str:
|
||||
self.serial = self.serial.strip()
|
||||
|
||||
if self.batch is not None and type(self.batch) is str:
|
||||
# Strip batch code field
|
||||
if type(self.batch) is str:
|
||||
self.batch = self.batch.strip()
|
||||
|
||||
try:
|
||||
|
@ -77,6 +77,12 @@
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if plugin.is_sample %}
|
||||
<a class='sidebar-selector' id='select-plugin-{{plugin_key}}' data-bs-parent="#sidebar">
|
||||
<span class='badge bg-info rounded-pill'>{% trans "code sample" %}</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if plugin.website %}
|
||||
<a href="{{ plugin.website }}"><span class="fas fa-globe"></span></a>
|
||||
{% endif %}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# InvenTree environment variables for a development setup
|
||||
|
||||
# Set DEBUG to False for a production environment!
|
||||
# Set DEBUG to True for a development setup
|
||||
INVENTREE_DEBUG=True
|
||||
INVENTREE_DEBUG_LEVEL=INFO
|
||||
|
||||
@ -15,3 +15,5 @@ INVENTREE_DB_PASSWORD=pgpassword
|
||||
|
||||
# Enable plugins?
|
||||
INVENTREE_PLUGINS_ENABLED=True
|
||||
|
||||
COMPOSE_PROJECT_NAME=inventree-development
|
@ -137,7 +137,6 @@ ENV INVENTREE_CONFIG_FILE="${INVENTREE_DEV_DIR}/config.yaml"
|
||||
ENV INVENTREE_SECRET_KEY_FILE="${INVENTREE_DEV_DIR}/secret_key.txt"
|
||||
ENV INVENTREE_PLUGIN_FILE="${INVENTREE_DEV_DIR}/plugins.txt"
|
||||
|
||||
|
||||
WORKDIR ${INVENTREE_HOME}
|
||||
|
||||
# Entrypoint ensures that we are running in the python virtual environment
|
||||
|
@ -1,106 +0,0 @@
|
||||
version: "3.8"
|
||||
|
||||
# Docker compose recipe for InvenTree development server
|
||||
# - Runs PostgreSQL as the database backend
|
||||
# - Uses built-in django webserver
|
||||
# - Runs the InvenTree background worker process
|
||||
# - Serves media and static content directly from Django webserver
|
||||
|
||||
# IMPORANT NOTE:
|
||||
# The InvenTree docker image does not clone source code from git.
|
||||
# Instead, you must specify *where* the source code is located,
|
||||
# (on your local machine).
|
||||
# The django server will auto-detect any code changes and reload the server.
|
||||
|
||||
services:
|
||||
|
||||
# Database service
|
||||
# Use PostgreSQL as the database backend
|
||||
# Note: This can be changed to a different backend if required
|
||||
inventree-dev-db:
|
||||
container_name: inventree-dev-db
|
||||
image: postgres:13
|
||||
ports:
|
||||
- 5432/tcp
|
||||
environment:
|
||||
- PGDATA=/var/lib/postgresql/data/dev/pgdb
|
||||
# The pguser and pgpassword values must be the same in the other containers
|
||||
# Ensure that these are correctly configured in your dev-config.env file
|
||||
- POSTGRES_USER=pguser
|
||||
- POSTGRES_PASSWORD=pgpassword
|
||||
volumes:
|
||||
# Map 'data' volume such that postgres database is stored externally
|
||||
- src:/var/lib/postgresql/data
|
||||
restart: unless-stopped
|
||||
|
||||
# InvenTree web server services
|
||||
# Uses gunicorn as the web server
|
||||
inventree-dev-server:
|
||||
container_name: inventree-dev-server
|
||||
depends_on:
|
||||
- inventree-dev-db
|
||||
build:
|
||||
context: .
|
||||
target: dev
|
||||
ports:
|
||||
# Expose web server on port 8000
|
||||
- 8000:8000
|
||||
# Note: If using the inventree-dev-proxy container (see below),
|
||||
# comment out the "ports" directive (above) and uncomment the "expose" directive
|
||||
#expose:
|
||||
# - 8000
|
||||
volumes:
|
||||
# Ensure you specify the location of the 'src' directory at the end of this file
|
||||
- src:/home/inventree
|
||||
env_file:
|
||||
# Environment variables required for the dev server are configured in dev-config.env
|
||||
- dev-config.env
|
||||
restart: unless-stopped
|
||||
|
||||
# Background worker process handles long-running or periodic tasks
|
||||
inventree-dev-worker:
|
||||
container_name: inventree-dev-worker
|
||||
build:
|
||||
context: .
|
||||
target: dev
|
||||
command: invoke worker
|
||||
depends_on:
|
||||
- inventree-dev-server
|
||||
volumes:
|
||||
# Ensure you specify the location of the 'src' directory at the end of this file
|
||||
- src:/home/inventree
|
||||
env_file:
|
||||
# Environment variables required for the dev server are configured in dev-config.env
|
||||
- dev-config.env
|
||||
restart: unless-stopped
|
||||
|
||||
### Optional: Serve static and media files using nginx
|
||||
### Uncomment the following lines to enable nginx proxy for testing
|
||||
### Note: If enabling the proxy, change "ports" to "expose" for the inventree-dev-server container (above)
|
||||
#inventree-dev-proxy:
|
||||
# container_name: inventree-dev-proxy
|
||||
# image: nginx:stable
|
||||
# depends_on:
|
||||
# - inventree-dev-server
|
||||
# ports:
|
||||
# # Change "8000" to the port that you want InvenTree web server to be available on
|
||||
# - 8000:80
|
||||
# volumes:
|
||||
# # Provide ./nginx.conf file to the container
|
||||
# # Refer to the provided example file as a starting point
|
||||
# - ./nginx.dev.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
# # nginx proxy needs access to static and media files
|
||||
# - src:/var/www
|
||||
# restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
# NOTE: Change "../" to a directory on your local machine, where the InvenTree source code is located
|
||||
# Persistent data, stored external to the container(s)
|
||||
src:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: none
|
||||
o: bind
|
||||
# This directory specified where InvenTree source code is stored "outside" the docker containers
|
||||
# By default, this directory is one level above the "docker" directory
|
||||
device: ../
|
@ -21,32 +21,34 @@ services:
|
||||
build:
|
||||
context: .
|
||||
target: dev
|
||||
# Cache the built image to be used by the inventree-dev-worker process
|
||||
image: inventree-dev-image
|
||||
ports:
|
||||
# Expose web server on port 8000
|
||||
- 8000:8000
|
||||
volumes:
|
||||
# Ensure you specify the location of the 'src' directory at the end of this file
|
||||
- src:/home/inventree
|
||||
env_file:
|
||||
# Environment variables required for the dev server are configured in dev-config.env
|
||||
- sqlite-config.env
|
||||
environment:
|
||||
- INVENTREE_DEBUG=True
|
||||
- INVENTREE_DB_ENGINE=sqlite
|
||||
- INVENTREE_DB_NAME=/home/inventree/db.sqlite3
|
||||
restart: unless-stopped
|
||||
|
||||
# Background worker process handles long-running or periodic tasks
|
||||
inventree-dev-worker:
|
||||
container_name: inventree-dev-worker
|
||||
build:
|
||||
context: .
|
||||
target: dev
|
||||
image: inventree-dev-image
|
||||
command: invoke worker
|
||||
depends_on:
|
||||
- inventree-dev-server
|
||||
volumes:
|
||||
# Ensure you specify the location of the 'src' directory at the end of this file
|
||||
- src:/home/inventree
|
||||
env_file:
|
||||
# Environment variables required for the dev server are configured in dev-config.env
|
||||
- sqlite-config.env
|
||||
environment:
|
||||
- INVENTREE_DEBUG=True
|
||||
- INVENTREE_DB_ENGINE=sqlite
|
||||
- INVENTREE_DB_NAME=/home/inventree/db.sqlite3
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
@ -59,4 +61,4 @@ volumes:
|
||||
o: bind
|
||||
# This directory specified where InvenTree source code is stored "outside" the docker containers
|
||||
# By default, this directory is one level above the "docker" directory
|
||||
device: ../
|
||||
device: ${INVENTREE_EXT_VOLUME:-../}
|
||||
|
@ -1,119 +1,104 @@
|
||||
version: "3.8"
|
||||
|
||||
# Docker compose recipe for InvenTree
|
||||
# Docker compose recipe for InvenTree development server
|
||||
# - Runs PostgreSQL as the database backend
|
||||
# - Runs Gunicorn as the InvenTree web server
|
||||
# - Uses built-in django webserver
|
||||
# - Runs the InvenTree background worker process
|
||||
# - Runs nginx as a reverse proxy
|
||||
# - Serves media and static content directly from Django webserver
|
||||
|
||||
# ---------------------------------
|
||||
# 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!
|
||||
#
|
||||
#
|
||||
# InvenTree Image Versions
|
||||
# ------------------------
|
||||
# By default, this docker-compose script targets the STABLE version of InvenTree,
|
||||
# image: inventree/inventree:stable
|
||||
#
|
||||
# To run the LATEST (development) version of InvenTree, change the target image to:
|
||||
# image: inventree/inventree:latest
|
||||
#
|
||||
# Alternatively, you could target a specific tagged release version with (for example):
|
||||
# image: inventree/inventree:0.5.3
|
||||
#
|
||||
# NOTE: If you change the target image, ensure it is the same for the following containers:
|
||||
# - inventree-server
|
||||
# - inventree-worker
|
||||
# IMPORANT NOTE:
|
||||
# The InvenTree development image does not clone source code from git.
|
||||
# Instead, it runs from source code on your local machine.
|
||||
# The django server will auto-detect any code changes and reload the server.
|
||||
|
||||
# If you have cloned the InvenTree git repo, and not made any changes to this file,
|
||||
# then the default setup in this file should work straight out of the box, without modification
|
||||
|
||||
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
|
||||
inventree-db:
|
||||
container_name: inventree-db
|
||||
# Note: This can be changed to a different backend if required
|
||||
inventree-dev-db:
|
||||
container_name: inventree-dev-db
|
||||
image: postgres:13
|
||||
ports:
|
||||
- 5432/tcp
|
||||
- ${INVENTREE_DB_PORT:-5432}/tcp
|
||||
environment:
|
||||
- PGDATA=/var/lib/postgresql/data/pgdb
|
||||
# The pguser and pgpassword values must be the same in the other containers
|
||||
# Ensure that these are correctly configured in your prod-config.env file
|
||||
- POSTGRES_USER=pguser
|
||||
- POSTGRES_PASSWORD=pgpassword
|
||||
- PGDATA=/var/lib/postgresql/data/dev/pgdb
|
||||
- POSTGRES_USER=${INVENTREE_DB_USER:?You must provide the 'INVENTREE_DB_USER' variable in the .env file}
|
||||
- POSTGRES_PASSWORD=${INVENTREE_DB_PASSWORD:?You must provide the 'INVENTREE_DB_PASSWORD' variable in the .env file}
|
||||
- POSTGRES_DB=${INVENTREE_DB_NAME:?You must provide the 'INVENTREE_DB_NAME' variable in the .env file}
|
||||
volumes:
|
||||
# Map 'data' volume such that postgres database is stored externally
|
||||
- data:/var/lib/postgresql/data/
|
||||
# Map 'data' volume such that postgres database is stored externally
|
||||
- inventree_src:/var/lib/postgresql/data
|
||||
restart: unless-stopped
|
||||
|
||||
# InvenTree web server services
|
||||
# Uses gunicorn as the web server
|
||||
inventree-server:
|
||||
container_name: inventree-server
|
||||
# If you wish to specify a particular InvenTree version, do so here
|
||||
image: inventree/inventree:stable
|
||||
expose:
|
||||
- 8000
|
||||
inventree-dev-server:
|
||||
container_name: inventree-dev-server
|
||||
depends_on:
|
||||
- inventree-db
|
||||
- inventree-dev-db
|
||||
build:
|
||||
context: .
|
||||
target: dev
|
||||
# Cache the built image to be used by the inventree-dev-worker process
|
||||
image: inventree-dev-image
|
||||
ports:
|
||||
# Expose web server on port 8000
|
||||
- 8000:8000
|
||||
# Note: If using the inventree-dev-proxy container (see below),
|
||||
# comment out the "ports" directive (above) and uncomment the "expose" directive
|
||||
#expose:
|
||||
# - 8000
|
||||
volumes:
|
||||
# Data volume must map to /home/inventree/data
|
||||
- data:/home/inventree/data
|
||||
# Ensure you specify the location of the 'src' directory at the end of this file
|
||||
- inventree_src:/home/inventree
|
||||
env_file:
|
||||
# Environment variables required for the production server are configured in prod-config.env
|
||||
- prod-config.env
|
||||
- .env
|
||||
restart: unless-stopped
|
||||
|
||||
# Background worker process handles long-running or periodic tasks
|
||||
inventree-worker:
|
||||
container_name: inventree-worker
|
||||
# If you wish to specify a particular InvenTree version, do so here
|
||||
image: inventree/inventree:stable
|
||||
inventree-dev-worker:
|
||||
container_name: inventree-dev-worker
|
||||
image: inventree-dev-image
|
||||
command: invoke worker
|
||||
depends_on:
|
||||
- inventree-db
|
||||
- inventree-server
|
||||
- inventree-dev-server
|
||||
volumes:
|
||||
# Data volume must map to /home/inventree/data
|
||||
- data:/home/inventree/data
|
||||
# Ensure you specify the location of the 'src' directory at the end of this file
|
||||
- inventree_src:/home/inventree
|
||||
env_file:
|
||||
# Environment variables required for the production server are configured in prod-config.env
|
||||
- prod-config.env
|
||||
- .env
|
||||
restart: unless-stopped
|
||||
|
||||
# nginx acts as a reverse proxy
|
||||
# static files are served directly by nginx
|
||||
# media files are served by nginx, although authentication is redirected to inventree-server
|
||||
# web requests are redirected to gunicorn
|
||||
# NOTE: You will need to provide a working nginx.conf file!
|
||||
inventree-proxy:
|
||||
container_name: inventree-proxy
|
||||
image: nginx:stable
|
||||
depends_on:
|
||||
- inventree-server
|
||||
ports:
|
||||
# Change "1337" to the port that you want InvenTree web server to be available on
|
||||
- 1337:80
|
||||
volumes:
|
||||
# Provide ./nginx.conf file to the container
|
||||
# Refer to the provided example file as a starting point
|
||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
# nginx proxy needs access to static and media files
|
||||
- data:/var/www
|
||||
restart: unless-stopped
|
||||
### Optional: Serve static and media files using nginx
|
||||
### Uncomment the following lines to enable nginx proxy for testing
|
||||
### Note: If enabling the proxy, change "ports" to "expose" for the inventree-dev-server container (above)
|
||||
#inventree-dev-proxy:
|
||||
# container_name: inventree-dev-proxy
|
||||
# image: nginx:stable
|
||||
# depends_on:
|
||||
# - inventree-dev-server
|
||||
# ports:
|
||||
# # Change "8000" to the port that you want InvenTree web server to be available on
|
||||
# - 8000:80
|
||||
# volumes:
|
||||
# # Provide ./nginx.dev.conf file to the container
|
||||
# # Refer to the provided example file as a starting point
|
||||
# - ./nginx.dev.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
# # nginx proxy needs access to static and media files
|
||||
# - inventree_src:/var/www
|
||||
# restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
# NOTE: Change /path/to/data to a directory on your local machine
|
||||
# Persistent data, stored external to the container(s)
|
||||
data:
|
||||
inventree_src:
|
||||
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
|
||||
# This directory specified where InvenTree source code is stored "outside" the docker containers
|
||||
# By default, this directory is one level above the "docker" directory
|
||||
device: ${INVENTREE_EXT_VOLUME:-../}
|
||||
|
@ -33,7 +33,7 @@ if [[ -n "$INVENTREE_PY_ENV" ]]; then
|
||||
source ${INVENTREE_PY_ENV}/bin/activate
|
||||
|
||||
# Note: Python packages will have to be installed on first run
|
||||
# e.g docker-compose -f docker-compose.dev.yml run inventree-dev-server invoke install
|
||||
# e.g docker-compose run inventree-dev-server invoke update
|
||||
fi
|
||||
|
||||
cd ${INVENTREE_HOME}
|
||||
|
@ -4,24 +4,30 @@ server {
|
||||
# Listen for connection on (internal) port 80
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
# Change 'inventree-dev-server' to the name of the inventree server container,
|
||||
# and '8000' to the INVENTREE_WEB_PORT (if not default)
|
||||
proxy_pass http://inventree-dev-server:8000;
|
||||
real_ip_header proxy_protocol;
|
||||
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
location / {
|
||||
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-By $server_addr:$server_port;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header CLIENT_IP $remote_addr;
|
||||
|
||||
proxy_pass_request_headers on;
|
||||
|
||||
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;
|
||||
|
||||
# Change 'inventree-dev-server' to the name of the inventree server container,
|
||||
# and '8000' to the INVENTREE_WEB_PORT (if not default)
|
||||
proxy_pass http://inventree-dev-server:8000;
|
||||
|
||||
}
|
||||
|
||||
# Redirect any requests for static files
|
||||
|
@ -1,19 +0,0 @@
|
||||
# InvenTree environment variables for a production setup
|
||||
|
||||
# Note: If your production setup varies from the example, you may want to change these values
|
||||
|
||||
# Ensure debug is false for a production setup
|
||||
INVENTREE_DEBUG=False
|
||||
INVENTREE_LOG_LEVEL=WARNING
|
||||
|
||||
# Database configuration options
|
||||
# Note: The example setup is for a PostgreSQL database (change as required)
|
||||
INVENTREE_DB_ENGINE=postgresql
|
||||
INVENTREE_DB_NAME=inventree
|
||||
INVENTREE_DB_HOST=inventree-db
|
||||
INVENTREE_DB_PORT=5432
|
||||
INVENTREE_DB_USER=pguser
|
||||
INVENTREE_DB_PASSWORD=pgpassword
|
||||
|
||||
# Enable plugins?
|
||||
INVENTREE_PLUGINS_ENABLED=False
|
34
docker/production/.env
Normal file
34
docker/production/.env
Normal file
@ -0,0 +1,34 @@
|
||||
# InvenTree environment variables for a postgresql production setup
|
||||
|
||||
# Location of persistent database data (stored external to the docker containers)
|
||||
# Note: You *must* un-comment this line, and point it to a path on your local machine
|
||||
|
||||
# e.g. Linux
|
||||
#INVENTREE_EXT_VOLUME=/home/me/inventree-data
|
||||
|
||||
# e.g. Windows (docker desktop)
|
||||
#INVENTREE_EXT_VOLUME=c:/Users/me/inventree-data
|
||||
|
||||
# Default web port for the InvenTree server
|
||||
INVENTREE_WEB_PORT=1337
|
||||
|
||||
# Ensure debug is false for a production setup
|
||||
INVENTREE_DEBUG=False
|
||||
INVENTREE_LOG_LEVEL=WARNING
|
||||
|
||||
# Database configuration options
|
||||
# Note: The example setup is for a PostgreSQL database
|
||||
INVENTREE_DB_ENGINE=postgresql
|
||||
INVENTREE_DB_NAME=inventree
|
||||
INVENTREE_DB_HOST=inventree-db
|
||||
INVENTREE_DB_PORT=5432
|
||||
|
||||
# Database credentials - These must be configured before running
|
||||
# Uncomment the lines below, and change from the default values!
|
||||
#INVENTREE_DB_USER=pguser
|
||||
#INVENTREE_DB_PASSWORD=pgpassword
|
||||
|
||||
# Enable plugins?
|
||||
INVENTREE_PLUGINS_ENABLED=False
|
||||
|
||||
COMPOSE_PROJECT_NAME=inventree-production
|
124
docker/production/docker-compose.yml
Normal file
124
docker/production/docker-compose.yml
Normal file
@ -0,0 +1,124 @@
|
||||
version: "3.8"
|
||||
|
||||
# Docker compose recipe for InvenTree production server
|
||||
# - PostgreSQL as the database backend
|
||||
# - gunicorn as the InvenTree web server
|
||||
# - django-q as the InvenTree background worker process
|
||||
# - nginx as a reverse proxy
|
||||
|
||||
# ---------------------
|
||||
# READ BEFORE STARTING!
|
||||
# ---------------------
|
||||
|
||||
# -----------------------------
|
||||
# Setting environment variables
|
||||
# -----------------------------
|
||||
# Shared environment variables should be stored in the .env file
|
||||
# Changes made to this file are reflected across all containers!
|
||||
#
|
||||
# IMPORTANT NOTE:
|
||||
# You should not have to change *anything* within the docker-compose.yml file!
|
||||
# Instead, make any changes in the .env file!
|
||||
# The only *mandatory* change is to set the INVENTREE_EXT_VOLUME variable,
|
||||
# which defines the directory (on your local machine) where persistent data are stored.
|
||||
|
||||
# ------------------------
|
||||
# InvenTree Image Versions
|
||||
# ------------------------
|
||||
# By default, this docker-compose script targets the STABLE version of InvenTree,
|
||||
# image: inventree/inventree:stable
|
||||
#
|
||||
# To run the LATEST (development) version of InvenTree, change the target image to:
|
||||
# image: inventree/inventree:latest
|
||||
#
|
||||
# Alternatively, you could target a specific tagged release version with (for example):
|
||||
# image: inventree/inventree:0.5.3
|
||||
#
|
||||
# NOTE: If you change the target image, ensure it is the same for the following containers:
|
||||
# - inventree-server
|
||||
# - inventree-worker
|
||||
|
||||
services:
|
||||
# Database service
|
||||
# Use PostgreSQL as the database backend
|
||||
inventree-db:
|
||||
container_name: inventree-db
|
||||
image: postgres:13
|
||||
ports:
|
||||
- ${INVENTREE_DB_PORT:-5432}/tcp
|
||||
environment:
|
||||
- PGDATA=/var/lib/postgresql/data/pgdb
|
||||
- POSTGRES_USER=${INVENTREE_DB_USER:?You must provide the 'INVENTREE_DB_USER' variable in the .env file}
|
||||
- POSTGRES_PASSWORD=${INVENTREE_DB_PASSWORD:?You must provide the 'INVENTREE_DB_PASSWORD' variable in the .env file}
|
||||
- POSTGRES_DB=${INVENTREE_DB_NAME:?You must provide the 'INVENTREE_DB_NAME' variable in the .env file}
|
||||
volumes:
|
||||
# Map 'data' volume such that postgres database is stored externally
|
||||
- inventree_data:/var/lib/postgresql/data/
|
||||
restart: unless-stopped
|
||||
|
||||
# InvenTree web server services
|
||||
# Uses gunicorn as the web server
|
||||
inventree-server:
|
||||
container_name: inventree-server
|
||||
# If you wish to specify a particular InvenTree version, do so here
|
||||
image: inventree/inventree:stable
|
||||
expose:
|
||||
- 8000
|
||||
depends_on:
|
||||
- inventree-db
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
# Data volume must map to /home/inventree/data
|
||||
- inventree_data:/home/inventree/data
|
||||
restart: unless-stopped
|
||||
|
||||
# Background worker process handles long-running or periodic tasks
|
||||
inventree-worker:
|
||||
container_name: inventree-worker
|
||||
# If you wish to specify a particular InvenTree version, do so here
|
||||
image: inventree/inventree:stable
|
||||
command: invoke worker
|
||||
depends_on:
|
||||
- inventree-db
|
||||
- inventree-server
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
# Data volume must map to /home/inventree/data
|
||||
- inventree_data:/home/inventree/data
|
||||
restart: unless-stopped
|
||||
|
||||
# nginx acts as a reverse proxy
|
||||
# static files are served directly by nginx
|
||||
# media files are served by nginx, although authentication is redirected to inventree-server
|
||||
# web requests are redirected to gunicorn
|
||||
# NOTE: You will need to provide a working nginx.conf file!
|
||||
inventree-proxy:
|
||||
container_name: inventree-proxy
|
||||
image: nginx:stable
|
||||
depends_on:
|
||||
- inventree-server
|
||||
env_file:
|
||||
- .env
|
||||
ports:
|
||||
# Default web port is 1337 (can be changed in the .env file)
|
||||
- ${INVENTREE_WEB_PORT:-1337}:80
|
||||
volumes:
|
||||
# Provide nginx configuration file to the container
|
||||
# Refer to the provided example file as a starting point
|
||||
- ./nginx.prod.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
# nginx proxy needs access to static and media files
|
||||
- inventree_data:/var/www
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
# NOTE: Change /path/to/data to a directory on your local machine
|
||||
# Persistent data, stored external to the container(s)
|
||||
inventree_data:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: none
|
||||
o: bind
|
||||
# This directory specified where InvenTree data are stored "outside" the docker containers
|
||||
device: ${INVENTREE_EXT_VOLUME:?You must specify the 'INVENTREE_EXT_VOLUME' variable in the .env file!}
|
@ -4,24 +4,29 @@ server {
|
||||
# Listen for connection on (internal) port 80
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
# Change 'inventree-server' to the name of the inventree server container,
|
||||
# and '8000' to the INVENTREE_WEB_PORT (if not default)
|
||||
proxy_pass http://inventree-server:8000;
|
||||
real_ip_header proxy_protocol;
|
||||
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
location / {
|
||||
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-By $server_addr:$server_port;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header CLIENT_IP $remote_addr;
|
||||
|
||||
proxy_pass_request_headers on;
|
||||
|
||||
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;
|
||||
|
||||
# Change 'inventree-server' to the name of the inventree server container,
|
||||
# and '8000' to the INVENTREE_WEB_PORT (if not default)
|
||||
proxy_pass http://inventree-server:8000;
|
||||
}
|
||||
|
||||
# Redirect any requests for static files
|
@ -1,10 +0,0 @@
|
||||
# InvenTree environment variables for a development setup
|
||||
|
||||
# Set DEBUG to False for a production environment!
|
||||
INVENTREE_DEBUG=True
|
||||
INVENTREE_DEBUG_LEVEL=INFO
|
||||
|
||||
# Database configuration options
|
||||
# Note: The example setup is for a PostgreSQL database (change as required)
|
||||
INVENTREE_DB_ENGINE=sqlite
|
||||
INVENTREE_DB_NAME=/home/inventree/dev/inventree_db.sqlite3
|
@ -1,46 +1,47 @@
|
||||
# Please keep this list sorted
|
||||
Django==3.2.12 # Django package
|
||||
bleach==4.1.0 # HTML santization
|
||||
certifi # Certifi is (most likely) installed through one of the requirements above
|
||||
coreapi==2.3.0 # API documentation
|
||||
coverage==5.3 # Unit test coverage
|
||||
coveralls==2.1.2 # Coveralls linking (for Travis)
|
||||
cryptography==3.4.8 # Cryptography support
|
||||
django-admin-shell==0.1.2 # Python shell for the admin interface
|
||||
django-allauth==0.45.0 # SSO for external providers via OpenID
|
||||
django-allauth-2fa==0.8 # MFA / 2FA
|
||||
django-cleanup==5.1.0 # Manage deletion of old / unused uploaded files
|
||||
django-cors-headers==3.2.0 # CORS headers extension for DRF
|
||||
django-crispy-forms==1.11.2 # Form helpers
|
||||
django-debug-toolbar==2.2 # Debug / profiling toolbar
|
||||
django-error-report==0.2.0 # Error report viewer for the admin interface
|
||||
django-filter==2.4.0 # Extended filtering options
|
||||
django-formtools==2.3 # Form wizard tools
|
||||
django-import-export==2.5.0 # Data import / export for admin interface
|
||||
django-maintenance-mode==0.16.1 # Shut down application while reloading etc.
|
||||
django-markdownify==0.8.0 # Markdown rendering
|
||||
django-markdownx==3.0.1 # Markdown form fields
|
||||
django-money==1.1 # Django app for currency management
|
||||
django-mptt==0.11.0 # Modified Preorder Tree Traversal
|
||||
django-redis>=5.0.0
|
||||
django-q==1.3.4 # Background task scheduling
|
||||
django-sql-utils==0.5.0 # Advanced query annotation / aggregation
|
||||
django-stdimage==5.1.1 # Advanced ImageField management
|
||||
django-test-migrations==1.1.0 # Unit testing for database migrations
|
||||
django-user-sessions==1.7.1 # user sessions in DB
|
||||
django-weasyprint==1.0.1 # django weasyprint integration
|
||||
djangorestframework==3.12.4 # DRF framework
|
||||
flake8==3.8.3 # PEP checking
|
||||
gunicorn>=20.1.0 # Gunicorn web server
|
||||
importlib_metadata # Backport for importlib.metadata
|
||||
inventree # Install the latest version of the InvenTree API python library
|
||||
markdown==3.3.4 # Force particular version of markdown
|
||||
pep8-naming==0.11.1 # PEP naming convention extension
|
||||
pillow==9.0.1 # Image manipulation
|
||||
py-moneyed==0.8.0 # Specific version requirement for py-moneyed
|
||||
pygments==2.7.4 # Syntax highlighting
|
||||
python-barcode[images]==0.13.1 # Barcode generator
|
||||
qrcode[pil]==6.1 # QR code generator
|
||||
rapidfuzz==0.7.6 # Fuzzy string matching
|
||||
tablib[xls,xlsx,yaml] # Support for XLS and XLSX formats
|
||||
weasyprint==52.5 # PDF generation library (Note: in the future need to update to 53)
|
||||
Django==3.2.13 # Django package
|
||||
bleach==4.1.0 # HTML santization
|
||||
certifi # Certifi is (most likely) installed through one of the requirements above
|
||||
coreapi==2.3.0 # API documentation
|
||||
coverage==5.3 # Unit test coverage
|
||||
coveralls==2.1.2 # Coveralls linking (for Travis)
|
||||
cryptography==3.4.8 # Cryptography support
|
||||
django-admin-shell==0.1.2 # Python shell for the admin interface
|
||||
django-allauth==0.45.0 # SSO for external providers via OpenID
|
||||
django-allauth-2fa==0.8 # MFA / 2FA
|
||||
django-cleanup==5.1.0 # Manage deletion of old / unused uploaded files
|
||||
django-cors-headers==3.2.0 # CORS headers extension for DRF
|
||||
django-crispy-forms==1.11.2 # Form helpers
|
||||
django-debug-toolbar==3.2.4 # Debug / profiling toolbar
|
||||
django-error-report==0.2.0 # Error report viewer for the admin interface
|
||||
django-filter==2.4.0 # Extended filtering options
|
||||
django-formtools==2.3 # Form wizard tools
|
||||
django-import-export==2.5.0 # Data import / export for admin interface
|
||||
django-maintenance-mode==0.16.1 # Shut down application while reloading etc.
|
||||
django-markdownify==0.8.0 # Markdown rendering
|
||||
django-markdownx==3.0.1 # Markdown form fields
|
||||
django-money==1.1 # Django app for currency management
|
||||
django-mptt==0.11.0 # Modified Preorder Tree Traversal
|
||||
django-redis>=5.0.0 # Redis integration
|
||||
django-q==1.3.4 # Background task scheduling
|
||||
django-sql-utils==0.5.0 # Advanced query annotation / aggregation
|
||||
django-stdimage==5.1.1 # Advanced ImageField management
|
||||
django-test-migrations==1.1.0 # Unit testing for database migrations
|
||||
django-user-sessions==1.7.1 # user sessions in DB
|
||||
django-weasyprint==1.0.1 # django weasyprint integration
|
||||
djangorestframework==3.12.4 # DRF framework
|
||||
django-xforwardedfor-middleware==2.0 # IP forwarding metadata
|
||||
flake8==3.8.3 # PEP checking
|
||||
gunicorn>=20.1.0 # Gunicorn web server
|
||||
importlib_metadata # Backport for importlib.metadata
|
||||
inventree # Install the latest version of the InvenTree API python library
|
||||
markdown==3.3.4 # Force particular version of markdown
|
||||
pep8-naming==0.11.1 # PEP naming convention extension
|
||||
pillow==9.0.1 # Image manipulation
|
||||
py-moneyed==0.8.0 # Specific version requirement for py-moneyed
|
||||
pygments==2.7.4 # Syntax highlighting
|
||||
python-barcode[images]==0.13.1 # Barcode generator
|
||||
qrcode[pil]==6.1 # QR code generator
|
||||
rapidfuzz==0.7.6 # Fuzzy string matching
|
||||
tablib[xls,xlsx,yaml] # Support for XLS and XLSX formats
|
||||
weasyprint==52.5 # PDF generation library (Note: in the future need to update to 53)
|
||||
|
Loading…
Reference in New Issue
Block a user