Cleanup octoprint for testing
This commit is contained in:
parent
774bd3b18d
commit
08aa3cd32a
@ -1,26 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "Example devcontainer for add-on repositories",
|
"name": "Example devcontainer for add-on repositories",
|
||||||
"image": "ghcr.io/home-assistant/devcontainer:addons",
|
"image": "ghcr.io/home-assistant/devcontainer:addons",
|
||||||
"appPort": [
|
"appPort": ["7123:8123", "7357:4357"],
|
||||||
"7123:8123",
|
"postStartCommand": "bash devcontainer_bootstrap",
|
||||||
"7357:4357"
|
"runArgs": ["-e", "GIT_EDITOR=code --wait", "--privileged"],
|
||||||
],
|
|
||||||
"postStartCommand": "sudo -E bash devcontainer_bootstrap",
|
|
||||||
"runArgs": [
|
|
||||||
"-e",
|
|
||||||
"GIT_EDITOR=code --wait",
|
|
||||||
"--privileged"
|
|
||||||
],
|
|
||||||
"containerEnv": {
|
"containerEnv": {
|
||||||
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
|
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
|
||||||
},
|
},
|
||||||
"extensions": [
|
"extensions": ["timonwong.shellcheck", "esbenp.prettier-vscode"],
|
||||||
"timonwong.shellcheck",
|
"mounts": [ "type=volume,target=/var/lib/docker" ],
|
||||||
"esbenp.prettier-vscode"
|
|
||||||
],
|
|
||||||
"mounts": [
|
|
||||||
"type=volume,target=/var/lib/docker"
|
|
||||||
],
|
|
||||||
"settings": {
|
"settings": {
|
||||||
"terminal.integrated.profiles.linux": {
|
"terminal.integrated.profiles.linux": {
|
||||||
"zsh": {
|
"zsh": {
|
||||||
@ -1,15 +1,15 @@
|
|||||||
# Addon configuration
|
# Addon configuration
|
||||||
|
|
||||||
## Camera URL
|
|
||||||
|
|
||||||
**Note: Currently not working.**
|
|
||||||
|
|
||||||
Through setting a camera URL you should be able to access the camera stream even when using Ingress.
|
|
||||||
|
|
||||||
## Mode
|
## Mode
|
||||||
|
|
||||||
By specifying a different mode you can instead access recovery and reverse proy test page. Normally this should not be needed.
|
By specifying a different mode you can instead access recovery and reverse proy test page. Normally this should not be needed.
|
||||||
|
|
||||||
# Notes etc.
|
# Notes etc.
|
||||||
|
|
||||||
> image: ghcr.io/fredrikbaberg/addon-3dprinter-octoprint-{arch}
|
> image: ghcr.io/fredrikbaberg/ha-addon-3dprinter-octoprint-{arch}
|
||||||
|
|
||||||
|
## Camera URL
|
||||||
|
|
||||||
|
**Note: Currently not used.**
|
||||||
|
|
||||||
|
Through setting a camera URL you should be able to access the camera stream even when using Ingress.
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# 3DPrinter-OctoPrint
|
# 3DPrinter-OctoPrint
|
||||||
|
|
||||||
**Note: Currently not in a ready-to-use state.**
|
|
||||||
|
|
||||||
Provides OctoPrint as an addon to Home Assistant.
|
Provides OctoPrint as an addon to Home Assistant.
|
||||||
|
|
||||||
|
Note: Ingress is **NOT** supported.
|
||||||
|
|||||||
@ -9,4 +9,4 @@ labels:
|
|||||||
org.opencontainers.image.description: "3DPrinter-OctoPrint addon for Home-Assistant."
|
org.opencontainers.image.description: "3DPrinter-OctoPrint addon for Home-Assistant."
|
||||||
org.opencontainers.image.source: "https://github.com/fredrikbaberg/3dprinter-addons"
|
org.opencontainers.image.source: "https://github.com/fredrikbaberg/3dprinter-addons"
|
||||||
args:
|
args:
|
||||||
OCTOPRINT_VERSION: "1.7.3"
|
OCTOPRINT_VERSION: "1.8.6"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: "3DPrinter-OctoPrint"
|
name: "3DPrinter-OctoPrint"
|
||||||
version: "2022.12.05"
|
version: "2023.01.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"
|
||||||
@ -22,7 +22,7 @@ usb: true
|
|||||||
ports:
|
ports:
|
||||||
5000/tcp: null
|
5000/tcp: null
|
||||||
ports_description:
|
ports_description:
|
||||||
5000/tcp: Web-based interface (Not required for Ingress)
|
5000/tcp: Web-based interface
|
||||||
options:
|
options:
|
||||||
camera_url: "http://b7aa59c4-camera-mjpg-streamer"
|
camera_url: "http://b7aa59c4-camera-mjpg-streamer"
|
||||||
mode: normal
|
mode: normal
|
||||||
@ -32,4 +32,4 @@ schema:
|
|||||||
mode: "list(normal|recovery|reverse_proxy_test|camera)?"
|
mode: "list(normal|recovery|reverse_proxy_test|camera)?"
|
||||||
trusted_proxies: "str?"
|
trusted_proxies: "str?"
|
||||||
tmpfs: true
|
tmpfs: true
|
||||||
image: ghcr.io/fredrikbaberg/addon-3dprinter-octoprint-{arch}
|
# image: ghcr.io/fredrikbaberg/ha-addon-3dprinter-octoprint-{arch}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
# Temporary file, will be overwritten on launch.
|
|
||||||
{
|
{
|
||||||
debug
|
debug
|
||||||
log {
|
log {
|
||||||
@ -6,3 +5,5 @@
|
|||||||
output file /var/log/caddy/caddy.log
|
output file /var/log/caddy/caddy.log
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import sites-enabled/*.caddy
|
||||||
|
|||||||
0
3dprinter-octoprint/rootfs/etc/caddy/sites-enabled/.gitignore
vendored
Normal file
0
3dprinter-octoprint/rootfs/etc/caddy/sites-enabled/.gitignore
vendored
Normal file
@ -3,11 +3,12 @@
|
|||||||
# Prepare OctoPrint
|
# Prepare OctoPrint
|
||||||
# s6-overlay docs: https://github.com/just-containers/s6-overlay
|
# s6-overlay docs: https://github.com/just-containers/s6-overlay
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
export BASEDIR="--basedir /data/config/octoprint"
|
||||||
|
|
||||||
{ # Check if OctoPrint is installed.
|
{ # Check if OctoPrint is installed.
|
||||||
octoprint -b /data/config/octoprint --version
|
octoprint $BASEDIR --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
|
||||||
} || { # Otherwise create Python virtual environment.
|
} || { # Otherwise create Python virtual environment.
|
||||||
python3 -m venv /data/python/octoprint
|
python3 -m venv /data/python/octoprint
|
||||||
@ -17,17 +18,24 @@
|
|||||||
pip install octoprint==$OCTOPRINT_VERSION
|
pip install octoprint==$OCTOPRINT_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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
|
|
||||||
bashio::log.notice "Default OctoPrint config copied"
|
|
||||||
else
|
|
||||||
bashio::log.warning "Default OctoPrint config not found"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
# Update OctoPrint config with settings used for the addon overall (could always be changed)
|
||||||
|
function updateConfigRequired() {
|
||||||
|
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 server.host "127.0.0.1"
|
||||||
|
octoprint $BASEDIR config set --int server.port 80
|
||||||
|
octoprint $BASEDIR config set webcam.ffmpeg "/usr/bin/ffmpeg"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Update OctoPrint config with customized settings, not strictly required for addon to work but helps with features.
|
||||||
|
function updateConfigCustom() {
|
||||||
|
# Add user, if needed.
|
||||||
# { # Make sure Ingress user for OctoPrint exists.
|
# { # Make sure Ingress user for OctoPrint exists.
|
||||||
# bashio::log.notice "Ensure Ingress user (homeassistant) exist."
|
# bashio::log.notice "Ensure Ingress user (homeassistant) exist."
|
||||||
# if ! octoprint --basedir /data/config/octoprint user list | grep -q 'homeassistant'; then
|
# if ! octoprint --basedir /data/config/octoprint user list | grep -q 'homeassistant'; then
|
||||||
@ -37,3 +45,12 @@ fi
|
|||||||
# } || { # catch
|
# } || { # catch
|
||||||
# bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch."
|
# bashio::log.warning "Failed to ensure Ingress user exists, may not be able to launch."
|
||||||
# }
|
# }
|
||||||
|
# Trusted networks, access control etc.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Create initial OctoPrint config, if missing.
|
||||||
|
if [ ! -f /data/config/octoprint/config.yaml ]; then
|
||||||
|
mkdir -p /data/config/octoprint
|
||||||
|
updateConfigRequired
|
||||||
|
fi
|
||||||
|
|||||||
@ -1,10 +1,23 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
# #!/usr/bin/with-contenv bashio
|
||||||
# ==============================================================================
|
# # ==============================================================================
|
||||||
# Add-on: 3dprinter-octoprint
|
# # Add-on: 3dprinter-octoprint
|
||||||
# Configures proxy
|
# # Configures proxy
|
||||||
# ==============================================================================
|
# # ==============================================================================
|
||||||
|
|
||||||
# Generate proxy configuration for Ingress
|
# Generate proxy configuration for any access
|
||||||
|
bashio::var.json \
|
||||||
|
| tempio \
|
||||||
|
-template /usr/share/tempio/caddy/Caddyfile.any.gtpl \
|
||||||
|
-out /etc/caddy/sites-enabled/any.caddy
|
||||||
|
|
||||||
|
# Generate proxy configuration for internal access
|
||||||
|
bashio::var.json \
|
||||||
|
internal_hostname "$(bashio::info.hostname)" \
|
||||||
|
| tempio \
|
||||||
|
-template /usr/share/tempio/caddy/Caddyfile.internal.gtpl \
|
||||||
|
-out /etc/caddy/sites-enabled/internal.caddy
|
||||||
|
|
||||||
|
# Generate proxy configuration for Ingress access
|
||||||
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)" \
|
||||||
@ -13,8 +26,8 @@ bashio::var.json \
|
|||||||
mode "$(bashio::config 'mode')" \
|
mode "$(bashio::config 'mode')" \
|
||||||
trusted_proxies "$(bashio::config 'trusted_proxies')" \
|
trusted_proxies "$(bashio::config 'trusted_proxies')" \
|
||||||
| tempio \
|
| tempio \
|
||||||
-template /usr/share/tempio/caddy/Caddyfile.gtpl \
|
-template /usr/share/tempio/caddy/Caddyfile.ingress.gtpl \
|
||||||
-out /etc/caddy/Caddyfile
|
-out /etc/caddy/sites-enabled/ingress.caddy
|
||||||
|
|
||||||
# Make sure file is correctly formatted.
|
# # Make sure file is correctly formatted.
|
||||||
caddy fmt --overwrite /etc/caddy/Caddyfile
|
# caddy fmt --overwrite /etc/caddy/Caddyfile
|
||||||
|
|||||||
@ -7,4 +7,4 @@
|
|||||||
bashio::log.info "Starting OctoPrint..."
|
bashio::log.info "Starting OctoPrint..."
|
||||||
|
|
||||||
## Run your program
|
## Run your program
|
||||||
exec octoprint serve --iknowwhatimdoing --host 127.0.0.1 --port 80 --basedir /data/config/octoprint
|
exec octoprint --basedir /data/config/octoprint serve --iknowwhatimdoing --host 127.0.0.1 --port 80
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
# Runs the reverse proxy.
|
# Runs the reverse proxy.
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
# Wait for web server to be available
|
# Wait for OctoPrint WebUI to be available
|
||||||
bashio::net.wait_for 80
|
bashio::net.wait_for 80
|
||||||
|
|
||||||
bashio::log.info "Starting proxy..."
|
bashio::log.info "Starting proxy..."
|
||||||
|
|||||||
@ -0,0 +1,5 @@
|
|||||||
|
# OctoPrint WebUI through external access
|
||||||
|
:5000 {
|
||||||
|
reverse_proxy http://127.0.0.1:80 {
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
# WebUI through internal hostname
|
||||||
|
{{ .internal_hostname }}:5000 {
|
||||||
|
reverse_proxy http://127.0.0.1:80 {
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user