Use single file for Caddy
This commit is contained in:
parent
dcc0a21404
commit
9f80b8afa5
@ -1,5 +1,5 @@
|
|||||||
name: "3DPrinter-OctoPrint"
|
name: "3DPrinter-OctoPrint"
|
||||||
version: "2022.9.033"
|
version: "2022.10.0"
|
||||||
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"
|
||||||
@ -30,4 +30,3 @@ schema:
|
|||||||
camera_url: "url?"
|
camera_url: "url?"
|
||||||
recovery: "bool"
|
recovery: "bool"
|
||||||
tmpfs: true
|
tmpfs: true
|
||||||
image: ghcr.io/fredrikbaberg/addon-3dprinter-octoprint-{arch}
|
|
||||||
@ -2,6 +2,7 @@
|
|||||||
debug
|
debug
|
||||||
log {
|
log {
|
||||||
format console
|
format console
|
||||||
|
output file /var/log/caddy.log
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
import configs/*.caddy
|
import configs/*.caddy
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
{ # Check if OctoPrint is installed.
|
{ # Check if OctoPrint is installed.
|
||||||
octoprint --version
|
octoprint -b /data/config/octoprint --version
|
||||||
} || { # Otherwise install it.
|
} || { # Otherwise install it.
|
||||||
{ # Check if Python is available (at `/data/python/octoprint` according to PATH)
|
{ # Check if Python is available (at `/data/python/octoprint` according to PATH)
|
||||||
python --version
|
python --version
|
||||||
@ -15,15 +15,13 @@
|
|||||||
pip install wheel
|
pip install wheel
|
||||||
}
|
}
|
||||||
pip install octoprint==$OCTOPRINT_VERSION
|
pip install octoprint==$OCTOPRINT_VERSION
|
||||||
# Temporary bugfix, to be removed after 1.8.5 is released.
|
|
||||||
sed -i 's+//,+//g,+g' /data/python/octoprint/lib/python3.9/site-packages/octoprint/static/js/app/client/base.js
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Copy OctoPrint config to persistent storage, if missing.
|
# Copy OctoPrint config to persistent storage, if missing.
|
||||||
if [ ! -f /data/config/octoprint/config.yaml ]; then
|
if [ ! -f /data/config/octoprint/config.yaml ]; then
|
||||||
if [ -f /root/config/octoprint/config.yaml ]; then
|
if [ -f /root/config/octoprint/config.yaml ]; then
|
||||||
mkdir -p /data/config/octoprint
|
mkdir -p /data/config/octoprint
|
||||||
# cp /root/config/octoprint/config.yaml /data/config/octoprint/config.yaml
|
cp /root/config/octoprint/config.yaml /data/config/octoprint/config.yaml
|
||||||
bashio::log.notice "Default OctoPrint config copied"
|
bashio::log.notice "Default OctoPrint config copied"
|
||||||
else
|
else
|
||||||
bashio::log.warning "Default OctoPrint config not found"
|
bashio::log.warning "Default OctoPrint config not found"
|
||||||
|
|||||||
@ -4,24 +4,13 @@
|
|||||||
# Configures proxy
|
# Configures proxy
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
mkdir -p /etc/caddy/configs
|
# Generate proxy configuration
|
||||||
|
|
||||||
# Generate Ingress configuration
|
|
||||||
bashio::var.json \
|
bashio::var.json \
|
||||||
interface "$(bashio::addon.ip_address)" \
|
interface "$(bashio::addon.ip_address)" \
|
||||||
port "^$(bashio::addon.ingress_port)" \
|
port "^$(bashio::addon.ingress_port)" \
|
||||||
|
external_port "^$(bashio::addon.port 5000)" \
|
||||||
ingress_entry "$(bashio::addon.ingress_entry)" \
|
ingress_entry "$(bashio::addon.ingress_entry)" \
|
||||||
camera_host "$(bashio::config 'camera_url')" \
|
camera_host "$(bashio::config 'camera_url')" \
|
||||||
| tempio \
|
| tempio \
|
||||||
-template /usr/share/tempio/Caddyfile.ingress.gtpl \
|
-template /usr/share/tempio/Caddyfile.gtpl \
|
||||||
-out /etc/caddy/configs/ingress.caddy
|
-out /etc/caddy/Caddyfile
|
||||||
|
|
||||||
# Generate direct access configuration, if enabled.
|
|
||||||
if bashio::var.has_value "$(bashio::addon.port 5000)"; then
|
|
||||||
bashio::var.json \
|
|
||||||
interface "$(bashio::addon.ip_address)" \
|
|
||||||
port "^$(bashio::addon.port 5000)" \
|
|
||||||
| tempio \
|
|
||||||
-template /usr/share/tempio/Caddyfile.direct.gtpl \
|
|
||||||
-out /etc/caddy/configs/direct.caddy
|
|
||||||
fi
|
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
# OctoPrint WebUI
|
|
||||||
:5000 {
|
|
||||||
reverse_proxy http://127.0.0.1:80 {
|
|
||||||
header_up X-Scheme {scheme}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,9 +1,20 @@
|
|||||||
|
{
|
||||||
|
debug
|
||||||
|
log {
|
||||||
|
format console
|
||||||
|
output file /var/log/caddy.log
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
:8099 {
|
:8099 {
|
||||||
@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 {
|
handle {
|
||||||
|
{{ if .recovery }}
|
||||||
|
rewrite / /recovery
|
||||||
|
{{ end }}
|
||||||
reverse_proxy @ingress 127.0.0.1:5000 {
|
reverse_proxy @ingress 127.0.0.1:5000 {
|
||||||
header_up X-Script-Name {{ .ingress_entry }}
|
header_up X-Script-Name {{ .ingress_entry }}
|
||||||
header_up -Origin
|
header_up -Origin
|
||||||
@ -14,3 +25,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{{ if .external_port }}
|
||||||
|
# OctoPrint WebUI
|
||||||
|
:5000 {
|
||||||
|
reverse_proxy http://127.0.0.1:5000 {
|
||||||
|
header_up X-Scheme {scheme}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{ end }}
|
||||||
Loading…
Reference in New Issue
Block a user