diff --git a/3dprinter-octoprint/Dockerfile b/3dprinter-octoprint/Dockerfile index 7784f81..2c04504 100644 --- a/3dprinter-octoprint/Dockerfile +++ b/3dprinter-octoprint/Dockerfile @@ -1,6 +1,6 @@ ARG BUILD_FROM="ghcr.io/home-assistant/amd64-base-debian:bullseye" FROM ${BUILD_FROM} -ARG OCTOPRINT_VERSION="1.8.2" +ARG OCTOPRINT_VERSION="1.8.0" ENV OCTOPRINT_VERSION=${OCTOPRINT_VERSION} diff --git a/3dprinter-octoprint/config.yaml b/3dprinter-octoprint/config.yaml index 0237e28..e65eae3 100644 --- a/3dprinter-octoprint/config.yaml +++ b/3dprinter-octoprint/config.yaml @@ -1,5 +1,5 @@ name: "3DPrinter-OctoPrint" -version: "2022.9.031" +version: "2022.9.032" 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" diff --git a/3dprinter-octoprint/rootfs/etc/caddy/Caddyfile b/3dprinter-octoprint/rootfs/etc/caddy/Caddyfile index 904dce3..cba030d 100644 --- a/3dprinter-octoprint/rootfs/etc/caddy/Caddyfile +++ b/3dprinter-octoprint/rootfs/etc/caddy/Caddyfile @@ -1,4 +1,5 @@ { + debug log { format console } diff --git a/3dprinter-octoprint/rootfs/etc/cont-init.d/octoprint.sh b/3dprinter-octoprint/rootfs/etc/cont-init.d/octoprint.sh index b3f31cd..6087224 100644 --- a/3dprinter-octoprint/rootfs/etc/cont-init.d/octoprint.sh +++ b/3dprinter-octoprint/rootfs/etc/cont-init.d/octoprint.sh @@ -4,10 +4,10 @@ # s6-overlay docs: https://github.com/just-containers/s6-overlay # ============================================================================== -{ # Check if OctoPrint is installed +{ # Check if OctoPrint is installed. octoprint --version -} || { # Otherwise install - { # Check if Python is available at `/data/python/octoprint` according to PATH) +} || { # Otherwise install it. + { # Check if Python is available (at `/data/python/octoprint` according to PATH) python --version } || { # Otherwise create Python virtual environment. python3 -m venv /data/python/octoprint @@ -15,23 +15,26 @@ pip install wheel } 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. if [ ! -f /data/config/octoprint/config.yaml ]; then if [ -f /root/config/octoprint/config.yaml ]; then 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" else bashio::log.warning "Default OctoPrint config not found" fi fi -{ # Make sure Ingress user for OctoPrint exists. - bashio::log.notice "Ensure Ingress user (homeassistant) exist." - new_password=$(date +%s | sha256sum | base64 | head -c 32 ; echo) - octoprint --basedir /data/config/octoprint user add homeassistant --password "$new_password" --group users --group admins # 2> /dev/null -} || { # catch - bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch." -} +# TODO: Check if user exists before setting password. +# { # Make sure Ingress user for OctoPrint exists. +# bashio::log.notice "Ensure Ingress user (homeassistant) exist." +# new_password=$(date +%s | sha256sum | base64 | head -c 32 ; echo) +# octoprint --basedir /data/config/octoprint user add homeassistant --password "$new_password" --group users --group admins # 2> /dev/null +# } || { # catch +# bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch." +# } diff --git a/3dprinter-octoprint/rootfs/etc/services.d/octoprint/run b/3dprinter-octoprint/rootfs/etc/services.d/octoprint/run index 5f63fc5..224c4c1 100644 --- a/3dprinter-octoprint/rootfs/etc/services.d/octoprint/run +++ b/3dprinter-octoprint/rootfs/etc/services.d/octoprint/run @@ -4,5 +4,7 @@ # Runs OctoPrint # ============================================================================== +bashio::log.info "Starting OctoPrint..." + ## Run your program exec octoprint serve --iknowwhatimdoing --host 127.0.0.1 --port 5000 --basedir /data/config/octoprint diff --git a/3dprinter-octoprint/rootfs/etc/services.d/proxy/run b/3dprinter-octoprint/rootfs/etc/services.d/proxy/run index c0e1baf..6be8d30 100644 --- a/3dprinter-octoprint/rootfs/etc/services.d/proxy/run +++ b/3dprinter-octoprint/rootfs/etc/services.d/proxy/run @@ -9,5 +9,4 @@ bashio::net.wait_for 5000 bashio::log.info "Starting proxy..." -# exec caddy run --config /etc/caddy/Caddyfile exec caddy run --config /etc/caddy/Caddyfile --envfile /etc/caddy/env diff --git a/3dprinter-octoprint/rootfs/usr/share/tempio/Caddyfile.direct.gtpl b/3dprinter-octoprint/rootfs/usr/share/tempio/Caddyfile.direct.gtpl index 06f1f41..1f6971e 100644 --- a/3dprinter-octoprint/rootfs/usr/share/tempio/Caddyfile.direct.gtpl +++ b/3dprinter-octoprint/rootfs/usr/share/tempio/Caddyfile.direct.gtpl @@ -4,12 +4,3 @@ header_up X-Scheme {scheme} } } - -# Camera -:8000 { - reverse_proxy http://127.0.0.1:8080 { - header_up X-Scheme {scheme} - } -} - -# Moonraker - expose as-is. \ No newline at end of file