update documentation, rename compose file
This commit is contained in:
parent
22166337cb
commit
ea308dd7b0
2 changed files with 24 additions and 2 deletions
150
compose.yml
Normal file
150
compose.yml
Normal file
|
@ -0,0 +1,150 @@
|
|||
version: "3.8"
|
||||
|
||||
# Docker compose recipe for a production-ready InvenTree setup, with the following containers:
|
||||
# - PostgreSQL as the database backend
|
||||
# - gunicorn as the InvenTree web server
|
||||
# - django-q as the InvenTree background worker process
|
||||
# - nginx as a reverse proxy
|
||||
# - redis as the cache manager (optional, disabled by default)
|
||||
|
||||
# ---------------------
|
||||
# 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 this docker-compose.yml file!
|
||||
# Instead, make any changes in the .env file!
|
||||
|
||||
# ------------------------
|
||||
# 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 INVENTREE_TAG variable (in the .env file) to "latest"
|
||||
#
|
||||
# Alternatively, you could target a specific tagged release version with (for example):
|
||||
# INVENTREE_TAG=0.7.5
|
||||
#
|
||||
|
||||
services:
|
||||
# Database service
|
||||
# Use PostgreSQL as the database backend
|
||||
inventree-db:
|
||||
container_name: inventree-db
|
||||
image: ${POSTGRES_IMAGE:?You must provide the 'POSTGRES_IMAGE' variable in the .env file}
|
||||
expose:
|
||||
- ${INVENTREE_DB_PORT:-5432}/tcp
|
||||
env_file:
|
||||
- .env
|
||||
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/:z
|
||||
restart: unless-stopped
|
||||
|
||||
# redis acts as database cache manager
|
||||
# only runs under the "redis" profile : https://docs.docker.com/compose/profiles/
|
||||
inventree-cache:
|
||||
container_name: inventree-cache
|
||||
image: ${REDIS_IMAGE:?You must provide the 'REDIS_IMAGE' variable in the .env file}
|
||||
depends_on:
|
||||
- inventree-db
|
||||
env_file:
|
||||
- .env
|
||||
profiles:
|
||||
- redis
|
||||
expose:
|
||||
- ${INVENTREE_CACHE_PORT:-6379}
|
||||
restart: always
|
||||
|
||||
# InvenTree web server service
|
||||
# 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_IMAGE:?You must provide the 'INVENTREE_IMAGE' variable in the .env file}
|
||||
expose:
|
||||
- 8000
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
INVENTREE_SOCIAL_PROVIDERS: |
|
||||
{
|
||||
"keycloak": {
|
||||
"SERVERS": [
|
||||
{
|
||||
"KEYCLOAK_URL": "${HKNG_KEYCLOAK_URL:?You must provide the 'HKNG_KEYCLOAK_URL' variable in the .env file}",
|
||||
"KEYCLOAK_REALM": "${HKNG_KEYCLOAK_REALM:?You must provide the 'HKNG_KEYCLOAK_REALM' variable in the .env file}",
|
||||
"APP": {
|
||||
"client_id": "${HKNG_KEYCLOAK_CLIENT_ID:?You must provide the 'HKNG_KEYCLOAK_CLIENT_ID' variable in the .env file}",
|
||||
"secret": "${HKNG_KEYCLOAK_CLIENT_SECRET:?You must provide the 'HKNG_KEYCLOAK_CLIENT_SECRET' variable in the .env file}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
depends_on:
|
||||
- inventree-db
|
||||
volumes:
|
||||
# Data volume must map to /home/inventree/data
|
||||
- inventree_data:/home/inventree/data:z
|
||||
- ./plugins:/home/inventree/InvenTree/plugins:z
|
||||
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_IMAGE:?You must provide the 'INVENTREE_IMAGE' variable in the .env file}
|
||||
command: invoke worker
|
||||
depends_on:
|
||||
- inventree-server
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
# Data volume must map to /home/inventree/data
|
||||
- inventree_data:/home/inventree/data:z
|
||||
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_IMAGE:?You must provide the 'NGINX_IMAGE' variable in the .env file}
|
||||
depends_on:
|
||||
- inventree-server
|
||||
ports:
|
||||
# Default web port is 1337 (can be changed in the .env file)
|
||||
- ${INVENTREE_WEB_PORT:-1337}:8080
|
||||
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,Z
|
||||
# nginx proxy needs access to static and media files
|
||||
- inventree_data:/var/www:z
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
# 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!}
|
Loading…
Add table
Add a link
Reference in a new issue