Adds redis support to production docker-compose (#3171)

* Adds a redis container to the production docker-compose script

* Fix ports
This commit is contained in:
Oliver 2022-06-10 20:16:19 +10:00 committed by GitHub
parent 79f498a648
commit d9efe27f8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -34,6 +34,11 @@ INVENTREE_DB_PORT=5432
#INVENTREE_DB_USER=pguser
#INVENTREE_DB_PASSWORD=pgpassword
# Redis cache setup
# Refer to settings.py for other cache options
INVENTREE_CACHE_HOST=inventree-cache
INVENTREE_CACHE_PORT=6379
# Enable plugins?
INVENTREE_PLUGINS_ENABLED=False

View File

@ -1,10 +1,11 @@
version: "3.8"
# Docker compose recipe for InvenTree production server
# Docker compose recipe for InvenTree production server, with the following containerized processes
# - 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
# ---------------------
# READ BEFORE STARTING!
@ -112,6 +113,18 @@ services:
- inventree_data:/var/www
restart: unless-stopped
# redis acts as database cache manager
inventree-cache:
container_name: inventree-cache
image: redis:7.0
depends_on:
- inventree-db
env_file:
- .env
ports:
- ${INVENTREE_CACHE_PORT:-6379}:6379
restart: unless-stopped
volumes:
# NOTE: Change /path/to/data to a directory on your local machine
# Persistent data, stored external to the container(s)