Cleanup for testing

This commit is contained in:
Fredrik Baberg 2022-10-06 01:39:52 +02:00
parent da180c44f4
commit 288a55963c
7 changed files with 19 additions and 23 deletions

View File

@ -1,6 +1,6 @@
ARG BUILD_FROM="ghcr.io/home-assistant/amd64-base-debian:bullseye" ARG BUILD_FROM="ghcr.io/home-assistant/amd64-base-debian:bullseye"
FROM ${BUILD_FROM} FROM ${BUILD_FROM}
ARG OCTOPRINT_VERSION="1.8.2" ARG OCTOPRINT_VERSION="1.8.0"
ENV OCTOPRINT_VERSION=${OCTOPRINT_VERSION} ENV OCTOPRINT_VERSION=${OCTOPRINT_VERSION}

View File

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

View File

@ -1,4 +1,5 @@
{ {
debug
log { log {
format console format console
} }

View File

@ -4,10 +4,10 @@
# s6-overlay docs: https://github.com/just-containers/s6-overlay # s6-overlay docs: https://github.com/just-containers/s6-overlay
# ============================================================================== # ==============================================================================
{ # Check if OctoPrint is installed { # Check if OctoPrint is installed.
octoprint --version octoprint --version
} || { # Otherwise install } || { # 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
} || { # Otherwise create Python virtual environment. } || { # Otherwise create Python virtual environment.
python3 -m venv /data/python/octoprint python3 -m venv /data/python/octoprint
@ -15,23 +15,26 @@
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"
fi fi
fi fi
{ # Make sure Ingress user for OctoPrint exists. # TODO: Check if user exists before setting password.
bashio::log.notice "Ensure Ingress user (homeassistant) exist." # { # Make sure Ingress user for OctoPrint exists.
new_password=$(date +%s | sha256sum | base64 | head -c 32 ; echo) # bashio::log.notice "Ensure Ingress user (homeassistant) exist."
octoprint --basedir /data/config/octoprint user add homeassistant --password "$new_password" --group users --group admins # 2> /dev/null # new_password=$(date +%s | sha256sum | base64 | head -c 32 ; echo)
} || { # catch # octoprint --basedir /data/config/octoprint user add homeassistant --password "$new_password" --group users --group admins # 2> /dev/null
bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch." # } || { # catch
} # bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch."
# }

View File

@ -4,5 +4,7 @@
# Runs OctoPrint # Runs OctoPrint
# ============================================================================== # ==============================================================================
bashio::log.info "Starting OctoPrint..."
## Run your program ## Run your program
exec octoprint serve --iknowwhatimdoing --host 127.0.0.1 --port 5000 --basedir /data/config/octoprint exec octoprint serve --iknowwhatimdoing --host 127.0.0.1 --port 5000 --basedir /data/config/octoprint

View File

@ -9,5 +9,4 @@ bashio::net.wait_for 5000
bashio::log.info "Starting proxy..." bashio::log.info "Starting proxy..."
# exec caddy run --config /etc/caddy/Caddyfile
exec caddy run --config /etc/caddy/Caddyfile --envfile /etc/caddy/env exec caddy run --config /etc/caddy/Caddyfile --envfile /etc/caddy/env

View File

@ -4,12 +4,3 @@
header_up X-Scheme {scheme} header_up X-Scheme {scheme}
} }
} }
# Camera
:8000 {
reverse_proxy http://127.0.0.1:8080 {
header_up X-Scheme {scheme}
}
}
# Moonraker - expose as-is.