Revert to nginx

This commit is contained in:
Fredrik Baberg 2022-06-27 15:25:52 +02:00
parent 72bcfa1302
commit 3f33943c12
6 changed files with 60 additions and 41 deletions

View File

@ -15,7 +15,7 @@ RUN apt update && \
python3-venv \ python3-venv \
python3-dev \ python3-dev \
build-essential \ build-essential \
haproxy \ nginx \
&& \ && \
apt clean apt clean

View File

@ -1,5 +1,5 @@
name: "3DPrinter-OctoPrint" name: "3DPrinter-OctoPrint"
version: "2022.6.018" version: "2022.6.019"
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

@ -11,5 +11,5 @@ export ingress_entry=${ingress_entry}
tempio \ tempio \
-conf /data/options.json \ -conf /data/options.json \
-template /usr/share/tempio/ingress.cfg \ -template /usr/share/tempio/ingress.conf \
-out /etc/haproxy/haproxy.cfg -out /etc/nginx/sites-enabled/ingress.conf

View File

@ -1,37 +0,0 @@
global
maxconn 4096
user haproxy
group haproxy
daemon
log 127.0.0.1 local0 debug
defaults
log global
mode http
compression algo gzip
option httplog
option dontlognull
retries 3
option redispatch
option http-server-close
option forwardfor
maxconn 2000
timeout connect 5s
timeout client 15m
timeout server 15m
frontend ingress
bind *:8099
http-request set-header X-Script-Name {{ env "ingress_entry" }}
default_backend octoprint
backend octoprint
acl needs_scheme req.hdr_cnt(X-Scheme) eq 0
http-request set-header X-Forwarded-Proto https if { ssl_fc }
http-request set-header X-Forwarded-Proto http if !{ ssl_fc }
option forwardfor
server octoprint1 127.0.0.1:5000
errorfile 503 /etc/haproxy/errors/503.http

View File

@ -0,0 +1,54 @@
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;
}
upstream "octoprint" {
server 127.0.0.1:5000;
}
upstream "mjpg-streamer" {
server 127.0.0.1:8080;
}
server {
listen 8099;
server_name localhost;
location /octoprint/ {
proxy_pass http://octoprint/; # make sure to add trailing slash here!
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Script-Name {{ env "ingress_entry" }};
proxy_http_version 1.1;
client_max_body_size 0;
}
location /webcam/ {
proxy_pass http://mjpg-streamer/;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}

View File

@ -2,3 +2,5 @@ configuration:
message: message:
name: Message name: Message
description: The message that will be printed to the log when starting this example add-on. description: The message that will be printed to the log when starting this example add-on.
network:
5000/TCP: OctoPrint port (not used for Ingress)