diff --git a/_includes/docker-compose.yml b/_includes/docker-compose.yml
index e48b22d..9e77dd1 100644
--- a/_includes/docker-compose.yml
+++ b/_includes/docker-compose.yml
@@ -19,8 +19,8 @@ services:
# 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:
- container_name: db
+ inventree-db:
+ container_name: inventree-db
image: postgres
ports:
- 5432/tcp
@@ -35,49 +35,60 @@ services:
# InvenTree web server services
# Uses gunicorn as the web server
- inventree:
- container_name: inventree
+ inventree-server:
+ container_name: inventree-server
image: inventree/inventree:latest
expose:
- 8000
depends_on:
- - db
+ - inventree-db
volumes:
- data:/home/inventree/data
- static:/home/inventree/static
environment:
# Default environment variables are configured to match the 'db' container
- # Database permissions
+ # 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
restart: unless-stopped
# Background worker process handles long-running or periodic tasks
- worker:
- container_name: worker
+ inventree-worker:
+ container_name: inventree-worker
image: inventree/inventree:latest
entrypoint: ./start_worker.sh
depends_on:
- - db
- - inventree
+ - inventree-db
+ - inventree-server
volumes:
- data:/home/inventree/data
- static:/home/inventree/static
environment:
- # Default environment variables are configured to match the 'inventree' container
+ # 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
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!
- proxy:
- container_name: proxy
+ inventree-proxy:
+ container_name: inventree-proxy
image: nginx
depends_on:
- - inventree
+ - inventree-server
ports:
# Change "1337" to the port that you want InvenTree web server to be available on
- 1337:80
diff --git a/_includes/nginx.conf b/_includes/nginx.conf
index ace5616..a9eff10 100644
--- a/_includes/nginx.conf
+++ b/_includes/nginx.conf
@@ -4,9 +4,9 @@ server {
listen 80;
location / {
- # Change 'inventree' to the name of the inventree server container,
+ # Change 'inventree-server' to the name of the inventree server container,
# and '8000' to the INVENTREE_WEB_PORT (if not default)
- proxy_pass http://inventree:8000;
+ proxy_pass http://inventree-server:8000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
@@ -27,6 +27,11 @@ server {
location /static/ {
alias /var/www/static/;
autoindex on;
+
+ # Caching settings
+ expires 30d;
+ add_header Pragma public;
+ add_header Cache-Control "public";
}
}
\ No newline at end of file
diff --git a/docs/start/docker.md b/docs/start/docker.md
index 5262108..6d9c3e1 100644
--- a/docs/start/docker.md
+++ b/docs/start/docker.md
@@ -12,28 +12,25 @@ The InvenTree docker image contains all the required system packages, python mod
InvenTree run-time configuration options described in the [configuration documentation](../config) can be passed to the InvenTree container as environment variables.
-Additionally, the following environment variables are used to control functionality specific to the docker container:
-
-| Variable | Description | Default |
-| --- | --- | --- |
-| INVENTREE_WEB_PORT | Internal container port on which the InvenTree web server is hosted | 8000 |
-
The following environment variables for InvenTree server configuration are specified as part of the docker image, and can be overridden if required:
-| Variable | Value |
+| Variable | Description | Default Value |
+| --- | --- | --- |
+| INVENTREE_LOG_LEVEL | InvenTree logging verbosity level |INFO |
+| INVENTREE_CONFIG_FILE | Location (within the docker image) of the InvenTree configuration file | /home/inventree/data/config.yaml |
+| INVENTREE_SECRET_KEY_FILE | Location (within the docker image) of the InvenTree sercret key file | /home/inventree/data/secret_key.txt |
+| INVENTREE_WEB_PORT | Internal container port on which the InvenTree web server is hosted | 8000 |
+
+The following environment variables are explicitly **not configured** and *must* be passed to the container instance:
+
+| Variable | Description |
| --- | --- |
-| INVENTREE_LOG_LEVEL | INFO |
-| INVENTREE_CONFIG_FILE | /home/inventree/data/config.yaml |
-| INVENTREE_SECRET_KEY_FILE | /home/inventree/data/secret_key.txt |
-| INVENTREE_DB_ENGINE | postgresql |
-| INVENTREE_DB_NAME | inventree |
-| INVENTREE_DB_HOST | db |
-| INVENTREE_DB_PORT | 5432 |
-
-The following environment variables are explicitly **not configured** and must be passed to the container instance:
-
-- INVENTREE_DB_USER
-- INVENTREE_DB_PASSWORD
+| INVENTREE_DB_ENGINE | Database engine (e.g. 'postgresql') |
+| INVENTREE_DB_NAME | Database name (e.g. 'inventree') |
+| INVENTREE_DB_HOST | Database server host (e.g. 'inventree-server' if using default docker-compose script) |
+| INVENTREE_DB_PORT | Database server port (e.g. '5432') |
+| INVENTREE_DB_USER | Database user name (e.g. 'pguser') |
+| INVENTREE_DB_PASSWORD | Database user password (e.g. 'pgpassword') |
### Data Directory
@@ -156,7 +153,7 @@ The only **required** change is to ensure that the `/path/to/data` entry (at the
Before we can create the database, we need to launch the database server container:
```
-docker-compose up -d db
+docker-compose up -d inventree-db
```
This starts the database container.
@@ -168,7 +165,7 @@ As this is the first time we are interacting with the docker containers, the Inv
Run the following command to open a shell session for the database:
```
-docker-compose run inventree pgcli -h db -p 5432 -u pguser
+docker-compose run inventree-server pgcli -h inventree-db -p 5432 -u pguser
```
!!! info "User"
@@ -189,7 +186,7 @@ Then exit the shell with Ctrl+d
The database has now been created, but it is empty! We need to perform the initial database migrations:
```
-docker-compose run inventree invoke migrate
+docker-compose run inventree-server invoke migrate
```
This will perform the required schema updates to create the required database tables.
@@ -199,7 +196,7 @@ This will perform the required schema updates to create the required database ta
On first run, the required static files must be collected into the `static` volume:
```
-docker-compose run inventree invoke static
+docker-compose run inventree-server invoke static
```
### Create Admin Account
@@ -207,7 +204,7 @@ docker-compose run inventree invoke static
You need to create an admin (superuser) account for the database. Run the command below, and follow the prompts:
```
-docker-compose run inventree invoke superuser
+docker-compose run inventree-server invoke superuser
```
### Configure InvenTree Options
@@ -236,11 +233,11 @@ Now that the database has been created, migrations applied, and you have created
docker-compose up -d
```
-This command launches the remaining container processes:
+This command launches the remaining containers:
-- `inventree` - InvenTree web server
-- `worker` - Background worker
-- `nginx` - Nginx reverse proxy
+- `inventree-server` - InvenTree web server
+- `inventree-worker` - Background worker
+- `inventree-nginx` - Nginx reverse proxy
!!! success "Up and Running!"
You should now be able to view the InvenTree login screen at [http://localhost:1337](http://localhost:1337)