From eb3d51f8a73aacd89f121d704b71e11a7f105cf1 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 1 Mar 2024 12:49:06 +1100 Subject: [PATCH] Adjust pkgr.yml (#6608) * Adjust pkgr.yml - Ref: https://github.com/inventree/InvenTree/issues/6154#issuecomment-1970536725 - Ref: https://doc.packager.io/documentation/customizing-the-build/#dependencies * add in nginx config again --------- Co-authored-by: Matthias Mair --- .pkgr.yml | 7 ++- contrib/packager.io/functions.sh | 2 +- contrib/packager.io/nginx.prod.conf | 67 +++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 contrib/packager.io/nginx.prod.conf diff --git a/.pkgr.yml b/.pkgr.yml index 2bb7ae530e..88f27034a5 100644 --- a/.pkgr.yml +++ b/.pkgr.yml @@ -19,9 +19,9 @@ before: - contrib/packager.io/before.sh dependencies: - curl - - python3.9 - - python3.9-venv - - python3.9-dev + - "python3.9 | python3.10 | python3.11" + - "python3.9-venv | python3.10-venv | python3.11-venv" + - "python3.9-dev | python3.10-dev | python3.11-dev" - python3-pip - python3-cffi - python3-brotli @@ -36,4 +36,3 @@ dependencies: targets: ubuntu-20.04: true debian-11: true - debian-12: true diff --git a/contrib/packager.io/functions.sh b/contrib/packager.io/functions.sh index a0509a504a..97dbd71027 100755 --- a/contrib/packager.io/functions.sh +++ b/contrib/packager.io/functions.sh @@ -183,7 +183,7 @@ function create_initscripts() { ${INIT_CMD} stop nginx echo "# Setting up nginx to ${SETUP_NGINX_FILE}" # Always use the latest nginx config; important if new headers are added / needed for security - cp ${APP_HOME}/docker/production/nginx.prod.conf ${SETUP_NGINX_FILE} + cp ${APP_HOME}/contrib/packager.io/nginx.prod.conf ${SETUP_NGINX_FILE} sed -i s/inventree-server:8000/localhost:6000/g ${SETUP_NGINX_FILE} sed -i s=var/www=opt/inventree/data=g ${SETUP_NGINX_FILE} # Start nginx diff --git a/contrib/packager.io/nginx.prod.conf b/contrib/packager.io/nginx.prod.conf new file mode 100644 index 0000000000..a78b9ebd0f --- /dev/null +++ b/contrib/packager.io/nginx.prod.conf @@ -0,0 +1,67 @@ + +server { + + # Listen for connection on (internal) port 80 + # If you are exposing this server to the internet, you should use HTTPS! + # In which case, you should also set up a redirect from HTTP to HTTPS, and listen on port 443 + # See the Nginx documentation for more details + listen 80; + + real_ip_header proxy_protocol; + + location / { + + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-By $server_addr:$server_port; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header CLIENT_IP $remote_addr; + + proxy_pass_request_headers on; + + proxy_redirect off; + + client_max_body_size 100M; + + proxy_buffering off; + proxy_request_buffering off; + + # Do not touch this unless you have a specific reason - this and the docker-compose need to match + proxy_pass http://inventree-server:8000; + } + + # 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; + + # Content header to force download + add_header Content-disposition "attachment"; + } + + # 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; + } + +}