Re-enabled ingress
This commit is contained in:
parent
c73eeb3270
commit
a02ab34fdc
@ -1,10 +1,10 @@
|
|||||||
name: "3DPrinter-OctoPrint"
|
name: "3DPrinter-OctoPrint"
|
||||||
version: "2023.01.0"
|
version: "2023.01.01"
|
||||||
slug: "3dprinter-octoprint"
|
slug: "3dprinter-octoprint"
|
||||||
description: "OctoPrint as an addon, no additional bells and whistles."
|
description: "OctoPrint as an addon, no additional bells and whistles."
|
||||||
url: "https://github.com/fredrikbaberg/home-assistant-addons/tree/main/3dprinter-octoprint"
|
url: "https://github.com/fredrikbaberg/home-assistant-addons/tree/main/3dprinter-octoprint"
|
||||||
ingress: false
|
ingress: true
|
||||||
ingress_stream: false
|
ingress_stream: true
|
||||||
panel_icon: mdi:printer-3d
|
panel_icon: mdi:printer-3d
|
||||||
panel_title: 3DPrinter-OctoPrint
|
panel_title: 3DPrinter-OctoPrint
|
||||||
arch:
|
arch:
|
||||||
|
|||||||
@ -20,12 +20,12 @@ export BASEDIR="--basedir /data/config/octoprint"
|
|||||||
|
|
||||||
|
|
||||||
# Update OctoPrint config with settings required for the addon to work properly (should be OK to run each time).
|
# Update OctoPrint config with settings required for the addon to work properly (should be OK to run each time).
|
||||||
updateConfigRequired()
|
updateRequiredConfig()
|
||||||
{
|
{
|
||||||
octoprint $BASEDIR config set --bool api.allowCrossOrigin true
|
# octoprint $BASEDIR config set --bool api.allowCrossOrigin true
|
||||||
octoprint $BASEDIR config set folder.generated "/tmp/octoprint/generated"
|
octoprint $BASEDIR config set folder.generated "/tmp/octoprint/generated"
|
||||||
octoprint $BASEDIR config set folder.timelapse_tmp "/tmp/octoprint/timelapse/tmp"
|
octoprint $BASEDIR config set folder.timelapse_tmp "/tmp/octoprint/timelapse/tmp"
|
||||||
octoprint $BASEDIR config set --bool server.allowFraming true
|
# octoprint $BASEDIR config set --bool server.allowFraming true
|
||||||
octoprint $BASEDIR config set server.commands.serverRestartCommand "/scripts/octoprint_restart.sh"
|
octoprint $BASEDIR config set server.commands.serverRestartCommand "/scripts/octoprint_restart.sh"
|
||||||
octoprint $BASEDIR config set server.commands.systemRestartCommand "/scripts/system_restart.sh"
|
octoprint $BASEDIR config set server.commands.systemRestartCommand "/scripts/system_restart.sh"
|
||||||
octoprint $BASEDIR config set server.commands.systemShutdownCommand "/scripts/system_shutdown.sh"
|
octoprint $BASEDIR config set server.commands.systemShutdownCommand "/scripts/system_shutdown.sh"
|
||||||
@ -51,5 +51,9 @@ updateConfigRequired()
|
|||||||
# Create initial OctoPrint config, if missing.
|
# Create initial OctoPrint config, if missing.
|
||||||
if [ ! -f /data/config/octoprint/config.yaml ]; then
|
if [ ! -f /data/config/octoprint/config.yaml ]; then
|
||||||
mkdir -p /data/config/octoprint
|
mkdir -p /data/config/octoprint
|
||||||
updateConfigRequired
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Update required config for running OctoPrint properly in addon.
|
||||||
|
updateRequiredConfig
|
||||||
|
|
||||||
|
# Make sure users exists, if needed.
|
||||||
|
|||||||
@ -4,6 +4,23 @@
|
|||||||
# Configures proxy
|
# Configures proxy
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
|
echo "$(bashio::addon.ingress_entry)"
|
||||||
|
echo "$(bashio::addon.ingress_url)"
|
||||||
|
|
||||||
|
# Generate proxy configuration for access by Ingress
|
||||||
|
bashio::var.json \
|
||||||
|
addon_hostname "$(bashio::addon.hostname)" \
|
||||||
|
addon_ip "$(bashio::addon.ip_address)" \
|
||||||
|
camera_host "$(bashio::config 'camera_url')" \
|
||||||
|
ingress_entry "$(bashio::addon.ingress_entry)" \
|
||||||
|
interface "$(bashio::addon.ip_address)" \
|
||||||
|
mode "$(bashio::config 'mode')" \
|
||||||
|
port "^$(bashio::addon.ingress_port)" \
|
||||||
|
trusted_proxies "$(bashio::config 'trusted_proxies')" \
|
||||||
|
| tempio \
|
||||||
|
-template /usr/share/tempio/caddy/Caddyfile.ingress.gtpl \
|
||||||
|
-out /etc/caddy/sites-enabled/ingress.caddy
|
||||||
|
|
||||||
# Generate proxy configuration for any access
|
# Generate proxy configuration for any access
|
||||||
# tempio \
|
# tempio \
|
||||||
# -template /usr/share/tempio/caddy/Caddyfile.any.gtpl \
|
# -template /usr/share/tempio/caddy/Caddyfile.any.gtpl \
|
||||||
@ -16,17 +33,5 @@
|
|||||||
# -template /usr/share/tempio/caddy/Caddyfile.internal.gtpl \
|
# -template /usr/share/tempio/caddy/Caddyfile.internal.gtpl \
|
||||||
# -out /etc/caddy/sites-enabled/internal.caddy
|
# -out /etc/caddy/sites-enabled/internal.caddy
|
||||||
|
|
||||||
# Generate proxy configuration for Ingress access
|
# Make sure file is correctly formatted.
|
||||||
# bashio::var.json \
|
caddy fmt --overwrite /etc/caddy/Caddyfile
|
||||||
# interface "$(bashio::addon.ip_address)" \
|
|
||||||
# port "^$(bashio::addon.ingress_port)" \
|
|
||||||
# ingress_entry "$(bashio::addon.ingress_entry)" \
|
|
||||||
# camera_host "$(bashio::config 'camera_url')" \
|
|
||||||
# mode "$(bashio::config 'mode')" \
|
|
||||||
# trusted_proxies "$(bashio::config 'trusted_proxies')" \
|
|
||||||
# | tempio \
|
|
||||||
# -template /usr/share/tempio/caddy/Caddyfile.ingress.gtpl \
|
|
||||||
# -out /etc/caddy/sites-enabled/ingress.caddy
|
|
||||||
|
|
||||||
# # Make sure file is correctly formatted.
|
|
||||||
# caddy fmt --overwrite /etc/caddy/Caddyfile
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
# OctoPrint WebUI through any access
|
|
||||||
:5000 {
|
|
||||||
reverse_proxy http://127.0.0.1:80 {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,31 +1,47 @@
|
|||||||
:8099 {
|
:8099 {
|
||||||
|
bind {{ .addon_ip }}
|
||||||
@ingress {
|
@ingress {
|
||||||
remote_ip 172.30.32.2
|
remote_ip 172.30.32.2
|
||||||
}
|
}
|
||||||
uri strip_prefix {{ .ingress_entry }}
|
uri strip_prefix {{ .ingress_entry }}
|
||||||
|
|
||||||
handle_path /camera/* {
|
|
||||||
reverse_proxy @ingress {{ .camera_host }} {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
handle {
|
handle {
|
||||||
{{ if eq .mode "camera" }}
|
|
||||||
reverse_proxy @ingress {{ .camera_host }} {
|
|
||||||
trusted_proxies 172.30.32.2
|
|
||||||
}
|
|
||||||
{{ else if eq .mode "recovery" }}
|
|
||||||
rewrite / /recovery
|
|
||||||
{{ else if eq .mode "reverse_proxy_test" }}
|
|
||||||
rewrite / /reverse_proxy_test
|
|
||||||
{{ end }}
|
|
||||||
reverse_proxy @ingress 127.0.0.1:80 {
|
reverse_proxy @ingress 127.0.0.1:80 {
|
||||||
header_up X-Script-Name {{ .ingress_entry }}
|
header_up X-Script-Name {{ .ingress_entry }}
|
||||||
trusted_proxies 172.30.32.2
|
trusted_proxies 172.30.32.2
|
||||||
# header_up -Origin
|
|
||||||
# header_up Origin 172.30.32.2
|
|
||||||
# header_up X-Forwarded-For 172.30.32.2
|
|
||||||
# header_up X-Scheme {scheme}
|
|
||||||
# flush_interval -1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
# :8099 {
|
||||||
|
# @ingress {
|
||||||
|
# remote_ip 172.30.32.2
|
||||||
|
# }
|
||||||
|
# uri strip_prefix {{ .ingress_entry }}
|
||||||
|
#
|
||||||
|
# handle_path /camera/* {
|
||||||
|
# reverse_proxy @ingress {{ .camera_host }} {
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# handle {
|
||||||
|
# {{ if eq .mode "camera" }}
|
||||||
|
# reverse_proxy @ingress {{ .camera_host }} {
|
||||||
|
# trusted_proxies 172.30.32.2
|
||||||
|
# }
|
||||||
|
# {{ else if eq .mode "recovery" }}
|
||||||
|
# rewrite / /recovery
|
||||||
|
# {{ else if eq .mode "reverse_proxy_test" }}
|
||||||
|
# rewrite / /reverse_proxy_test
|
||||||
|
# {{ end }}
|
||||||
|
# reverse_proxy @ingress 127.0.0.1:80 {
|
||||||
|
# header_up X-Script-Name {{ .ingress_entry }}
|
||||||
|
# trusted_proxies 172.30.32.2
|
||||||
|
# # header_up -Origin
|
||||||
|
# # header_up Origin 172.30.32.2
|
||||||
|
# # header_up X-Forwarded-For 172.30.32.2
|
||||||
|
# # header_up X-Scheme {scheme}
|
||||||
|
# # flush_interval -1
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
#
|
||||||
Loading…
Reference in New Issue
Block a user