mirror of
https://github.com/mtan93/homeassistant-addons.git
synced 2026-03-08 05:21:51 +00:00
Add OctoPrint Reverse Proxy
This commit is contained in:
@@ -1,12 +1,17 @@
|
|||||||
# Home Assistant Add-On repository (by Max Winterstein)
|
# Home Assistant Add-On repository (by Max Winterstein)
|
||||||
|
|
||||||
|
*Everything here is ment to be **experimental**. Happy to see feedback!*
|
||||||
|
|
||||||
Home Assistant Addon repository containing
|
Home Assistant Addon repository containing
|
||||||
|
|
||||||
## <img src="eufy-ha-mqtt-bridge/icon.png" width="40px"> Eufy Home Assistant MQTT Bridge ([matijse/eufy-ha-mqtt-bridge](https://github.com/matijse/eufy-ha-mqtt-bridge))
|
## <img src="eufy-ha-mqtt-bridge/icon.png" width="40px"> Eufy Home Assistant MQTT Bridge ([matijse/eufy-ha-mqtt-bridge](https://github.com/matijse/eufy-ha-mqtt-bridge))
|
||||||
Forwards Eufy Security push notifications to Home Assistant via MQTT. **Experimental**
|
Forwards Eufy Security push notifications to Home Assistant via MQTT.
|
||||||
|
|
||||||
## <img src="ioBroker/icon.png" width="40px"> ioBroker ([iobroker.net](http://iobroker.net))
|
## <img src="ioBroker/icon.png" width="40px"> ioBroker ([iobroker.net](http://iobroker.net))
|
||||||
Run ioBroker as Add-on. **Experimental**
|
Run ioBroker as Add-on.
|
||||||
|
|
||||||
|
## <img src="octoprint-proxy/icon.png" width="40px"> OctoPrint Reverse Proxy ([octoprint.org](http://octoprint.org))
|
||||||
|
Small proxy to add OctoPrint to the Home Assistant.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
Go to the *Supervisor* Panel, select *Add-on Store*, click the three little dots on the upper right and select *Repositories*. Now fill the *Add repository* testbox with `https://github.com/MaxWinterstein/homeassistant-addons/` and click *Add*.
|
Go to the *Supervisor* Panel, select *Add-on Store*, click the three little dots on the upper right and select *Repositories*. Now fill the *Add repository* testbox with `https://github.com/MaxWinterstein/homeassistant-addons/` and click *Add*.
|
||||||
|
|||||||
4
octoprint-proxy/CHANGELOG.md
Normal file
4
octoprint-proxy/CHANGELOG.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [1.0.0] - 2021-01-03
|
||||||
|
- Initial release
|
||||||
11
octoprint-proxy/Dockerfile
Normal file
11
octoprint-proxy/Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
ARG BUILD_FROM
|
||||||
|
FROM $BUILD_FROM
|
||||||
|
|
||||||
|
ENV LANG C.UTF-8
|
||||||
|
|
||||||
|
RUN apk add haproxy
|
||||||
|
|
||||||
|
COPY run.sh haproxy.cfg /
|
||||||
|
|
||||||
|
RUN chmod a+x /run.sh
|
||||||
|
CMD [ "/run.sh" ]
|
||||||
7
octoprint-proxy/README.md
Normal file
7
octoprint-proxy/README.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Home Assistant Add-on: OctoPrint Proxy
|
||||||
|
|
||||||
|
Small *haproxy* based reverse proxy to have OctoPrint accessible from Home Assistant with a memory consumption less than 10Mbyte.
|
||||||
|
|
||||||
|
Works great with OctoPi based installations, others not tested. Feedback welcome.
|
||||||
|
|
||||||
|
**Remember to enable the *Show in sidebar* option.**
|
||||||
37
octoprint-proxy/config.json
Normal file
37
octoprint-proxy/config.json
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"name": "OctoPrint Proxy",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"slug": "octoprint_proxy",
|
||||||
|
"description": "Access OctoPrint from within Home Assistant",
|
||||||
|
"url": "https://github.com/MaxWinterstein/homeassistant-addons/",
|
||||||
|
"ingress": true,
|
||||||
|
"ingress_port": 80,
|
||||||
|
"panel_title": "OctoPrint",
|
||||||
|
"panel_icon": "mdi:printer-3d-nozzle",
|
||||||
|
"arch": [
|
||||||
|
"armhf",
|
||||||
|
"armv7",
|
||||||
|
"aarch64",
|
||||||
|
"amd64",
|
||||||
|
"i386"
|
||||||
|
],
|
||||||
|
"startup": "application",
|
||||||
|
"boot": "auto",
|
||||||
|
"options": {
|
||||||
|
"octoprint_host" : "octopi",
|
||||||
|
"octoprint_port" : "443",
|
||||||
|
"ssl": {
|
||||||
|
"enabled": true,
|
||||||
|
"verify": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"schema": {
|
||||||
|
"octoprint_host" : "str",
|
||||||
|
"octoprint_port" : "port",
|
||||||
|
"ssl": {
|
||||||
|
"enabled": "bool",
|
||||||
|
"verify": "bool"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"hassio_api": false
|
||||||
|
}
|
||||||
52
octoprint-proxy/haproxy.cfg
Normal file
52
octoprint-proxy/haproxy.cfg
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
global
|
||||||
|
log stdout format raw local0
|
||||||
|
|
||||||
|
chroot /var/lib/haproxy
|
||||||
|
pidfile /var/run/haproxy.pid
|
||||||
|
maxconn 4000
|
||||||
|
user haproxy
|
||||||
|
group haproxy
|
||||||
|
daemon
|
||||||
|
|
||||||
|
# turn on stats unix socket
|
||||||
|
stats socket /var/lib/haproxy/stats
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
# common defaults that all the 'listen' and 'backend' sections will
|
||||||
|
# use if not designated in their block
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
defaults
|
||||||
|
mode http
|
||||||
|
log global
|
||||||
|
option httplog
|
||||||
|
option dontlognull
|
||||||
|
option http-server-close
|
||||||
|
option forwardfor except 127.0.0.0/8
|
||||||
|
option redispatch
|
||||||
|
retries 3
|
||||||
|
timeout http-request 10s
|
||||||
|
timeout queue 1m
|
||||||
|
timeout connect 10s
|
||||||
|
timeout client 1m
|
||||||
|
timeout server 1m
|
||||||
|
timeout http-keep-alive 10s
|
||||||
|
timeout check 10s
|
||||||
|
maxconn 3000
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
# main frontend which proxys to the backends
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
frontend main
|
||||||
|
mode http
|
||||||
|
option httplog
|
||||||
|
#capture request header X-Ingress-Path len 256
|
||||||
|
|
||||||
|
bind *:80
|
||||||
|
default_backend octoprint
|
||||||
|
|
||||||
|
backend octoprint
|
||||||
|
# ref https://community.octoprint.org/t/reverse-proxy-configuration-examples/
|
||||||
|
http-request replace-path ^([^\ :]*)\ /local_octoprint_proxy/(.*) \1\ /\2
|
||||||
|
http-request add-header X-Script-Name %[req.hdr(X-Ingress-Path)]
|
||||||
|
option forwardfor
|
||||||
|
server octoprint OCTOPRINT_HOST:OCTOPRINT_PORT USE_SSL VERIFY_SSL check
|
||||||
BIN
octoprint-proxy/icon.png
Normal file
BIN
octoprint-proxy/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
octoprint-proxy/logo.png
Normal file
BIN
octoprint-proxy/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
30
octoprint-proxy/run.sh
Normal file
30
octoprint-proxy/run.sh
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env bashio
|
||||||
|
set -e
|
||||||
|
|
||||||
|
bashio::log.info "Setting octoprint host: $(bashio::config octoprint_host)"
|
||||||
|
sed -i "s/OCTOPRINT_HOST/$(bashio::config octoprint_host)/g" /haproxy.cfg
|
||||||
|
|
||||||
|
bashio::log.info "Setting octoprint port: $(bashio::config octoprint_port)"
|
||||||
|
sed -i "s/OCTOPRINT_PORT/$(bashio::config octoprint_port)/g" /haproxy.cfg
|
||||||
|
|
||||||
|
if $(bashio::config.true ssl.enabled); then
|
||||||
|
bashio::log.info "SSL communitcation to octoprint enabled"
|
||||||
|
sed -i "s/USE_SSL/ssl/g" /haproxy.cfg
|
||||||
|
|
||||||
|
if $(bashio::config.true ssl.verify); then
|
||||||
|
bashio::log.info "SSL verification enabled"
|
||||||
|
sed -i "s/VERIFY_SSL//g" /haproxy.cfg
|
||||||
|
else
|
||||||
|
bashio::log.info "SSL verification disabled"
|
||||||
|
sed -i "s/VERIFY_SSL/verify none/g" /haproxy.cfg
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
bashio::log.info "SSL communitcation to octoprint not enabled"
|
||||||
|
sed -i "s/USE_SSL VERIFY_SSL//g" /haproxy.cfg
|
||||||
|
fi
|
||||||
|
|
||||||
|
bashio::log.info "Server line: $(cat /haproxy.cfg | grep 'server octoprint')"
|
||||||
|
|
||||||
|
bashio::log.info "Starting haproxy"
|
||||||
|
haproxy -W -db -f /haproxy.cfg
|
||||||
Reference in New Issue
Block a user