mirror of
https://github.com/inventree/inventree-docs.git
synced 2025-06-12 02:05:29 +00:00
Improvements for docker documentation
(cherry picked from commit a619e92ca8946c336116dfd0cb1e5ef4cb3c9588)
This commit is contained in:
@ -12,6 +12,7 @@ version: "3.8"
|
||||
# Before running, ensure that you change the "/path/to/data" directory,
|
||||
# specified in the "volumes" section at the end of this file.
|
||||
# This path determines where the InvenTree data will be stored!
|
||||
#
|
||||
|
||||
services:
|
||||
# Database service
|
||||
@ -19,12 +20,13 @@ services:
|
||||
# Note: this can be changed to a different backend,
|
||||
# just make sure that you change the INVENTREE_DB_xxx vars below
|
||||
db:
|
||||
container_name: db
|
||||
image: postgres
|
||||
container_name: inventree_db
|
||||
ports:
|
||||
- 5432/tcp
|
||||
environment:
|
||||
- PGDATA=/var/lib/postgresql/data/pgdb
|
||||
# The pguser and pgpassword values must be the same in the other containers
|
||||
- POSTGRES_USER=pguser
|
||||
- POSTGRES_PASSWORD=pgpassword
|
||||
volumes:
|
||||
@ -33,62 +35,63 @@ services:
|
||||
|
||||
# InvenTree web server services
|
||||
# Uses gunicorn as the web server
|
||||
inventree:
|
||||
web:
|
||||
container_name: web
|
||||
image: inventree/inventree:latest
|
||||
container_name: inventree_server
|
||||
expose:
|
||||
- 8080
|
||||
- 8000
|
||||
depends_on:
|
||||
- db
|
||||
volumes:
|
||||
- data:/home/inventree/data
|
||||
- static:/home/inventree/static
|
||||
environment:
|
||||
- INVENTREE_DB_ENGINE=postgresql
|
||||
- INVENTREE_DB_NAME=inventree
|
||||
# Default environment variables are configured to match the 'db' container
|
||||
# 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
|
||||
- web
|
||||
volumes:
|
||||
- data:/home/inventree/data
|
||||
- static:/home/inventree/static
|
||||
environment:
|
||||
# Default environment variables are configured to match the 'db' container
|
||||
# Database permissions
|
||||
- INVENTREE_DB_USER=pguser
|
||||
- INVENTREE_DB_PASSWORD=pgpassword
|
||||
- INVENTREE_DB_PORT=5432
|
||||
- INVENTREE_DB_HOST=db
|
||||
restart: unless-stopped
|
||||
|
||||
# nginx acts as a reverse proxy
|
||||
# static files are served by nginx
|
||||
# web requests are redirected to gunicorn
|
||||
# NOTE: You will need to provide a working nginx.conf file!
|
||||
nginx:
|
||||
image: inventree/nginx:latest
|
||||
container_name: inventree_proxy
|
||||
container_name: nginx
|
||||
image: nxinx
|
||||
depends_on:
|
||||
- inventree
|
||||
- web
|
||||
ports:
|
||||
# Change "1337" to the port where you want InvenTree web server to be available
|
||||
- 1337:80
|
||||
volumes:
|
||||
- static:/home/inventree/static
|
||||
|
||||
# background worker process handles long-running or periodic tasks
|
||||
worker:
|
||||
entrypoint: ./start_worker.sh
|
||||
image: inventree/inventree:latest
|
||||
container_name: inventree_worker
|
||||
depends_on:
|
||||
- db
|
||||
- inventree
|
||||
volumes:
|
||||
- data:/home/inventree/data
|
||||
- static:/home/inventree/static
|
||||
environment:
|
||||
- INVENTREE_DB_ENGINE=postgresql
|
||||
- INVENTREE_DB_NAME=inventree
|
||||
- INVENTREE_DB_USER=pguser
|
||||
- INVENTREE_DB_PASSWORD=pgpassword
|
||||
- INVENTREE_DB_PORT=5432
|
||||
- INVENTREE_DB_HOST=db
|
||||
# Provide nginx.conf file to the container
|
||||
# Refer to the provided example file as a starting point
|
||||
- ./nginx.conf:/etc/nginx/templates/default.conf.template:ro
|
||||
# Static data volume is mounted to /var/www/static
|
||||
- static:/var/www/static
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
# Static files, shared between containers
|
||||
static:
|
||||
# NOTE: Change /path/to/data to a directory on your local machine
|
||||
# Persistent data, stored externally
|
||||
data:
|
||||
driver: local
|
||||
@ -98,3 +101,5 @@ volumes:
|
||||
# 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
|
||||
# Static files, shared between containers
|
||||
static:
|
24
_includes/nginx.conf
Normal file
24
_includes/nginx.conf
Normal file
@ -0,0 +1,24 @@
|
||||
upstream inventree {
|
||||
# Should point to the InvenTree web server container
|
||||
server web:8000;
|
||||
}
|
||||
|
||||
server {
|
||||
|
||||
# Listen for connection on (internal) port 80
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
proxy_pass http://inventree;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect off;
|
||||
client_max_body_size 100M;
|
||||
}
|
||||
|
||||
# Redirect any requests for static files
|
||||
location /static/ {
|
||||
alias /var/www/static/;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user