Merge pull request #10 from fredrikbaberg/dev
Documentation and implementation update
This commit is contained in:
commit
bb4f67ecba
@ -18,15 +18,8 @@ RUN apt update && \
|
|||||||
build-essential \
|
build-essential \
|
||||||
nginx \
|
nginx \
|
||||||
&& \
|
&& \
|
||||||
apt install -y \
|
|
||||||
vim \
|
|
||||||
&& \
|
|
||||||
apt clean
|
apt clean
|
||||||
|
|
||||||
# Setup for nginx.
|
|
||||||
RUN rm /etc/nginx/sites-enabled/default
|
|
||||||
RUN chown -R root:root /var/log/nginx
|
|
||||||
|
|
||||||
# Copy root filesystem
|
# Copy root filesystem
|
||||||
COPY rootfs /
|
COPY rootfs /
|
||||||
RUN chmod +x /etc/cont-init.d/*.sh
|
RUN chmod +x /etc/cont-init.d/*.sh
|
||||||
|
|||||||
@ -0,0 +1,3 @@
|
|||||||
|
# 3DPrinter-OctoPrint
|
||||||
|
|
||||||
|
Provides OctoPrint as an addon to Home Assistant.
|
||||||
@ -1,82 +0,0 @@
|
|||||||
#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/my_program cx -> my_program,
|
|
||||||
|
|
||||||
# profile my_program flags=(attach_disconnected,mediate_deleted) {
|
|
||||||
# #include <abstractions/base>
|
|
||||||
#
|
|
||||||
# # Receive signals from S6-Overlay
|
|
||||||
# signal (receive) peer=*_example,
|
|
||||||
#
|
|
||||||
# # Access to options.json and other files within your addon
|
|
||||||
# /data/** rw,
|
|
||||||
#
|
|
||||||
# # Access to mapped volumes specified in config.json
|
|
||||||
# /share/** rw,
|
|
||||||
#
|
|
||||||
# # Access required for service functionality
|
|
||||||
# # Note: List was built by doing the following:
|
|
||||||
# # 1. Add what is obviously needed based on what is in the script
|
|
||||||
# # 2. Add `complain` as a flag to this profile temporarily and run the addon
|
|
||||||
# # 3. Review the audit log with `journalctl _TRANSPORT="audit" -g 'apparmor="ALLOWED"'` and add other access as needed
|
|
||||||
# # Remember to remove the `complain` flag when you are done
|
|
||||||
# # /usr/bin/my_program r,
|
|
||||||
# /bin/bash rix,
|
|
||||||
# /bin/echo ix,
|
|
||||||
# /etc/passwd r,
|
|
||||||
# /dev/tty rw,
|
|
||||||
# }
|
|
||||||
|
|
||||||
# Start new profile for service
|
|
||||||
/usr/sbin/nginx cx -> nginx,
|
|
||||||
|
|
||||||
profile nginx flags=(attach_disconnected,mediate_deleted) {
|
|
||||||
#include <abstractions/base>
|
|
||||||
|
|
||||||
# Receive signals from S6-Overlay
|
|
||||||
signal (receive) peer=*_example,
|
|
||||||
|
|
||||||
# Allow capability CAP_CHOWN
|
|
||||||
capability chown,
|
|
||||||
|
|
||||||
/usr/sbin/nginx r,
|
|
||||||
/bin/bash rix,
|
|
||||||
/bin/echo ix,
|
|
||||||
/etc/passwd r,
|
|
||||||
/dev/tty rw,
|
|
||||||
|
|
||||||
/etc/nginx/* rw,
|
|
||||||
|
|
||||||
/var/log/nginx/access.log rw,
|
|
||||||
/var/log/nginx/error.log rw,
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,19 +1,31 @@
|
|||||||
name: "3DPrinter-OctoPrint"
|
name: "3DPrinter-OctoPrint"
|
||||||
version: "2022.6.028"
|
version: "2022.7.001"
|
||||||
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"
|
||||||
|
ingress: true
|
||||||
|
ingress_stream: true
|
||||||
|
panel_icon: mdi:printer-3d
|
||||||
|
panel_title: 3DPrinter-OctoPrint
|
||||||
arch:
|
arch:
|
||||||
- aarch64
|
- armv7
|
||||||
- amd64
|
- amd64
|
||||||
- armhf
|
- armhf
|
||||||
- armv7
|
- aarch64
|
||||||
- i386
|
- i386
|
||||||
stage: experimental
|
stage: experimental
|
||||||
init: false
|
init: false
|
||||||
map:
|
realtime: true
|
||||||
- share:rw
|
gpio: true
|
||||||
|
uart: true
|
||||||
|
usb: true
|
||||||
ports:
|
ports:
|
||||||
5000/tcp: 5000
|
5000/tcp: null
|
||||||
ingress: true
|
ports_description:
|
||||||
|
5000/tcp: Web-based interface (Not required for Ingress)
|
||||||
|
options:
|
||||||
|
recovery: false
|
||||||
|
schema:
|
||||||
|
recovery: "bool"
|
||||||
image: ghcr.io/fredrikbaberg/addon-3dprinter-octoprint-{arch}
|
image: ghcr.io/fredrikbaberg/addon-3dprinter-octoprint-{arch}
|
||||||
|
tmpfs: true
|
||||||
|
|||||||
@ -1,20 +1,22 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
#!/usr/bin/with-contenv bashio
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Prepare nginx proxy
|
# Add-on: 3dprinter-octoprint
|
||||||
# s6-overlay docs: https://github.com/just-containers/s6-overlay
|
# Configures NGINX
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
bashio::log.info "nginx cont-init.d"
|
# Generate Ingress configuration
|
||||||
|
bashio::var.json \
|
||||||
|
interface "$(bashio::addon.ip_address)" \
|
||||||
|
port "^$(bashio::addon.ingress_port)" \
|
||||||
|
| tempio \
|
||||||
|
-template /etc/nginx/templates/ingress.gtpl \
|
||||||
|
-out /etc/nginx/servers/ingress.conf
|
||||||
|
|
||||||
ingress_entry=$(bashio::addon.ingress_entry)
|
# Generate direct access configuration, if enabled.
|
||||||
export ingress_entry=${ingress_entry}
|
if bashio::var.has_value "$(bashio::addon.port 5000)"; then
|
||||||
|
bashio::var.json \
|
||||||
tempio \
|
port "^$(bashio::addon.port 5000)" \
|
||||||
-conf /data/options.json \
|
| tempio \
|
||||||
-template /usr/share/tempio/ingress.conf \
|
-template /etc/nginx/templates/direct.gtpl \
|
||||||
-out /etc/nginx/sites-enabled/ingress.conf
|
-out /etc/nginx/servers/direct.conf
|
||||||
|
fi
|
||||||
tempio \
|
|
||||||
-conf /data/options.json \
|
|
||||||
-template /usr/share/tempio/webui.conf \
|
|
||||||
-out /etc/nginx/sites-enabled/webui.conf
|
|
||||||
|
|||||||
@ -7,10 +7,29 @@
|
|||||||
{ # Check if OctoPrint is installed
|
{ # Check if OctoPrint is installed
|
||||||
octoprint --version
|
octoprint --version
|
||||||
} || { # Otherwise install
|
} || { # Otherwise install
|
||||||
{ # Check if Python is available
|
{ # Check if Python is available at `/data/python/octoprint` according to PATH)
|
||||||
python --version
|
python --version
|
||||||
} || { # Otherwise install
|
} || { # Otherwise create Python virtual environment.
|
||||||
python3 -m venv /data/python/octoprint
|
python3 -m venv /data/python/octoprint
|
||||||
}
|
}
|
||||||
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
|
||||||
|
|
||||||
|
{ # 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."
|
||||||
|
}
|
||||||
|
|||||||
96
3dprinter-octoprint/rootfs/etc/nginx/includes/mime.types
Normal file
96
3dprinter-octoprint/rootfs/etc/nginx/includes/mime.types
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
types {
|
||||||
|
text/html html htm shtml;
|
||||||
|
text/css css;
|
||||||
|
text/xml xml;
|
||||||
|
image/gif gif;
|
||||||
|
image/jpeg jpeg jpg;
|
||||||
|
application/javascript js;
|
||||||
|
application/atom+xml atom;
|
||||||
|
application/rss+xml rss;
|
||||||
|
|
||||||
|
text/mathml mml;
|
||||||
|
text/plain txt;
|
||||||
|
text/vnd.sun.j2me.app-descriptor jad;
|
||||||
|
text/vnd.wap.wml wml;
|
||||||
|
text/x-component htc;
|
||||||
|
|
||||||
|
image/png png;
|
||||||
|
image/svg+xml svg svgz;
|
||||||
|
image/tiff tif tiff;
|
||||||
|
image/vnd.wap.wbmp wbmp;
|
||||||
|
image/webp webp;
|
||||||
|
image/x-icon ico;
|
||||||
|
image/x-jng jng;
|
||||||
|
image/x-ms-bmp bmp;
|
||||||
|
|
||||||
|
font/woff woff;
|
||||||
|
font/woff2 woff2;
|
||||||
|
|
||||||
|
application/java-archive jar war ear;
|
||||||
|
application/json json;
|
||||||
|
application/mac-binhex40 hqx;
|
||||||
|
application/msword doc;
|
||||||
|
application/pdf pdf;
|
||||||
|
application/postscript ps eps ai;
|
||||||
|
application/rtf rtf;
|
||||||
|
application/vnd.apple.mpegurl m3u8;
|
||||||
|
application/vnd.google-earth.kml+xml kml;
|
||||||
|
application/vnd.google-earth.kmz kmz;
|
||||||
|
application/vnd.ms-excel xls;
|
||||||
|
application/vnd.ms-fontobject eot;
|
||||||
|
application/vnd.ms-powerpoint ppt;
|
||||||
|
application/vnd.oasis.opendocument.graphics odg;
|
||||||
|
application/vnd.oasis.opendocument.presentation odp;
|
||||||
|
application/vnd.oasis.opendocument.spreadsheet ods;
|
||||||
|
application/vnd.oasis.opendocument.text odt;
|
||||||
|
application/vnd.openxmlformats-officedocument.presentationml.presentation
|
||||||
|
pptx;
|
||||||
|
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
||||||
|
xlsx;
|
||||||
|
application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
||||||
|
docx;
|
||||||
|
application/vnd.wap.wmlc wmlc;
|
||||||
|
application/x-7z-compressed 7z;
|
||||||
|
application/x-cocoa cco;
|
||||||
|
application/x-java-archive-diff jardiff;
|
||||||
|
application/x-java-jnlp-file jnlp;
|
||||||
|
application/x-makeself run;
|
||||||
|
application/x-perl pl pm;
|
||||||
|
application/x-pilot prc pdb;
|
||||||
|
application/x-rar-compressed rar;
|
||||||
|
application/x-redhat-package-manager rpm;
|
||||||
|
application/x-sea sea;
|
||||||
|
application/x-shockwave-flash swf;
|
||||||
|
application/x-stuffit sit;
|
||||||
|
application/x-tcl tcl tk;
|
||||||
|
application/x-x509-ca-cert der pem crt;
|
||||||
|
application/x-xpinstall xpi;
|
||||||
|
application/xhtml+xml xhtml;
|
||||||
|
application/xspf+xml xspf;
|
||||||
|
application/zip zip;
|
||||||
|
|
||||||
|
application/octet-stream bin exe dll;
|
||||||
|
application/octet-stream deb;
|
||||||
|
application/octet-stream dmg;
|
||||||
|
application/octet-stream iso img;
|
||||||
|
application/octet-stream msi msp msm;
|
||||||
|
|
||||||
|
audio/midi mid midi kar;
|
||||||
|
audio/mpeg mp3;
|
||||||
|
audio/ogg ogg;
|
||||||
|
audio/x-m4a m4a;
|
||||||
|
audio/x-realaudio ra;
|
||||||
|
|
||||||
|
video/3gpp 3gpp 3gp;
|
||||||
|
video/mp2t ts;
|
||||||
|
video/mp4 mp4;
|
||||||
|
video/mpeg mpeg mpg;
|
||||||
|
video/quicktime mov;
|
||||||
|
video/webm webm;
|
||||||
|
video/x-flv flv;
|
||||||
|
video/x-m4v m4v;
|
||||||
|
video/x-mng mng;
|
||||||
|
video/x-ms-asf asx asf;
|
||||||
|
video/x-ms-wmv wmv;
|
||||||
|
video/x-msvideo avi;
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_ignore_client_abort off;
|
||||||
|
proxy_read_timeout 86400s;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_send_timeout 86400s;
|
||||||
|
proxy_max_temp_file_size 0;
|
||||||
|
|
||||||
|
proxy_set_header Accept-Encoding "";
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-NginX-Proxy true;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
root /dev/null;
|
||||||
|
server_name $hostname;
|
||||||
|
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
add_header X-Robots-Tag none;
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_prefer_server_ciphers off;
|
||||||
|
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
|
||||||
|
ssl_session_timeout 10m;
|
||||||
|
ssl_session_cache shared:SSL:10m;
|
||||||
|
ssl_session_tickets off;
|
||||||
|
ssl_stapling on;
|
||||||
|
ssl_stapling_verify on;
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
upstream backend {
|
||||||
|
server 127.0.0.1:5000;
|
||||||
|
}
|
||||||
@ -1,22 +1,44 @@
|
|||||||
user root root;
|
# Run nginx in foreground.
|
||||||
|
daemon off;
|
||||||
|
|
||||||
worker_processes 1;
|
# This is run inside Docker.
|
||||||
|
user root;
|
||||||
|
|
||||||
|
# Pid storage location.
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
# Set number of worker processes.
|
||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
# Enables the use of JIT for regular expressions to speed-up their processing.
|
||||||
|
pcre_jit on;
|
||||||
|
|
||||||
|
# Write error log to the add-on log.
|
||||||
|
error_log /proc/1/fd/1 error;
|
||||||
|
|
||||||
|
# Max num of simultaneous connections by a worker process.
|
||||||
events {
|
events {
|
||||||
worker_connections 1024;
|
worker_connections 512;
|
||||||
}
|
}
|
||||||
|
|
||||||
http {
|
http {
|
||||||
include mime.types;
|
include /etc/nginx/includes/mime.types;
|
||||||
default_type application/octet-stream;
|
|
||||||
sendfile on;
|
access_log off;
|
||||||
keepalive_timeout 65;
|
client_max_body_size 4G;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
gzip on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
sendfile on;
|
||||||
|
server_tokens off;
|
||||||
|
tcp_nodelay on;
|
||||||
|
tcp_nopush on;
|
||||||
|
|
||||||
map $http_upgrade $connection_upgrade {
|
map $http_upgrade $connection_upgrade {
|
||||||
default upgrade;
|
default upgrade;
|
||||||
'' close;
|
'' close;
|
||||||
}
|
}
|
||||||
|
|
||||||
include /etc/nginx/sites-enabled/*;
|
include /etc/nginx/includes/upstream.conf;
|
||||||
|
include /etc/nginx/servers/*.conf;
|
||||||
}
|
}
|
||||||
|
|||||||
10
3dprinter-octoprint/rootfs/etc/nginx/templates/direct.gtpl
Normal file
10
3dprinter-octoprint/rootfs/etc/nginx/templates/direct.gtpl
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
server {
|
||||||
|
listen {{ .port }} default_server;
|
||||||
|
|
||||||
|
include /etc/nginx/includes/server_params.conf;
|
||||||
|
include /etc/nginx/includes/proxy_params.conf;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://backend;
|
||||||
|
}
|
||||||
|
}
|
||||||
13
3dprinter-octoprint/rootfs/etc/nginx/templates/ingress.gtpl
Normal file
13
3dprinter-octoprint/rootfs/etc/nginx/templates/ingress.gtpl
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
server {
|
||||||
|
listen {{ .interface }}:{{ .port }} default_server;
|
||||||
|
|
||||||
|
include /etc/nginx/includes/server_params.conf;
|
||||||
|
include /etc/nginx/includes/proxy_params.conf;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
allow 172.30.32.2;
|
||||||
|
deny all;
|
||||||
|
|
||||||
|
proxy_pass http://backend;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,12 +1,9 @@
|
|||||||
#!/usr/bin/env bashio
|
#!/usr/bin/execlineb -S0
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Take down the S6 supervision tree when proxy fails
|
# Add-on: 3dprinter-octoprint
|
||||||
# s6-overlay docs: https://github.com/just-containers/s6-overlay
|
# Take down the S6 supervision tree when Nginx fails
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
if -n { s6-test $# -ne 0 }
|
||||||
|
if -n { s6-test ${1} -eq 256 }
|
||||||
|
|
||||||
if [[ "$1" -ne 0 ]] && [[ "$1" -ne 256 ]]; then
|
s6-svscanctl -t /var/run/s6/services
|
||||||
bashio::log.warning "Halt add-on"
|
|
||||||
exec /run/s6/basedir/bin/halt
|
|
||||||
fi
|
|
||||||
|
|
||||||
bashio::log.info "Service restart after closing"
|
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
#!/usr/bin/with-contenv bashio
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Start nginx proxy
|
# Add-on: 3dprinter-octoprint
|
||||||
# s6-overlay docs: https://github.com/just-containers/s6-overlay
|
# Runs the Nginx daemon
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
|
# Wait for web server to be available
|
||||||
|
bashio::net.wait_for 5000
|
||||||
|
|
||||||
bashio::log.info "Starting NGinx..."
|
bashio::log.info "Starting NGinx..."
|
||||||
exec nginx -g 'daemon off;'
|
exec nginx
|
||||||
|
|||||||
@ -1,14 +1,9 @@
|
|||||||
#!/usr/bin/env bashio
|
#!/usr/bin/execlineb -S0
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Take down the S6 supervision tree when octoprint fails
|
# Add-on: mjpg-streamer
|
||||||
# s6-overlay docs: https://github.com/just-containers/s6-overlay
|
# Take down the S6 supervision tree when mjpg-streamer fails
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
if -n { s6-test $# -ne 0 }
|
||||||
|
if -n { s6-test ${1} -eq 256 }
|
||||||
|
|
||||||
# if [[ "$1" -ne 0 ]] && [[ "$1" -ne 256 ]]; then
|
s6-svscanctl -t /var/run/s6/services
|
||||||
# bashio::log.warning "Halt add-on"
|
|
||||||
# exec /run/s6/basedir/bin/halt
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# bashio::log.info "Service restart after closing"
|
|
||||||
|
|
||||||
bashio::log.notice "Finish up OctoPrint..."
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
#!/usr/bin/with-contenv bashio
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# Start OctoPrint
|
# Add-on: 3dprinter-octoprint
|
||||||
# s6-overlay docs: https://github.com/just-containers/s6-overlay
|
# Runs OctoPrint
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
## Run your program
|
## Run your program
|
||||||
exec octoprint serve --iknowwhatimdoing --host 0.0.0.0 --port 80 --basedir /data/config/octoprint
|
exec octoprint serve --iknowwhatimdoing --host 0.0.0.0 --port 5000 --basedir /data/config/octoprint
|
||||||
|
|||||||
13
3dprinter-octoprint/rootfs/root/config/octoprint/config.yaml
Normal file
13
3dprinter-octoprint/rootfs/root/config/octoprint/config.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
accessControl:
|
||||||
|
autologinAs: homeassistant
|
||||||
|
autologinLocal: true
|
||||||
|
localNetworks:
|
||||||
|
- 172.30.32.2
|
||||||
|
folder:
|
||||||
|
generated: /tmp/octoprint/generated
|
||||||
|
timelapse_tmp: /tmp/octoprint/timelapse/tmp
|
||||||
|
server:
|
||||||
|
commands:
|
||||||
|
serverRestartCommand: /scripts/octoprint_restart.sh
|
||||||
|
systemRestartCommand: /scripts/system_restart.sh
|
||||||
|
systemShutdownCommand: /scripts/system_shutdown.sh
|
||||||
@ -1,29 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 8099;
|
|
||||||
|
|
||||||
allow 172.30.32.2;
|
|
||||||
deny all;
|
|
||||||
|
|
||||||
server_name _;
|
|
||||||
access_log /dev/stdout combined;
|
|
||||||
|
|
||||||
location {{ env "ingress_entry" }}/ {
|
|
||||||
proxy_pass http://127.0.0.1:80/; # make sure to add trailing slash here!
|
|
||||||
proxy_set_header Host $http_host;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Scheme $scheme;
|
|
||||||
proxy_set_header X-Script-Name {{ env "ingress_entry" }};
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
|
|
||||||
client_max_body_size 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# redirect server error pages to the static page /50x.html
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
|
||||||
location = /50x.html {
|
|
||||||
root html;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 5000;
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass http://127.0.0.1:80/; # make sure to add trailing slash here!
|
|
||||||
proxy_set_header Host $http_host;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Scheme $scheme;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
|
|
||||||
client_max_body_size 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# redirect server error pages to the static page /50x.html
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
|
||||||
location = /50x.html {
|
|
||||||
root html;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
configuration:
|
|
||||||
message:
|
|
||||||
name: Message
|
|
||||||
description: The message that will be printed to the log when starting this example add-on.
|
|
||||||
network:
|
|
||||||
5000/TCP: OctoPrint port (not used for Ingress)
|
|
||||||
@ -7,11 +7,22 @@
|
|||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
Set input arguments through `mjpg_input` configuration option, start the add-on.
|
Set input arguments through `mjpg_input` configuration option, start the add-on.
|
||||||
The camera stream and snapshot can be accessed by e.g. [MJPEG IP Camera](https://www.home-assistant.io/integrations/mjpeg/) from url `http://<addon-hostname>/?action=stream` or `http://<addon-hostname>/?action=snapshot`.
|
|
||||||
|
## Accessing camera from Home Assistant
|
||||||
|
|
||||||
|
The camera stream and snapshot can be accessed by e.g. [MJPEG IP Camera](https://www.home-assistant.io/integrations/mjpeg/), with URLs:
|
||||||
|
* MJPEG URL: `http://<addon-hostname>/?action=stream`
|
||||||
|
* Still image URL: `http://<addon-hostname>/?action=snapshot`.
|
||||||
|
|
||||||
|
Addon hostname can be found under [addon settings](https://my.home-assistant.io/redirect/supervisor_addon/?addon=b7aa59c4_camera-mjpg-streamer&repository_url=https%3A%2F%2Fgithub.com%2Ffredrikbaberg%2F3dprinter-addons).
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
For testing you can set `mjpg_input` to:
|
For testing you can set `mjpg_input` to:
|
||||||
> input_file.so -f /www_mjpg -e
|
> input_file.so -f /www_mjpg -e
|
||||||
|
|
||||||
|
This will result in showing a test image.
|
||||||
|
|
||||||
## Versions
|
## Versions
|
||||||
|
|
||||||
Some notes regarding the software and versions.
|
Some notes regarding the software and versions.
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
# mjpg-streamer
|
# mjpg-streamer
|
||||||
|
|
||||||
Provides camera stream through `mjpg-streamer`, to be used by e.g. OctoPrint addon.
|
Provides camera stream through `mjpg-streamer`, to be used by e.g. OctoPrint addon.
|
||||||
|
|
||||||
|
Instructions are provided in the tab "Docs".
|
||||||
|
|||||||
@ -8,4 +8,4 @@
|
|||||||
bashio::net.wait_for 80
|
bashio::net.wait_for 80
|
||||||
|
|
||||||
bashio::log.info "Starting NGinx..."
|
bashio::log.info "Starting NGinx..."
|
||||||
exec nginx
|
exec nginx
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# Camera-RTC
|
# Camera-RTC
|
||||||
|
|
||||||
**Note: This addon is not ready for use.**
|
**Note: This addon is broken and not ready for use.**
|
||||||
|
|
||||||
Camera addon with support for WebRTC.
|
Camera addon with support for WebRTC.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user