mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #2850 from SchrodingersGat/docker-refactor
Docker refactor
This commit is contained in:
commit
b3d96801af
@ -1,6 +1,6 @@
|
|||||||
# InvenTree environment variables for a development setup
|
# 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=True
|
||||||
INVENTREE_DEBUG_LEVEL=INFO
|
INVENTREE_DEBUG_LEVEL=INFO
|
||||||
|
|
||||||
@ -15,3 +15,4 @@ INVENTREE_DB_PASSWORD=pgpassword
|
|||||||
|
|
||||||
# Enable plugins?
|
# Enable plugins?
|
||||||
INVENTREE_PLUGINS_ENABLED=True
|
INVENTREE_PLUGINS_ENABLED=True
|
||||||
|
|
@ -110,7 +110,8 @@ RUN pip3 install --user --no-cache-dir --disable-pip-version-check -r ${INVENTRE
|
|||||||
WORKDIR ${INVENTREE_MNG_DIR}
|
WORKDIR ${INVENTREE_MNG_DIR}
|
||||||
|
|
||||||
# Server init entrypoint
|
# Server init entrypoint
|
||||||
ENTRYPOINT ["/bin/bash", "../docker/init.sh"]
|
COPY init.sh ${INVENTREE_HOME}/init.sh
|
||||||
|
ENTRYPOINT ["/bin/bash", "${INVENTREE_HOME}/init.sh"]
|
||||||
|
|
||||||
# Launch the production server
|
# Launch the production server
|
||||||
# TODO: Work out why environment variables cannot be interpolated in this command
|
# TODO: Work out why environment variables cannot be interpolated in this command
|
||||||
@ -137,7 +138,6 @@ ENV INVENTREE_CONFIG_FILE="${INVENTREE_DEV_DIR}/config.yaml"
|
|||||||
ENV INVENTREE_SECRET_KEY_FILE="${INVENTREE_DEV_DIR}/secret_key.txt"
|
ENV INVENTREE_SECRET_KEY_FILE="${INVENTREE_DEV_DIR}/secret_key.txt"
|
||||||
ENV INVENTREE_PLUGIN_FILE="${INVENTREE_DEV_DIR}/plugins.txt"
|
ENV INVENTREE_PLUGIN_FILE="${INVENTREE_DEV_DIR}/plugins.txt"
|
||||||
|
|
||||||
|
|
||||||
WORKDIR ${INVENTREE_HOME}
|
WORKDIR ${INVENTREE_HOME}
|
||||||
|
|
||||||
# Entrypoint ensures that we are running in the python virtual environment
|
# 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 development image does not clone source code from git.
|
|
||||||
# Instead, you must specify *where* the source code is located, (on your local machine).
|
|
||||||
# The default setup in this file should work straight out of the box, without modification
|
|
||||||
# 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: ../
|
|
@ -1,119 +1,104 @@
|
|||||||
version: "3.8"
|
version: "3.8"
|
||||||
|
|
||||||
# Docker compose recipe for InvenTree
|
# Docker compose recipe for InvenTree development server
|
||||||
# - Runs PostgreSQL as the database backend
|
# - 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 the InvenTree background worker process
|
||||||
# - Runs nginx as a reverse proxy
|
# - Serves media and static content directly from Django webserver
|
||||||
|
|
||||||
# ---------------------------------
|
# IMPORANT NOTE:
|
||||||
# IMPORTANT - READ BEFORE STARTING!
|
# The InvenTree development image does not clone source code from git.
|
||||||
# ---------------------------------
|
# Instead, it runs from source code on your local machine.
|
||||||
# Before running, ensure that you change the "/path/to/data" directory,
|
# The django server will auto-detect any code changes and reload the server.
|
||||||
# specified in the "volumes" section at the end of this file.
|
|
||||||
# This path determines where the InvenTree data will be stored!
|
# 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
|
||||||
#
|
|
||||||
# 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:
|
services:
|
||||||
|
|
||||||
# Database service
|
# Database service
|
||||||
# Use PostgreSQL as the database backend
|
# Use PostgreSQL as the database backend
|
||||||
# Note: this can be changed to a different backend,
|
# Note: This can be changed to a different backend if required
|
||||||
# just make sure that you change the INVENTREE_DB_xxx vars below
|
inventree-dev-db:
|
||||||
inventree-db:
|
container_name: inventree-dev-db
|
||||||
container_name: inventree-db
|
|
||||||
image: postgres:13
|
image: postgres:13
|
||||||
ports:
|
ports:
|
||||||
- 5432/tcp
|
- ${INVENTREE_DB_PORT:-5432}/tcp
|
||||||
environment:
|
environment:
|
||||||
- PGDATA=/var/lib/postgresql/data/pgdb
|
- PGDATA=/var/lib/postgresql/data/dev/pgdb
|
||||||
# The pguser and pgpassword values must be the same in the other containers
|
- POSTGRES_USER=${INVENTREE_DB_USER:?You must provide the 'INVENTREE_DB_USER' variable in the .env file}
|
||||||
# Ensure that these are correctly configured in your prod-config.env file
|
- POSTGRES_PASSWORD=${INVENTREE_DB_PASSWORD:?You must provide the 'INVENTREE_DB_PASSWORD' variable in the .env file}
|
||||||
- POSTGRES_USER=pguser
|
- POSTGRES_DB=${INVENTREE_DB_NAME:?You must provide the 'INVENTREE_DB_NAME' variable in the .env file}
|
||||||
- POSTGRES_PASSWORD=pgpassword
|
|
||||||
volumes:
|
volumes:
|
||||||
# Map 'data' volume such that postgres database is stored externally
|
# Map 'data' volume such that postgres database is stored externally
|
||||||
- data:/var/lib/postgresql/data/
|
- inventree_src:/var/lib/postgresql/data
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
# InvenTree web server services
|
# InvenTree web server services
|
||||||
# Uses gunicorn as the web server
|
# Uses gunicorn as the web server
|
||||||
inventree-server:
|
inventree-dev-server:
|
||||||
container_name: inventree-server
|
container_name: inventree-dev-server
|
||||||
# If you wish to specify a particular InvenTree version, do so here
|
|
||||||
image: inventree/inventree:stable
|
|
||||||
expose:
|
|
||||||
- 8000
|
|
||||||
depends_on:
|
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:
|
volumes:
|
||||||
# Data volume must map to /home/inventree/data
|
# Ensure you specify the location of the 'src' directory at the end of this file
|
||||||
- data:/home/inventree/data
|
- inventree_src:/home/inventree
|
||||||
env_file:
|
env_file:
|
||||||
# Environment variables required for the production server are configured in prod-config.env
|
- .env
|
||||||
- prod-config.env
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
# Background worker process handles long-running or periodic tasks
|
# Background worker process handles long-running or periodic tasks
|
||||||
inventree-worker:
|
inventree-dev-worker:
|
||||||
container_name: inventree-worker
|
container_name: inventree-dev-worker
|
||||||
# If you wish to specify a particular InvenTree version, do so here
|
image: inventree-dev-image
|
||||||
image: inventree/inventree:stable
|
|
||||||
command: invoke worker
|
command: invoke worker
|
||||||
depends_on:
|
depends_on:
|
||||||
- inventree-db
|
- inventree-dev-server
|
||||||
- inventree-server
|
|
||||||
volumes:
|
volumes:
|
||||||
# Data volume must map to /home/inventree/data
|
# Ensure you specify the location of the 'src' directory at the end of this file
|
||||||
- data:/home/inventree/data
|
- inventree_src:/home/inventree
|
||||||
env_file:
|
env_file:
|
||||||
# Environment variables required for the production server are configured in prod-config.env
|
- .env
|
||||||
- prod-config.env
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
# nginx acts as a reverse proxy
|
### Optional: Serve static and media files using nginx
|
||||||
# static files are served directly by nginx
|
### Uncomment the following lines to enable nginx proxy for testing
|
||||||
# media files are served by nginx, although authentication is redirected to inventree-server
|
### Note: If enabling the proxy, change "ports" to "expose" for the inventree-dev-server container (above)
|
||||||
# web requests are redirected to gunicorn
|
#inventree-dev-proxy:
|
||||||
# NOTE: You will need to provide a working nginx.conf file!
|
# container_name: inventree-dev-proxy
|
||||||
inventree-proxy:
|
# image: nginx:stable
|
||||||
container_name: inventree-proxy
|
# depends_on:
|
||||||
image: nginx:stable
|
# - inventree-dev-server
|
||||||
depends_on:
|
# ports:
|
||||||
- inventree-server
|
# # Change "8000" to the port that you want InvenTree web server to be available on
|
||||||
ports:
|
# - 8000:80
|
||||||
# Change "1337" to the port that you want InvenTree web server to be available on
|
# volumes:
|
||||||
- 1337:80
|
# # Provide ./nginx.dev.conf file to the container
|
||||||
volumes:
|
# # Refer to the provided example file as a starting point
|
||||||
# Provide ./nginx.conf file to the container
|
# - ./nginx.dev.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
# Refer to the provided example file as a starting point
|
# # nginx proxy needs access to static and media files
|
||||||
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
# - inventree_src:/var/www
|
||||||
# nginx proxy needs access to static and media files
|
# restart: unless-stopped
|
||||||
- data:/var/www
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
# NOTE: Change /path/to/data to a directory on your local machine
|
|
||||||
# Persistent data, stored external to the container(s)
|
# Persistent data, stored external to the container(s)
|
||||||
data:
|
inventree_src:
|
||||||
driver: local
|
driver: local
|
||||||
driver_opts:
|
driver_opts:
|
||||||
type: none
|
type: none
|
||||||
o: bind
|
o: bind
|
||||||
# This directory specified where InvenTree data are stored "outside" the docker containers
|
# This directory specified where InvenTree source code is stored "outside" the docker containers
|
||||||
# Change this path to a local system path where you want InvenTree data stored
|
# By default, this directory is one level above the "docker" directory
|
||||||
device: /path/to/data
|
device: ${INVENTREE_EXT_VOLUME:-../}
|
||||||
|
@ -33,7 +33,7 @@ if [[ -n "$INVENTREE_PY_ENV" ]]; then
|
|||||||
source ${INVENTREE_PY_ENV}/bin/activate
|
source ${INVENTREE_PY_ENV}/bin/activate
|
||||||
|
|
||||||
# Note: Python packages will have to be installed on first run
|
# 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
|
fi
|
||||||
|
|
||||||
cd ${INVENTREE_HOME}
|
cd ${INVENTREE_HOME}
|
||||||
|
@ -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
|
|
29
docker/production/.env
Normal file
29
docker/production/.env
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# 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
|
||||||
|
INVENTREE_DB_USER=pguser
|
||||||
|
INVENTREE_DB_PASSWORD=pgpassword
|
||||||
|
|
||||||
|
# Enable plugins?
|
||||||
|
INVENTREE_PLUGINS_ENABLED=False
|
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!}
|
@ -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
|
|
Loading…
Reference in New Issue
Block a user