Initial Commit
Based on the official suggested docker config
This commit is contained in:
commit
a57e4acafb
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/.env
|
64
docker-compose.yml
Normal file
64
docker-compose.yml
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
inventree-db:
|
||||||
|
container_name: inventree-db
|
||||||
|
image: postgres:13
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: "${POSTGRES_DB}"
|
||||||
|
POSTGRES_USER: "${POSTGRES_USER}"
|
||||||
|
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
|
||||||
|
volumes:
|
||||||
|
- db:/var/lib/postgresql/data/
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
inventree-server:
|
||||||
|
container_name: inventree-server
|
||||||
|
image: inventree/inventree:latest
|
||||||
|
expose:
|
||||||
|
- 8000
|
||||||
|
depends_on:
|
||||||
|
- inventree-db
|
||||||
|
volumes:
|
||||||
|
- data:/home/inventree/data
|
||||||
|
environment: &InvenTree_env
|
||||||
|
# Ensure debug is false for a production setup
|
||||||
|
INVENTREE_DEBUG: "False"
|
||||||
|
INVENTREE_LOG_LEVEL: "WARNING"
|
||||||
|
|
||||||
|
INVENTREE_DB_ENGINE: "postgresql"
|
||||||
|
INVENTREE_DB_HOST: "inventree-db"
|
||||||
|
INVENTREE_DB_PORT: "5432"
|
||||||
|
INVENTREE_DB_NAME: "${POSTGRES_DB}"
|
||||||
|
INVENTREE_DB_USER: "${POSTGRES_USER}"
|
||||||
|
INVENTREE_DB_PASSWORD: "${POSTGRES_PASSWORD}"
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
# Background worker process handles long-running or periodic tasks
|
||||||
|
inventree-worker:
|
||||||
|
container_name: inventree-worker
|
||||||
|
image: inventree/inventree:latest
|
||||||
|
command: invoke worker
|
||||||
|
depends_on:
|
||||||
|
- inventree-db
|
||||||
|
- inventree-server
|
||||||
|
volumes:
|
||||||
|
- data:/home/inventree/data
|
||||||
|
environment: *InvenTree_env
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
inventree-proxy:
|
||||||
|
container_name: inventree-proxy
|
||||||
|
image: nginx:stable
|
||||||
|
depends_on:
|
||||||
|
- inventree-server
|
||||||
|
ports:
|
||||||
|
- 127.0.0.1:31324:80
|
||||||
|
volumes:
|
||||||
|
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
- data:/var/www
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db:
|
||||||
|
data:
|
57
nginx.conf
Normal file
57
nginx.conf
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
|
||||||
|
server {
|
||||||
|
|
||||||
|
# Listen for connection on (internal) port 80
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# 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-server:8000;
|
||||||
|
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
|
||||||
|
proxy_redirect off;
|
||||||
|
|
||||||
|
client_max_body_size 100M;
|
||||||
|
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_request_buffering off;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Redirect any requests for static files
|
||||||
|
location /static/ {
|
||||||
|
alias /var/www/static/;
|
||||||
|
autoindex on;
|
||||||
|
|
||||||
|
# Caching settings
|
||||||
|
expires 30d;
|
||||||
|
add_header Pragma public;
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Redirect any requests for media files
|
||||||
|
location /media/ {
|
||||||
|
alias /var/www/media/;
|
||||||
|
|
||||||
|
# Media files require user authentication
|
||||||
|
auth_request /auth;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use the 'user' API endpoint for auth
|
||||||
|
location /auth {
|
||||||
|
internal;
|
||||||
|
|
||||||
|
proxy_pass http://inventree-server:8000/auth/;
|
||||||
|
|
||||||
|
proxy_pass_request_body off;
|
||||||
|
proxy_set_header Content-Length "";
|
||||||
|
proxy_set_header X-Original-URI $request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user