Gone through the files to prepare for release.

This commit is contained in:
Fredrik Baberg 2023-01-11 18:03:48 +01:00
parent 1dde43aa22
commit 1da9097b38
10 changed files with 81 additions and 116 deletions

View File

@ -1,28 +1,7 @@
- 2022.12.05
- Revert to OctoPrint 1.7.3.
- Bugfix to options.
- 2022.12.04
- Correction to name of option (trusted_proxies).
- 2022.12.03
- Add option for trusted proxies.
- 2022.12.02
- Use image instead of local build.
- 2022.12.01
- Add mode for camera (for testing).
- Set Caddy to trust private ranges on Ingress entry.
- 2022.11.01
- Add reverse proxy config for camera with Ingress (untested).
- Only create OctoPrint user if missing.
- Update documentation.
- Mark mode optional.
- Update OctoPrint to 1.8.6
- Update icon to coloured nozzle.
- Clean-up Caddy config.
- Fixes to Caddy XDG paths
- Change reverse proxy from nginx to Caddy
## 2023.01.0
* Disabled Ingress
* Default config now set by API instead of copying a file (should make it more flexible).
* Using Caddy as reverse proxy.
* Added option to set trusted_proxies, should help with reverse proxy configuration.
* Updated to OctoPrint 1.8.6.
* Based on Debian instead of Alpine, should make more plugins compatible.

View File

@ -1,15 +1,25 @@
# Addon configuration
## Mode
## Trusted proxies
By specifying a different mode you can instead access recovery and reverse proy test page. Normally this should not be needed.
By setting trusted proxies you should be able to use HTTPS *if you have placed a reverse proxy in front of Home Assistant*. For more information, see [Caddy documentation](https://caddyserver.com/docs/caddyfile/directives/reverse_proxy).
# Notes etc.
# Camera
> image: ghcr.io/fredrikbaberg/ha-addon-3dprinter-octoprint-{arch}
There is no camera server in the addon, it has to be setup separately.
## Camera URL
You could, for instance, use the addon [camera-mjpg-streamer](https://github.com/fredrikbaberg/3dprinter-addons/tree/main/camera-mjpg-streamer) available in the same repository. If so, you can set the snapshot URL to:
> `http://b7aa59c4-camera-mjpg-streamer/?action=snapshot`.
**Note: Currently not used.**
Note that this method **only allows for snapshot**, it does **NOT** work for camera stream as this requires the browser/app used to directly access the stream.
Through setting a camera URL you should be able to access the camera stream even when using Ingress.
# Ingress?
This addon drops support for Ingress. The main reason for this is issues with finding a working configuration.
* An update to OctoPrint increased the security (which is good!). Unfortunately it also broke the configuration used in this addon, most likely due to this addon not behaving properly.
* There has been issues with accessing camera stream by Ingress since I added support for it, which I have not been able to solve.
I have tried to find a solution to this, without success. Therefore I decided to disable the option, as it just leads to frustration.
If someone is able to find a working configuration, please let me know.

View File

@ -3,3 +3,4 @@
Provides OctoPrint as an addon to Home Assistant.
Note: Ingress is **NOT** supported.

View File

@ -9,4 +9,4 @@ labels:
org.opencontainers.image.description: "3DPrinter-OctoPrint addon for Home-Assistant."
org.opencontainers.image.source: "https://github.com/fredrikbaberg/3dprinter-addons"
args:
OCTOPRINT_VERSION: "1.8.6"
OCTOPRINT_VERSION: "1.7.3"

View File

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

View File

@ -1,5 +1,5 @@
{
debug
# debug
log {
format console
output file /var/log/caddy/caddy.log

View File

@ -8,7 +8,7 @@ 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`, according to PATH)
{ # 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
@ -18,9 +18,13 @@ export BASEDIR="--basedir /data/config/octoprint"
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 required for the addon to work properly (should be OK to run each time).
updateRequiredConfig()
# 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"
@ -31,7 +35,9 @@ updateRequiredConfig()
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.
@ -46,14 +52,3 @@ updateRequiredConfig()
# }
# Trusted networks, access control etc.
# }
# Create initial OctoPrint config, if missing.
if [ ! -f /data/config/octoprint/config.yaml ]; then
mkdir -p /data/config/octoprint
fi
# Update required config for running OctoPrint properly in addon.
updateRequiredConfig
# Make sure users exists, if needed.

View File

@ -6,5 +6,5 @@
# if -n { s6-test $# -ne 0 }
# if -n { s6-test ${1} -eq 256 }
#
# s6-svscanctl -t /var/run/s6/services

View File

@ -1,20 +0,0 @@
# accessControl:
# autologinAs: homeassistant
# autologinLocal: true
# localNetworks:
# - 127.0.0.0/8
# - ::1/128
# - 172.30.32.2
api:
allowCrossOrigin: true
folder:
generated: /tmp/octoprint/generated
timelapse_tmp: /tmp/octoprint/timelapse/tmp
server:
allowFraming: true
commands:
serverRestartCommand: /scripts/octoprint_restart.sh
systemRestartCommand: /scripts/system_restart.sh
systemShutdownCommand: /scripts/system_shutdown.sh
webcam:
ffmpeg: /usr/bin/ffmpeg

View File

@ -1,48 +1,48 @@
#!/usr/bin/bash
# Set/update parts of OctoPrint config to work with addon.
# #!/usr/bin/bash
# # Set/update parts of OctoPrint config to work with addon.
export OCTOPRINT_HOME=/data/config/octoprint
# 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"
]
}
'
# # 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
}
'
# # 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"
}
'
# # 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"
}
'
# # 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"
# }
# '