Merge branch 'klipper_dev' of https://github.com/fredrikbaberg/ha-3dprinter-addons into klipper_dev
This commit is contained in:
@@ -1,35 +1,35 @@
|
||||
## 2024.01.2
|
||||
* Add option to pass webcam URL to proxy.
|
||||
|
||||
## 2024.01.1
|
||||
|
||||
* Maintenance release:
|
||||
* Update base image.
|
||||
* Update default OctoPrint version to 1.9.3.
|
||||
|
||||
## 2023.03.1
|
||||
* Add check that OctoPrint can install at buildtime.
|
||||
* Add missing dependency for armhf (libffi-dev)
|
||||
|
||||
## 2023.03.0
|
||||
* Mark 3DPrinter-OctoPrint stable
|
||||
* Set realtime flag
|
||||
* Enable AppArmor
|
||||
|
||||
## 2023.02.0
|
||||
* Add binaries for flashing firmware to printer (avrdude, dfu-util, dfu-programmer, stm32flash).
|
||||
|
||||
## 2023.01.2
|
||||
* Disable AppArmor profile.
|
||||
|
||||
## 2023.01.1
|
||||
* Add AppArmor profile
|
||||
* Add support for GPIO
|
||||
|
||||
## 2023.01.0
|
||||
* Update to OctoPrint 1.8.6.
|
||||
* Disabled Ingress.
|
||||
* Based on Debian instead of Alpine, should make more plugins compatible.
|
||||
* Default config now set by CLI instead of copying pre-set file.
|
||||
* Using Caddy as reverse proxy.
|
||||
* Added option to set trusted_proxies, should help with reverse proxy configuration.
|
||||
## 2024.01.2
|
||||
* Add option to pass webcam URL to proxy.
|
||||
|
||||
## 2024.01.1
|
||||
|
||||
* Maintenance release:
|
||||
* Update base image.
|
||||
* Update default OctoPrint version to 1.9.3.
|
||||
|
||||
## 2023.03.1
|
||||
* Add check that OctoPrint can install at buildtime.
|
||||
* Add missing dependency for armhf (libffi-dev)
|
||||
|
||||
## 2023.03.0
|
||||
* Mark 3DPrinter-OctoPrint stable
|
||||
* Set realtime flag
|
||||
* Enable AppArmor
|
||||
|
||||
## 2023.02.0
|
||||
* Add binaries for flashing firmware to printer (avrdude, dfu-util, dfu-programmer, stm32flash).
|
||||
|
||||
## 2023.01.2
|
||||
* Disable AppArmor profile.
|
||||
|
||||
## 2023.01.1
|
||||
* Add AppArmor profile
|
||||
* Add support for GPIO
|
||||
|
||||
## 2023.01.0
|
||||
* Update to OctoPrint 1.8.6.
|
||||
* Disabled Ingress.
|
||||
* Based on Debian instead of Alpine, should make more plugins compatible.
|
||||
* Default config now set by CLI instead of copying pre-set file.
|
||||
* Using Caddy as reverse proxy.
|
||||
* Added option to set trusted_proxies, should help with reverse proxy configuration.
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
# Startup
|
||||
|
||||
Set a network port in add-on settings to be able to access the WebUI.
|
||||
|
||||
# Add-on configuration
|
||||
|
||||
## Trusted proxies
|
||||
|
||||
*If you have placed a reverse proxy in front of Home Assistant*, by setting trusted proxies you should be able to use HTTPS. For more information, see [Caddy documentation](https://caddyserver.com/docs/caddyfile/directives/reverse_proxy).
|
||||
|
||||
## Camera URL
|
||||
|
||||
By entering a URL to a camera you can make it available at `<OctoPrint URL>/camera/`. Note that this means that anyone with access to your OctoPrint instance can access the stream (even if not signed in! https://community.octoprint.org/t/why-is-there-no-access-control-for-the-webcam-in-octoprint-why-is-my-webcam-always-on/233). **Making this secure is up to you!**
|
||||
|
||||
# OctoPrint integration
|
||||
|
||||
You can use the OctoPrint integration with this add-on. Go to Home Assistant, add integration OctoPrint, and use the following:
|
||||
- Host: `cce6f2d5-3dprinter-octoprint` (use the add-on hostname, the first part could differ).
|
||||
- port: 5000
|
||||
- Don't use SSL (leave unchecked)
|
||||
|
||||
Go to OctoPrint WebUI, you should see a request for authentication.
|
||||
|
||||
# Camera
|
||||
|
||||
This add-on does not include a camera server, that has to be installed and setup separately.
|
||||
|
||||
You could, for instance, use the add-on [camera-mjpg-streamer](https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/camera-mjpg-streamer) available in the same repository. This will work for snapshots, but not necessarily for video as the video stream has to be available by the browser/app directly, **not just the host running OctoPrint**.
|
||||
|
||||
Instead of exposing the video stream directly, you could try to use the `Camera URL` option. **Note that this is mostly untested.** In theory you should be able to:
|
||||
* Install the [camera-mjpg-streamer](https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/camera-mjpg-streamer) add-on. Start it and make sure you can see the image from the camera in that add-on.
|
||||
* In options for this add-on, set `Camera URL` to hostname of the add-on where the camera is running, e.g. `http://cce6f2d5-camera-mjpg-streamer`.
|
||||
* In OctoPrint, set:
|
||||
* `Stream URL` to `http://<octoprint URL>/camera/?action=stream`
|
||||
* `Snapshot URL` to `http://<octoprint URL>/camera/?action=snapshot`. This will make it easier to check that it works, but should later be changed to the local URL, e.g. `http://cce6f2d5-camera-mjpg-streamer/?action=snapshot`.
|
||||
|
||||
# Remote access
|
||||
|
||||
If you need remote access, have a look at [remote access plugins for OctoPrint](https://plugins.octoprint.org/topics/remote_access/). Remember to **NEVER** directly portforward your OctoPrint instance to the internet!
|
||||
# Startup
|
||||
|
||||
Set a network port in add-on settings to be able to access the WebUI.
|
||||
|
||||
# Add-on configuration
|
||||
|
||||
## Trusted proxies
|
||||
|
||||
*If you have placed a reverse proxy in front of Home Assistant*, by setting trusted proxies you should be able to use HTTPS. For more information, see [Caddy documentation](https://caddyserver.com/docs/caddyfile/directives/reverse_proxy).
|
||||
|
||||
## Camera URL
|
||||
|
||||
By entering a URL to a camera you can make it available at `<OctoPrint URL>/camera/`. Note that this means that anyone with access to your OctoPrint instance can access the stream (even if not signed in! https://community.octoprint.org/t/why-is-there-no-access-control-for-the-webcam-in-octoprint-why-is-my-webcam-always-on/233). **Making this secure is up to you!**
|
||||
|
||||
# OctoPrint integration
|
||||
|
||||
You can use the OctoPrint integration with this add-on. Go to Home Assistant, add integration OctoPrint, and use the following:
|
||||
- Host: `cce6f2d5-3dprinter-octoprint` (use the add-on hostname, the first part could differ).
|
||||
- port: 5000
|
||||
- Don't use SSL (leave unchecked)
|
||||
|
||||
Go to OctoPrint WebUI, you should see a request for authentication.
|
||||
|
||||
# Camera
|
||||
|
||||
This add-on does not include a camera server, that has to be installed and setup separately.
|
||||
|
||||
You could, for instance, use the add-on [camera-mjpg-streamer](https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/camera-mjpg-streamer) available in the same repository. This will work for snapshots, but not necessarily for video as the video stream has to be available by the browser/app directly, **not just the host running OctoPrint**.
|
||||
|
||||
Instead of exposing the video stream directly, you could try to use the `Camera URL` option. **Note that this is mostly untested.** In theory you should be able to:
|
||||
* Install the [camera-mjpg-streamer](https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/camera-mjpg-streamer) add-on. Start it and make sure you can see the image from the camera in that add-on.
|
||||
* In options for this add-on, set `Camera URL` to hostname of the add-on where the camera is running, e.g. `http://cce6f2d5-camera-mjpg-streamer`.
|
||||
* In OctoPrint, set:
|
||||
* `Stream URL` to `http://<octoprint URL>/camera/?action=stream`
|
||||
* `Snapshot URL` to `http://<octoprint URL>/camera/?action=snapshot`. This will make it easier to check that it works, but should later be changed to the local URL, e.g. `http://cce6f2d5-camera-mjpg-streamer/?action=snapshot`.
|
||||
|
||||
# Remote access
|
||||
|
||||
If you need remote access, have a look at [remote access plugins for OctoPrint](https://plugins.octoprint.org/topics/remote_access/). Remember to **NEVER** directly portforward your OctoPrint instance to the internet!
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
ARG BUILD_FROM="ghcr.io/home-assistant/amd64-base-debian:bullseye"
|
||||
FROM ${BUILD_FROM}
|
||||
ARG OCTOPRINT_VERSION="1.9.3"
|
||||
|
||||
# Setup path for persistent install of Python packages
|
||||
ENV PYTHONPATH=/data/python/octoprint
|
||||
ENV PYTHONUSERBASE=/data/python/octoprint
|
||||
ENV PATH=/data/python/octoprint/bin:${PATH}
|
||||
ENV OCTOPRINT_VERSION=${OCTOPRINT_VERSION}
|
||||
|
||||
# Preparation for install of Caddy
|
||||
RUN apt update \
|
||||
&& apt install -y \
|
||||
--no-install-recommends \
|
||||
debian-keyring \
|
||||
debian-archive-keyring \
|
||||
apt-transport-https \
|
||||
gpg \
|
||||
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg \
|
||||
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
|
||||
|
||||
# Install dependencies
|
||||
RUN apt update \
|
||||
&& apt install -y \
|
||||
--no-install-recommends \
|
||||
python3-venv \
|
||||
python3-dev \
|
||||
python3-wheel \
|
||||
build-essential \
|
||||
caddy \
|
||||
libffi-dev \
|
||||
# Extras.
|
||||
ffmpeg \
|
||||
avrdude \
|
||||
dfu-util \
|
||||
dfu-programmer \
|
||||
stm32flash \
|
||||
# Development/testing
|
||||
vim \
|
||||
&& \
|
||||
apt clean
|
||||
|
||||
# Copy root filesystem
|
||||
COPY rootfs /
|
||||
RUN chmod +x /etc/cont-init.d/*.sh
|
||||
RUN chmod +x /etc/services.d/*/*
|
||||
RUN chmod +x /scripts/*.sh
|
||||
|
||||
# Test install, verify that install will be possible.
|
||||
RUN sed 's/#!/# #!/' /etc/cont-init.d/octoprint.sh > /tmp/octoprint.sh
|
||||
RUN bash /tmp/octoprint.sh \
|
||||
&& rm -rf /data/* /tmp/*
|
||||
ARG BUILD_FROM="ghcr.io/home-assistant/amd64-base-debian:bullseye"
|
||||
FROM ${BUILD_FROM}
|
||||
ARG OCTOPRINT_VERSION="1.9.3"
|
||||
|
||||
# Setup path for persistent install of Python packages
|
||||
ENV PYTHONPATH=/data/python/octoprint
|
||||
ENV PYTHONUSERBASE=/data/python/octoprint
|
||||
ENV PATH=/data/python/octoprint/bin:${PATH}
|
||||
ENV OCTOPRINT_VERSION=${OCTOPRINT_VERSION}
|
||||
|
||||
# Preparation for install of Caddy
|
||||
RUN apt update \
|
||||
&& apt install -y \
|
||||
--no-install-recommends \
|
||||
debian-keyring \
|
||||
debian-archive-keyring \
|
||||
apt-transport-https \
|
||||
gpg \
|
||||
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg \
|
||||
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
|
||||
|
||||
# Install dependencies
|
||||
RUN apt update \
|
||||
&& apt install -y \
|
||||
--no-install-recommends \
|
||||
python3-venv \
|
||||
python3-dev \
|
||||
python3-wheel \
|
||||
build-essential \
|
||||
caddy \
|
||||
libffi-dev \
|
||||
# Extras.
|
||||
ffmpeg \
|
||||
avrdude \
|
||||
dfu-util \
|
||||
dfu-programmer \
|
||||
stm32flash \
|
||||
# Development/testing
|
||||
vim \
|
||||
&& \
|
||||
apt clean
|
||||
|
||||
# Copy root filesystem
|
||||
COPY rootfs /
|
||||
RUN chmod +x /etc/cont-init.d/*.sh
|
||||
RUN chmod +x /etc/services.d/*/*
|
||||
RUN chmod +x /scripts/*.sh
|
||||
|
||||
# Test install, verify that install will be possible.
|
||||
RUN sed 's/#!/# #!/' /etc/cont-init.d/octoprint.sh > /tmp/octoprint.sh
|
||||
RUN bash /tmp/octoprint.sh \
|
||||
&& rm -rf /data/* /tmp/*
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# 3DPrinter-OctoPrint
|
||||
|
||||
Provides OctoPrint as an addon to Home Assistant.
|
||||
|
||||
## Instructions
|
||||
|
||||
Set a network port in addon settings.
|
||||
|
||||
For more details, see the Documentation tab.
|
||||
# 3DPrinter-OctoPrint
|
||||
|
||||
Provides OctoPrint as an addon to Home Assistant.
|
||||
|
||||
## Instructions
|
||||
|
||||
Set a network port in addon settings.
|
||||
|
||||
For more details, see the Documentation tab.
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
#include <tunables/global>
|
||||
|
||||
profile 3dprinter-octoprint flags=(attach_disconnected,mediate_deleted) {
|
||||
#include <abstractions/base>
|
||||
|
||||
# Capabilities
|
||||
file,
|
||||
signal (send) set=(kill,term,int,hup,cont),
|
||||
|
||||
# S6-Overlay
|
||||
/init ix,
|
||||
/bin/** ix,
|
||||
/usr/bin/** ix,
|
||||
/run/{s6,s6-rc*,service}/** ix,
|
||||
/package/** ix,
|
||||
/command/** ix,
|
||||
/etc/services.d/** rwix,
|
||||
/etc/cont-init.d/** rwix,
|
||||
/etc/cont-finish.d/** rwix,
|
||||
/run/{,**} rwk,
|
||||
/dev/tty rw,
|
||||
|
||||
# Bashio
|
||||
/usr/lib/bashio/** ix,
|
||||
/tmp/** rwk,
|
||||
|
||||
# Access to options.json and other files within your addon
|
||||
/data/** rw,
|
||||
|
||||
# Start new profile for service
|
||||
/usr/bin/caddy cx -> caddy,
|
||||
|
||||
profile caddy flags=(attach_disconnected,mediate_deleted) {
|
||||
#include <abstractions/base>
|
||||
|
||||
# Receive signals from S6-Overlay
|
||||
signal (receive) peer=*_3dprinter-octoprint,
|
||||
|
||||
capability dac_override,
|
||||
|
||||
owner /usr/bin/caddy rm,
|
||||
@{HOME}/.step/ w,
|
||||
@{PROC}/*/cpuset r,
|
||||
@{PROC}/sys/net/** r,
|
||||
|
||||
/etc/** r,
|
||||
owner /etc/caddy/ kwr,
|
||||
owner /etc/caddy/** kwrml,
|
||||
|
||||
/var/log/caddy/ r,
|
||||
owner /var/log/caddy/ kwr,
|
||||
owner /var/log/caddy/** kwrml,
|
||||
|
||||
owner /data/config/caddy/ kwr,
|
||||
owner /data/config/caddy/** kwrml,
|
||||
}
|
||||
#include <tunables/global>
|
||||
|
||||
profile 3dprinter-octoprint flags=(attach_disconnected,mediate_deleted) {
|
||||
#include <abstractions/base>
|
||||
|
||||
# Capabilities
|
||||
file,
|
||||
signal (send) set=(kill,term,int,hup,cont),
|
||||
|
||||
# S6-Overlay
|
||||
/init ix,
|
||||
/bin/** ix,
|
||||
/usr/bin/** ix,
|
||||
/run/{s6,s6-rc*,service}/** ix,
|
||||
/package/** ix,
|
||||
/command/** ix,
|
||||
/etc/services.d/** rwix,
|
||||
/etc/cont-init.d/** rwix,
|
||||
/etc/cont-finish.d/** rwix,
|
||||
/run/{,**} rwk,
|
||||
/dev/tty rw,
|
||||
|
||||
# Bashio
|
||||
/usr/lib/bashio/** ix,
|
||||
/tmp/** rwk,
|
||||
|
||||
# Access to options.json and other files within your addon
|
||||
/data/** rw,
|
||||
|
||||
# Start new profile for service
|
||||
/usr/bin/caddy cx -> caddy,
|
||||
|
||||
profile caddy flags=(attach_disconnected,mediate_deleted) {
|
||||
#include <abstractions/base>
|
||||
|
||||
# Receive signals from S6-Overlay
|
||||
signal (receive) peer=*_3dprinter-octoprint,
|
||||
|
||||
capability dac_override,
|
||||
|
||||
owner /usr/bin/caddy rm,
|
||||
@{HOME}/.step/ w,
|
||||
@{PROC}/*/cpuset r,
|
||||
@{PROC}/sys/net/** r,
|
||||
|
||||
/etc/** r,
|
||||
owner /etc/caddy/ kwr,
|
||||
owner /etc/caddy/** kwrml,
|
||||
|
||||
/var/log/caddy/ r,
|
||||
owner /var/log/caddy/ kwr,
|
||||
owner /var/log/caddy/** kwrml,
|
||||
|
||||
owner /data/config/caddy/ kwr,
|
||||
owner /data/config/caddy/** kwrml,
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
build_from:
|
||||
aarch64: ghcr.io/home-assistant/aarch64-base-debian:bullseye
|
||||
amd64: ghcr.io/home-assistant/amd64-base-debian:bullseye
|
||||
armhf: ghcr.io/home-assistant/armhf-base-debian:bullseye
|
||||
armv7: ghcr.io/home-assistant/armv7-base-debian:bullseye
|
||||
labels:
|
||||
org.opencontainers.image.title: "Home Assistant Add-on: 3DPrinter-OctoPrint"
|
||||
org.opencontainers.image.description: "3DPrinter-OctoPrint addon for Home-Assistant."
|
||||
org.opencontainers.image.source: "https://github.com/fredrikbaberg/ha-3dprinter-addons"
|
||||
args:
|
||||
OCTOPRINT_VERSION: "1.9.3"
|
||||
build_from:
|
||||
aarch64: ghcr.io/home-assistant/aarch64-base-debian:bullseye
|
||||
amd64: ghcr.io/home-assistant/amd64-base-debian:bullseye
|
||||
armhf: ghcr.io/home-assistant/armhf-base-debian:bullseye
|
||||
armv7: ghcr.io/home-assistant/armv7-base-debian:bullseye
|
||||
labels:
|
||||
org.opencontainers.image.title: "Home Assistant Add-on: 3DPrinter-OctoPrint"
|
||||
org.opencontainers.image.description: "3DPrinter-OctoPrint addon for Home-Assistant."
|
||||
org.opencontainers.image.source: "https://github.com/fredrikbaberg/ha-3dprinter-addons"
|
||||
args:
|
||||
OCTOPRINT_VERSION: "1.9.3"
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
name: "3DPrinter-OctoPrint"
|
||||
version: "2024.01.2"
|
||||
slug: "3dprinter-octoprint"
|
||||
description: "OctoPrint as an addon, no additional bells and whistles."
|
||||
arch:
|
||||
- armv7
|
||||
- amd64
|
||||
- armhf
|
||||
- aarch64
|
||||
url: "https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/3dprinter-octoprint"
|
||||
webui: http://[HOST]:[PORT:5000]
|
||||
ports:
|
||||
5000/tcp: null
|
||||
ports_description:
|
||||
5000/tcp: Web-based interface
|
||||
devices:
|
||||
- "/dev/i2c-0"
|
||||
- "/dev/i2c-1"
|
||||
gpio: true
|
||||
usb: true
|
||||
uart: true
|
||||
options:
|
||||
trusted_proxies: ""
|
||||
camera_url: ""
|
||||
schema:
|
||||
trusted_proxies: "str?"
|
||||
camera_url: "str?"
|
||||
image: ghcr.io/fredrikbaberg/ha-addon-3dprinter-octoprint-{arch}
|
||||
tmpfs: true
|
||||
panel_icon: mdi:printer-3d
|
||||
panel_title: 3DPrinter-OctoPrint
|
||||
init: false
|
||||
realtime: true
|
||||
name: "3DPrinter-OctoPrint"
|
||||
version: "2024.01.2"
|
||||
slug: "3dprinter-octoprint"
|
||||
description: "OctoPrint as an addon, no additional bells and whistles."
|
||||
arch:
|
||||
- armv7
|
||||
- amd64
|
||||
- armhf
|
||||
- aarch64
|
||||
url: "https://github.com/fredrikbaberg/ha-3dprinter-addons/tree/main/3dprinter-octoprint"
|
||||
webui: http://[HOST]:[PORT:5000]
|
||||
ports:
|
||||
5000/tcp: null
|
||||
ports_description:
|
||||
5000/tcp: Web-based interface
|
||||
devices:
|
||||
- "/dev/i2c-0"
|
||||
- "/dev/i2c-1"
|
||||
gpio: true
|
||||
usb: true
|
||||
uart: true
|
||||
options:
|
||||
trusted_proxies: ""
|
||||
camera_url: ""
|
||||
schema:
|
||||
trusted_proxies: "str?"
|
||||
camera_url: "str?"
|
||||
image: ghcr.io/fredrikbaberg/ha-addon-3dprinter-octoprint-{arch}
|
||||
tmpfs: true
|
||||
panel_icon: mdi:printer-3d
|
||||
panel_title: 3DPrinter-OctoPrint
|
||||
init: false
|
||||
realtime: true
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
# debug
|
||||
log {
|
||||
format console
|
||||
output file /var/log/caddy/caddy.log
|
||||
}
|
||||
auto_https disable_redirects
|
||||
}
|
||||
|
||||
import sites-enabled/*.caddy
|
||||
{
|
||||
# debug
|
||||
log {
|
||||
format console
|
||||
output file /var/log/caddy/caddy.log
|
||||
}
|
||||
auto_https disable_redirects
|
||||
}
|
||||
|
||||
import sites-enabled/*.caddy
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
XDG_CONFIG_HOME="/data/config"
|
||||
XDG_DATA_HOME="/data/config"
|
||||
XDG_CONFIG_HOME="/data/config"
|
||||
XDG_DATA_HOME="/data/config"
|
||||
|
||||
@@ -1,54 +1,54 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Prepare OctoPrint
|
||||
# s6-overlay docs: https://github.com/just-containers/s6-overlay
|
||||
# ==============================================================================
|
||||
export BASEDIR="--basedir /data/config/octoprint"
|
||||
|
||||
{ # Check if OctoPrint is installed.
|
||||
octoprint $BASEDIR --version
|
||||
} || { # Otherwise install it.
|
||||
{ # Check if Python is available (at `/data/python/octoprint`, set by PATH in Dockerfile)
|
||||
python --version
|
||||
} || { # Otherwise create Python virtual environment.
|
||||
python3 -m venv /data/python/octoprint
|
||||
# Install wheel to speed up future installs.
|
||||
pip install wheel
|
||||
}
|
||||
pip install octoprint==$OCTOPRINT_VERSION
|
||||
}
|
||||
|
||||
# Create initial OctoPrint config, if missing.
|
||||
if [ ! -f /data/config/octoprint/config.yaml ]; then
|
||||
mkdir -p /data/config/octoprint
|
||||
fi
|
||||
|
||||
# Update OctoPrint config with settings for the addon to behave properly.
|
||||
updateConfig()
|
||||
{
|
||||
# octoprint $BASEDIR config set --bool api.allowCrossOrigin true
|
||||
octoprint $BASEDIR config set folder.generated "/tmp/octoprint/generated"
|
||||
octoprint $BASEDIR config set folder.timelapse_tmp "/tmp/octoprint/timelapse/tmp"
|
||||
# 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.systemRestartCommand "/scripts/system_restart.sh"
|
||||
octoprint $BASEDIR config set server.commands.systemShutdownCommand "/scripts/system_shutdown.sh"
|
||||
octoprint $BASEDIR config set webcam.ffmpeg "/usr/bin/ffmpeg"
|
||||
}
|
||||
updateConfig
|
||||
|
||||
# Other setting changes, if needed. E.g. creating a user.
|
||||
# Update OctoPrint config with customized settings, not strictly required for addon to work but helps with features.
|
||||
# updateConfigCustom() {
|
||||
# Add user, if needed.
|
||||
# { # Make sure Ingress user for OctoPrint exists.
|
||||
# bashio::log.notice "Ensure Ingress user (homeassistant) exist."
|
||||
# if ! octoprint --basedir /data/config/octoprint user list | grep -q 'homeassistant'; then
|
||||
# new_password=$(date +%s | sha256sum | base64 | head -c 32 ; echo)
|
||||
# octoprint --basedir /data/config/octoprint user add --password "$new_password" --admin homeassistant # 2> /dev/null
|
||||
# fi
|
||||
# } || { # catch
|
||||
# bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch."
|
||||
# }
|
||||
# Trusted networks, access control etc.
|
||||
# }
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Prepare OctoPrint
|
||||
# s6-overlay docs: https://github.com/just-containers/s6-overlay
|
||||
# ==============================================================================
|
||||
export BASEDIR="--basedir /data/config/octoprint"
|
||||
|
||||
{ # Check if OctoPrint is installed.
|
||||
octoprint $BASEDIR --version
|
||||
} || { # Otherwise install it.
|
||||
{ # Check if Python is available (at `/data/python/octoprint`, set by PATH in Dockerfile)
|
||||
python --version
|
||||
} || { # Otherwise create Python virtual environment.
|
||||
python3 -m venv /data/python/octoprint
|
||||
# Install wheel to speed up future installs.
|
||||
pip install wheel
|
||||
}
|
||||
pip install octoprint==$OCTOPRINT_VERSION
|
||||
}
|
||||
|
||||
# Create initial OctoPrint config, if missing.
|
||||
if [ ! -f /data/config/octoprint/config.yaml ]; then
|
||||
mkdir -p /data/config/octoprint
|
||||
fi
|
||||
|
||||
# Update OctoPrint config with settings for the addon to behave properly.
|
||||
updateConfig()
|
||||
{
|
||||
# octoprint $BASEDIR config set --bool api.allowCrossOrigin true
|
||||
octoprint $BASEDIR config set folder.generated "/tmp/octoprint/generated"
|
||||
octoprint $BASEDIR config set folder.timelapse_tmp "/tmp/octoprint/timelapse/tmp"
|
||||
# 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.systemRestartCommand "/scripts/system_restart.sh"
|
||||
octoprint $BASEDIR config set server.commands.systemShutdownCommand "/scripts/system_shutdown.sh"
|
||||
octoprint $BASEDIR config set webcam.ffmpeg "/usr/bin/ffmpeg"
|
||||
}
|
||||
updateConfig
|
||||
|
||||
# Other setting changes, if needed. E.g. creating a user.
|
||||
# Update OctoPrint config with customized settings, not strictly required for addon to work but helps with features.
|
||||
# updateConfigCustom() {
|
||||
# Add user, if needed.
|
||||
# { # Make sure Ingress user for OctoPrint exists.
|
||||
# bashio::log.notice "Ensure Ingress user (homeassistant) exist."
|
||||
# if ! octoprint --basedir /data/config/octoprint user list | grep -q 'homeassistant'; then
|
||||
# new_password=$(date +%s | sha256sum | base64 | head -c 32 ; echo)
|
||||
# octoprint --basedir /data/config/octoprint user add --password "$new_password" --admin homeassistant # 2> /dev/null
|
||||
# fi
|
||||
# } || { # catch
|
||||
# bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch."
|
||||
# }
|
||||
# Trusted networks, access control etc.
|
||||
# }
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Add-on: 3dprinter-octoprint
|
||||
# Configures proxy
|
||||
# ==============================================================================
|
||||
|
||||
# Generate proxy configuration for internal and external access
|
||||
bashio::var.json \
|
||||
addon_hostname "$(bashio::addon.hostname)" \
|
||||
addon_ip "$(bashio::addon.ip_address)" \
|
||||
trusted_proxies "$(bashio::config 'trusted_proxies')" \
|
||||
camera_url "$(bashio::config 'camera_url')" \
|
||||
| tempio \
|
||||
-template /usr/share/tempio/caddy/Caddyfile.internal_external.gtpl \
|
||||
-out /etc/caddy/sites-enabled/internal_external.caddy
|
||||
|
||||
# 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)" \
|
||||
# ingress_port "^$(bashio::addon.ingress_port)" \
|
||||
# interface "$(bashio::addon.ip_address)" \
|
||||
# mode "$(bashio::config 'mode')" \
|
||||
# supervisor_ip "$(bashio::supervisor.ip_address)" \
|
||||
# trusted_proxies "$(bashio::config 'trusted_proxies')" \
|
||||
# | tempio \
|
||||
# -template /usr/share/tempio/caddy/Caddyfile.ingress.gtpl \
|
||||
# -out /etc/caddy/sites-enabled/ingress.caddy
|
||||
|
||||
|
||||
# Make sure config is correctly formatted.
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Add-on: 3dprinter-octoprint
|
||||
# Configures proxy
|
||||
# ==============================================================================
|
||||
|
||||
# Generate proxy configuration for internal and external access
|
||||
bashio::var.json \
|
||||
addon_hostname "$(bashio::addon.hostname)" \
|
||||
addon_ip "$(bashio::addon.ip_address)" \
|
||||
trusted_proxies "$(bashio::config 'trusted_proxies')" \
|
||||
camera_url "$(bashio::config 'camera_url')" \
|
||||
| tempio \
|
||||
-template /usr/share/tempio/caddy/Caddyfile.internal_external.gtpl \
|
||||
-out /etc/caddy/sites-enabled/internal_external.caddy
|
||||
|
||||
# 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)" \
|
||||
# ingress_port "^$(bashio::addon.ingress_port)" \
|
||||
# interface "$(bashio::addon.ip_address)" \
|
||||
# mode "$(bashio::config 'mode')" \
|
||||
# supervisor_ip "$(bashio::supervisor.ip_address)" \
|
||||
# trusted_proxies "$(bashio::config 'trusted_proxies')" \
|
||||
# | tempio \
|
||||
# -template /usr/share/tempio/caddy/Caddyfile.ingress.gtpl \
|
||||
# -out /etc/caddy/sites-enabled/ingress.caddy
|
||||
|
||||
|
||||
# Make sure config is correctly formatted.
|
||||
caddy fmt --overwrite /etc/caddy/Caddyfile
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Add-on: 3dprinter-octoprint
|
||||
# Take down the S6 supervision tree when OctoPrint fails
|
||||
# ==============================================================================
|
||||
|
||||
# if -n { s6-test $# -ne 0 }
|
||||
# if -n { s6-test ${1} -eq 256 }
|
||||
|
||||
# s6-svscanctl -t /var/run/s6/services
|
||||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Add-on: 3dprinter-octoprint
|
||||
# Take down the S6 supervision tree when OctoPrint fails
|
||||
# ==============================================================================
|
||||
|
||||
# if -n { s6-test $# -ne 0 }
|
||||
# if -n { s6-test ${1} -eq 256 }
|
||||
|
||||
# s6-svscanctl -t /var/run/s6/services
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Add-on: 3dprinter-octoprint
|
||||
# Runs OctoPrint
|
||||
# ==============================================================================
|
||||
|
||||
bashio::log.info "Starting OctoPrint..."
|
||||
|
||||
## Run your program
|
||||
exec octoprint --basedir /data/config/octoprint serve --iknowwhatimdoing --host 127.0.0.1 --port 80
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Add-on: 3dprinter-octoprint
|
||||
# Runs OctoPrint
|
||||
# ==============================================================================
|
||||
|
||||
bashio::log.info "Starting OctoPrint..."
|
||||
|
||||
## Run your program
|
||||
exec octoprint --basedir /data/config/octoprint serve --iknowwhatimdoing --host 127.0.0.1 --port 80
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Add-on: 3dprinter-octoprint
|
||||
# Stop reverse proxy
|
||||
# ==============================================================================
|
||||
#!/usr/bin/execlineb -S0
|
||||
# ==============================================================================
|
||||
# Add-on: 3dprinter-octoprint
|
||||
# Stop reverse proxy
|
||||
# ==============================================================================
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Add-on: 3dprinter-octoprint
|
||||
# Runs the reverse proxy.
|
||||
# ==============================================================================
|
||||
|
||||
# Wait for OctoPrint WebUI to be available
|
||||
bashio::net.wait_for 80
|
||||
|
||||
bashio::log.info "Starting proxy..."
|
||||
|
||||
exec caddy run --config /etc/caddy/Caddyfile --envfile /etc/caddy/env
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Add-on: 3dprinter-octoprint
|
||||
# Runs the reverse proxy.
|
||||
# ==============================================================================
|
||||
|
||||
# Wait for OctoPrint WebUI to be available
|
||||
bashio::net.wait_for 80
|
||||
|
||||
bashio::log.info "Starting proxy..."
|
||||
|
||||
exec caddy run --config /etc/caddy/Caddyfile --envfile /etc/caddy/env
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
bashio::log.warning "Restart OctoPrint."
|
||||
|
||||
s6-svc -r /var/run/s6/legacy-services/octoprint
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
bashio::log.warning "Restart OctoPrint."
|
||||
|
||||
s6-svc -r /var/run/s6/legacy-services/octoprint
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
bashio::log.warning "Restart proxy."
|
||||
|
||||
s6-svc -r /var/run/s6/legacy-services/proxy
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
bashio::log.warning "Restart proxy."
|
||||
|
||||
s6-svc -r /var/run/s6/legacy-services/proxy
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
# #!/usr/bin/bash
|
||||
# # Set/update parts of OctoPrint config to work with addon.
|
||||
|
||||
# export OCTOPRINT_HOME=/data/config/octoprint
|
||||
|
||||
# # Access control
|
||||
# octoprint -b $OCTOPRINT_HOME config set --json accessControl '
|
||||
# {
|
||||
# "localNetworks": [
|
||||
# "127.0.0.0/8",
|
||||
# "::1/128",
|
||||
# "172.30.32.2"
|
||||
# ]
|
||||
# }
|
||||
# '
|
||||
|
||||
# # API config
|
||||
# octoprint -b $OCTOPRINT_HOME config set --json api '
|
||||
# {
|
||||
# "allowCrossOrigin": true
|
||||
# }
|
||||
# '
|
||||
|
||||
# # Folder config
|
||||
# octoprint -b $OCTOPRINT_HOME config set --json folder '
|
||||
# {
|
||||
# "generated": "/tmp/octoprint/generated",
|
||||
# "timelapse_tmp": "/tmp/octoprint/timelapse/tmp"
|
||||
# }
|
||||
# '
|
||||
|
||||
# # Server config
|
||||
# octoprint -b $OCTOPRINT_HOME config set --json server '
|
||||
# {
|
||||
# "allowFraming": true,
|
||||
# "commands": {
|
||||
# "serverRestartCommand": "/scripts/octoprint_restart.sh",
|
||||
# "systemRestartCommand": "/scripts/system_restart.sh",
|
||||
# "systemShutdownCommand": "/scripts/system_shutdown.sh"
|
||||
# }
|
||||
# }
|
||||
# '
|
||||
# # Webcam config
|
||||
# octoprint -b $OCTOPRINT_HOME config set --json webcam '
|
||||
# {
|
||||
# "ffmpeg": "/usr/bin/ffmpeg"
|
||||
# }
|
||||
# #!/usr/bin/bash
|
||||
# # Set/update parts of OctoPrint config to work with addon.
|
||||
|
||||
# export OCTOPRINT_HOME=/data/config/octoprint
|
||||
|
||||
# # Access control
|
||||
# octoprint -b $OCTOPRINT_HOME config set --json accessControl '
|
||||
# {
|
||||
# "localNetworks": [
|
||||
# "127.0.0.0/8",
|
||||
# "::1/128",
|
||||
# "172.30.32.2"
|
||||
# ]
|
||||
# }
|
||||
# '
|
||||
|
||||
# # API config
|
||||
# octoprint -b $OCTOPRINT_HOME config set --json api '
|
||||
# {
|
||||
# "allowCrossOrigin": true
|
||||
# }
|
||||
# '
|
||||
|
||||
# # Folder config
|
||||
# octoprint -b $OCTOPRINT_HOME config set --json folder '
|
||||
# {
|
||||
# "generated": "/tmp/octoprint/generated",
|
||||
# "timelapse_tmp": "/tmp/octoprint/timelapse/tmp"
|
||||
# }
|
||||
# '
|
||||
|
||||
# # Server config
|
||||
# octoprint -b $OCTOPRINT_HOME config set --json server '
|
||||
# {
|
||||
# "allowFraming": true,
|
||||
# "commands": {
|
||||
# "serverRestartCommand": "/scripts/octoprint_restart.sh",
|
||||
# "systemRestartCommand": "/scripts/system_restart.sh",
|
||||
# "systemShutdownCommand": "/scripts/system_shutdown.sh"
|
||||
# }
|
||||
# }
|
||||
# '
|
||||
# # Webcam config
|
||||
# octoprint -b $OCTOPRINT_HOME config set --json webcam '
|
||||
# {
|
||||
# "ffmpeg": "/usr/bin/ffmpeg"
|
||||
# }
|
||||
# '
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
bashio::log.warning "Restart addon."
|
||||
|
||||
bashio::addon.restart
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
bashio::log.warning "Restart addon."
|
||||
|
||||
bashio::addon.restart
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
bashio::log.warning "Shutdown addon."
|
||||
|
||||
bashio::addon.stop
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
bashio::log.warning "Shutdown addon."
|
||||
|
||||
bashio::addon.stop
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
:{{ .ingress_port }} {
|
||||
bind {{ .addon_ip }}
|
||||
@ingress {
|
||||
remote_ip {{ .supervisor_ip }}
|
||||
}
|
||||
uri strip_prefix {{ .ingress_entry }}
|
||||
handle {
|
||||
reverse_proxy @ingress 127.0.0.1:80/ {
|
||||
# header_up X-Script-Name {{ .ingress_entry }}
|
||||
# trusted_proxies {{ .supervisor_ip }}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# :8099 {
|
||||
# @ingress {
|
||||
# remote_ip {{ .supervisor_ip }}
|
||||
# }
|
||||
# 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
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
:{{ .ingress_port }} {
|
||||
bind {{ .addon_ip }}
|
||||
@ingress {
|
||||
remote_ip {{ .supervisor_ip }}
|
||||
}
|
||||
uri strip_prefix {{ .ingress_entry }}
|
||||
handle {
|
||||
reverse_proxy @ingress 127.0.0.1:80/ {
|
||||
# header_up X-Script-Name {{ .ingress_entry }}
|
||||
# trusted_proxies {{ .supervisor_ip }}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# :8099 {
|
||||
# @ingress {
|
||||
# remote_ip {{ .supervisor_ip }}
|
||||
# }
|
||||
# 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
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#
|
||||
@@ -1,16 +1,16 @@
|
||||
# Internal and external access. Used for:
|
||||
# * Home-Assistant OctoPrint integration.
|
||||
# * Accessing OctoPrint WebUI through external port.
|
||||
:5000 {
|
||||
{{ if .camera_url }}
|
||||
handle_path /camera* {
|
||||
reverse_proxy {{ .camera_url }} {
|
||||
trusted_proxies {{ .trusted_proxies }}
|
||||
flush_interval -1
|
||||
}
|
||||
}
|
||||
{{ end }}
|
||||
reverse_proxy http://127.0.0.1:80 {
|
||||
trusted_proxies {{ .trusted_proxies }}
|
||||
}
|
||||
}
|
||||
# Internal and external access. Used for:
|
||||
# * Home-Assistant OctoPrint integration.
|
||||
# * Accessing OctoPrint WebUI through external port.
|
||||
:5000 {
|
||||
{{ if .camera_url }}
|
||||
handle_path /camera* {
|
||||
reverse_proxy {{ .camera_url }} {
|
||||
trusted_proxies {{ .trusted_proxies }}
|
||||
flush_interval -1
|
||||
}
|
||||
}
|
||||
{{ end }}
|
||||
reverse_proxy http://127.0.0.1:80 {
|
||||
trusted_proxies {{ .trusted_proxies }}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user