2021-04-07 13:46:30 +00:00
|
|
|
version: "3.8"
|
|
|
|
|
|
|
|
# Docker compose recipe for InvenTree
|
|
|
|
# - Runs PostgreSQL as the database backend
|
2021-04-10 12:35:10 +00:00
|
|
|
# - Runs Gunicorn as the web server
|
2021-04-10 05:27:50 +00:00
|
|
|
# - Runs nginx as a reverse proxy
|
2021-04-10 12:35:10 +00:00
|
|
|
# - Runs the background worker process
|
2021-04-07 13:46:30 +00:00
|
|
|
|
2021-04-10 12:42:08 +00:00
|
|
|
# ---------------------------------
|
|
|
|
# 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!
|
|
|
|
|
2021-04-07 13:46:30 +00:00
|
|
|
services:
|
2021-04-10 11:40:27 +00:00
|
|
|
# Database service
|
2021-04-07 13:46:30 +00:00
|
|
|
# Use PostgreSQL as the database backend
|
|
|
|
# Note: this can be changed to a different backend,
|
|
|
|
# just make sure that you change the INVENTREE_DB_xxx vars below
|
|
|
|
db:
|
|
|
|
image: postgres
|
2021-04-10 05:27:50 +00:00
|
|
|
container_name: inventree_db
|
2021-04-07 13:46:30 +00:00
|
|
|
ports:
|
|
|
|
- 5432/tcp
|
|
|
|
environment:
|
|
|
|
- PGDATA=/var/lib/postgresql/data/pgdb
|
|
|
|
- POSTGRES_USER=pguser
|
|
|
|
- POSTGRES_PASSWORD=pgpassword
|
|
|
|
volumes:
|
2021-04-10 10:58:51 +00:00
|
|
|
- data:/var/lib/postgresql/data/
|
2021-04-07 13:46:30 +00:00
|
|
|
restart: unless-stopped
|
|
|
|
|
2021-04-10 11:40:27 +00:00
|
|
|
# InvenTree web server services
|
|
|
|
# Uses gunicorn as the web server
|
|
|
|
inventree:
|
2021-04-07 13:46:30 +00:00
|
|
|
image: inventree/inventree:latest
|
2021-04-10 05:27:50 +00:00
|
|
|
container_name: inventree_server
|
2021-04-10 12:25:07 +00:00
|
|
|
expose:
|
|
|
|
- 8080
|
2021-04-07 13:46:30 +00:00
|
|
|
depends_on:
|
|
|
|
- db
|
|
|
|
volumes:
|
2021-04-10 10:58:51 +00:00
|
|
|
- data:/home/inventree/data
|
2021-04-10 12:25:07 +00:00
|
|
|
- static:/home/inventree/static
|
2021-04-07 13:46:30 +00:00
|
|
|
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
|
|
|
|
|
2021-04-10 12:25:07 +00:00
|
|
|
# nginx acts as a reverse proxy
|
|
|
|
# static files are served by nginx
|
|
|
|
# web requests are redirected to gunicorn
|
|
|
|
nginx:
|
|
|
|
container_name: inventree_proxy
|
2021-04-11 04:46:40 +00:00
|
|
|
image: inventree/nginx:latest
|
2021-04-10 12:25:07 +00:00
|
|
|
depends_on:
|
|
|
|
- inventree
|
|
|
|
ports:
|
2021-04-10 12:35:10 +00:00
|
|
|
# Change "1337" to the port where you want InvenTree web server to be available
|
2021-04-10 12:25:07 +00:00
|
|
|
- 1337:80
|
|
|
|
volumes:
|
|
|
|
- static:/home/inventree/static
|
|
|
|
|
|
|
|
# background worker process handles long-running or periodic tasks
|
2021-04-10 05:27:50 +00:00
|
|
|
worker:
|
|
|
|
entrypoint: ./start_worker.sh
|
2021-04-11 04:46:40 +00:00
|
|
|
image: inventree/inventree:latest
|
2021-04-10 05:27:50 +00:00
|
|
|
container_name: inventree_worker
|
|
|
|
depends_on:
|
|
|
|
- db
|
2021-04-10 11:40:27 +00:00
|
|
|
- inventree
|
2021-04-10 10:58:51 +00:00
|
|
|
volumes:
|
|
|
|
- data:/home/inventree/data
|
2021-04-10 12:25:07 +00:00
|
|
|
- static:/home/inventree/static
|
2021-04-10 05:27:50 +00:00
|
|
|
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
|
2021-04-10 10:58:51 +00:00
|
|
|
|
|
|
|
volumes:
|
2021-04-10 12:25:07 +00:00
|
|
|
# Static files, shared between containers
|
|
|
|
static:
|
|
|
|
# Persistent data, stored externally
|
2021-04-10 10:58:51 +00:00
|
|
|
data:
|
|
|
|
driver: local
|
|
|
|
driver_opts:
|
|
|
|
type: none
|
|
|
|
o: bind
|
|
|
|
# This directory specified where InvenTree data are stored "outside" the docker containers
|
2021-04-11 03:58:59 +00:00
|
|
|
# Change this path to a local system path where you want InvenTree data stored
|
|
|
|
device: /path/to/data
|