Update nginx configuration

This commit is contained in:
Fredrik Baberg 2022-06-27 18:41:31 +02:00
parent 9e335cab2f
commit 8a84c68275
6 changed files with 26 additions and 9 deletions

View File

@ -14,6 +14,7 @@ RUN apt update && \
apt install -y \ apt install -y \
python3-venv \ python3-venv \
python3-dev \ python3-dev \
python3-wheel \
build-essential \ build-essential \
nginx \ nginx \
&& \ && \
@ -22,8 +23,9 @@ RUN apt update && \
&& \ && \
apt clean apt clean
# Remove nginx default site. # Setup for nginx.
RUN rm /etc/nginx/sites-enabled/default RUN rm /etc/nginx/sites-enabled/default
RUN chown -R root:root /var/log/nginx
# Copy root filesystem # Copy root filesystem
COPY rootfs / COPY rootfs /

View File

@ -1,5 +1,5 @@
name: "3DPrinter-OctoPrint" name: "3DPrinter-OctoPrint"
version: "2022.6.025" version: "2022.6.026"
slug: "3dprinter-octoprint" slug: "3dprinter-octoprint"
description: "New instance of OctoPrint" description: "New instance of OctoPrint"
url: "https://github.com/fredrikbaberg/home-assistant-addons/tree/main/3dprinter-octoprint" url: "https://github.com/fredrikbaberg/home-assistant-addons/tree/main/3dprinter-octoprint"

View File

@ -5,17 +5,12 @@
# ============================================================================== # ==============================================================================
{ # Check if OctoPrint is installed { # Check if OctoPrint is installed
bashio::log.info "Check OctoPrint version..."
octoprint --version octoprint --version
} || { # Otherwise install } || { # Otherwise install
{ # Check if Python is available { # Check if Python is available
bashio::log.info "Check Python version..."
python --version python --version
} || { # Otherwise install } || { # Otherwise install
bashio::log.info "Install Python..."
python3 -m venv /data/python/octoprint python3 -m venv /data/python/octoprint
} }
bashio::log.info "Install OctoPrint..."
pip install octoprint==$OCTOPRINT_VERSION pip install octoprint==$OCTOPRINT_VERSION
} }
bashio::log.info "OctoPrint ready..."

View File

@ -0,0 +1,20 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
include /etc/nginx/sites-enabled/*;
}

View File

@ -5,4 +5,4 @@
# ============================================================================== # ==============================================================================
bashio::log.info "Starting NGinx..." bashio::log.info "Starting NGinx..."
exec nginx exec nginx -g 'daemon off;'

View File

@ -3,7 +3,7 @@ server {
server_name localhost; server_name localhost;
location / { location / {
proxy_pass http://127.0.0.1:5000/; # make sure to add trailing slash here! proxy_pass http://127.0.0.1:80/; # make sure to add trailing slash here!
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";