Split templates into direct/ingress
This commit is contained in:
parent
dda6ce10a6
commit
b5d54f583f
@ -1,5 +1,6 @@
|
||||
- 2022.12.0
|
||||
- Minor updates.
|
||||
- 2022.12.01
|
||||
- Use separate templates for Caddy Ingress/direct config.
|
||||
- Add mode for camera (for testing).
|
||||
|
||||
- 2022.11.01
|
||||
- Add reverse proxy config for camera with Ingress (untested).
|
||||
|
||||
@ -29,7 +29,7 @@ RUN apt update \
|
||||
build-essential \
|
||||
caddy \
|
||||
# Extras.
|
||||
# ffmpeg \
|
||||
ffmpeg \
|
||||
# avrdude \
|
||||
# dfu-util \
|
||||
# dfu-programmer \
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: "3DPrinter-OctoPrint"
|
||||
version: "2022.12.0"
|
||||
version: "2022.12.01"
|
||||
slug: "3dprinter-octoprint"
|
||||
description: "OctoPrint as an addon, no additional bells and whistles."
|
||||
url: "https://github.com/fredrikbaberg/home-assistant-addons/tree/main/3dprinter-octoprint"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# This file is a placeholder and will be replaced on launch.
|
||||
# Main Caddy configuration file. Config for Ingress/direct will be stored in subfiles.
|
||||
{
|
||||
debug
|
||||
log {
|
||||
@ -6,4 +6,4 @@
|
||||
output file /var/log/caddy/caddy.log
|
||||
}
|
||||
}
|
||||
# import configs/*.caddy
|
||||
import configs/*.caddy
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
# Configures proxy
|
||||
# ==============================================================================
|
||||
|
||||
# Generate proxy configuration
|
||||
# Generate proxy configuration for Ingress
|
||||
bashio::var.json \
|
||||
interface "$(bashio::addon.ip_address)" \
|
||||
port "^$(bashio::addon.ingress_port)" \
|
||||
@ -12,5 +12,14 @@ bashio::var.json \
|
||||
camera_host "$(bashio::config 'camera_url')" \
|
||||
mode "$(bashio::config 'mode')" \
|
||||
| tempio \
|
||||
-template /usr/share/tempio/Caddyfile.gtpl \
|
||||
-out /etc/caddy/Caddyfile
|
||||
-template /usr/share/tempio/caddy/Caddyfile.ingress.gtpl \
|
||||
-out /etc/caddy/configs/ingress.caddy
|
||||
|
||||
# Generate proxy configuration for direct access, if enabled.
|
||||
if bashio::var.has_value "$(bashio::addon.port 5000)"; then
|
||||
bashio::var.json \
|
||||
mode "$(bashio::config 'mode')" \
|
||||
| tempio \
|
||||
-template /usr/share/tempio/caddy/Caddyfile.direct.gtpl \
|
||||
-out /etc/caddy/configs/direct.caddy
|
||||
fi
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
# OctoPrint WebUI
|
||||
:5000 {
|
||||
reverse_proxy http://127.0.0.1:80 {
|
||||
header_up X-Scheme {scheme}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
: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 }} {}
|
||||
{{ 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 }}
|
||||
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