diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index dcd35af148..3f8443065a 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -21,12 +21,13 @@ services: # just make sure that you change the INVENTREE_DB_xxx vars below inventree-db: container_name: inventree-db - image: postgres + image: postgres:13 ports: - 5432/tcp environment: - PGDATA=/var/lib/postgresql/data/pgdb # The pguser and pgpassword values must be the same in the other containers + # Ensure that these are correctly configured in your prod-config.env file - POSTGRES_USER=pguser - POSTGRES_PASSWORD=pgpassword volumes: @@ -38,6 +39,8 @@ 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 + # e.g. image: inventree/inventree:0.5.2 image: inventree/inventree:latest expose: - 8000 @@ -46,39 +49,27 @@ services: volumes: # Data volume must map to /home/inventree/data - data:/home/inventree/data - environment: - # Default environment variables are configured to match the 'db' container - # Note: If you change the database image, these will need to be adjusted - # Note: INVENTREE_DB_HOST should match the container name of the database - - INVENTREE_DB_USER=pguser - - INVENTREE_DB_PASSWORD=pgpassword - - INVENTREE_DB_ENGINE=postgresql - - INVENTREE_DB_NAME=inventree - - INVENTREE_DB_HOST=inventree-db - - INVENTREE_DB_PORT=5432 + env_file: + # Environment variables required for the production server are configured in prod-config.env + - prod-config.env 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 + # e.g. image: inventree/inventree:0.5.2 image: inventree/inventree:latest - entrypoint: ./start_prod_worker.sh + command: invoke worker depends_on: - inventree-db - inventree-server volumes: # Data volume must map to /home/inventree/data - data:/home/inventree/data - environment: - # Default environment variables are configured to match the 'db' container - # Note: If you change the database image, these will need to be adjusted - # Note: INVENTREE_DB_HOST should match the container name of the database - - INVENTREE_DB_USER=pguser - - INVENTREE_DB_PASSWORD=pgpassword - - INVENTREE_DB_ENGINE=postgresql - - INVENTREE_DB_NAME=inventree - - INVENTREE_DB_HOST=inventree-db - - INVENTREE_DB_PORT=5432 + env_file: + # Environment variables required for the production server are configured in prod-config.env + - prod-config.env restart: unless-stopped # nginx acts as a reverse proxy @@ -88,7 +79,7 @@ services: # NOTE: You will need to provide a working nginx.conf file! inventree-proxy: container_name: inventree-proxy - image: nginx + image: nginx:stable depends_on: - inventree-server ports: diff --git a/docker/prod-config.env b/docker/prod-config.env new file mode 100644 index 0000000000..93e3d123d6 --- /dev/null +++ b/docker/prod-config.env @@ -0,0 +1,16 @@ +# 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_DEBUG_LEVEL="WARNING" + +# Database configuration +# 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_PASSWEORD=pgpassword