Added Hass.io Ingress support - #63
Conversation
|
💖 Thanks for opening this pull request! 💖 If your PR gets accepted and merged in, we will invite you to the project 🎉 |
| location /data/firmwares { | ||
| } | ||
|
|
||
| location ^~ /data/ { |
There was a problem hiding this comment.
Note: I added ^~ to this line so that it actually matched. In the current master version I found I was able to access /data/MyConfig.json which exposes your credentials.
| \ | ||
| && apk add --no-cache --virtual .build-dependencies \ | ||
| git=2.22.0-r0 \ | ||
| git=2.22.2-r0 \ |
There was a problem hiding this comment.
The docker image failed to build without it...so 🤷♂
| "hassio_api": true, | ||
| "hassio_role": "default", | ||
| "ingress": true, | ||
| "ingress_port": 8099, |
There was a problem hiding this comment.
Is there a reason why the port is hardcoded for this add-on?
There was a problem hiding this comment.
The reasoning behind it is that the port is hard coded in the nginx ingress, so should hass.io ever change it's default port, it wouldn't matter as we have explicitly defined it here.
| ], | ||
| "ports": { | ||
| "9541/tcp": 9541 | ||
| "9541/tcp": null |
There was a problem hiding this comment.
That seems like a bad idea. How do the firmware updates get across?
There was a problem hiding this comment.
TBH, I haven't used the firmware update process. Initially I figured it would go through the ingress, but I guess that wouldn't work since it would need to be authenticated.
| "certfile": "fullchain.pem", | ||
| "keyfile": "privkey.pem" | ||
| }, | ||
| "panel_icon": "mdi:network", |
| # ============================================================================== | ||
|
|
||
|
|
||
| # The general idea is that the nginx server will be configured to have a root of |
There was a problem hiding this comment.
I like comments in code, but this extreme.
| declare ingress_dir="${ingress_root_dir}${ingress_entry}" | ||
|
|
||
| # Create nginx server | ||
| sed "s#%%ingress_entry%%#${ingress_entry}#g" \ |
There was a problem hiding this comment.
Please follow the standard as we do in the community add-ons. I like to keep method the same across all add-ons to be able to maintain things.
| awk '1;/public function read\(/{ print "if ($key == \"login\" && @$_SERVER[\"ASSUMED_AUTH\"] == \"1\") return \"0\";"}' \ | ||
| "${app_root_dir}/includes/Config.php" > "${app_root_dir}/includes/IngressConfig.php" | ||
|
|
||
| cat << EOF > "${app_root_dir}/includes/IngressInit.php" |
There was a problem hiding this comment.
There is no reason to do this in Bash.
|
|
||
| sed -i "s#%%certfile%%#${certfile}#g" /etc/nginx/nginx.conf | ||
| sed -i "s#%%keyfile%%#${keyfile}#g" /etc/nginx/nginx.conf | ||
| sed "s#%%certfile%%#${certfile}#g ; s#%%keyfile%%#${keyfile}#g" /etc/nginx/servers/direct-ssl.disabled > /etc/nginx/servers/direct-ssl.conf |
There was a problem hiding this comment.
Please don't combine replacements in a single call.
| @@ -0,0 +1,47 @@ | |||
| #!/usr/bin/with-contenv bashio | |||
There was a problem hiding this comment.
Ingress is not an application. Please split across the nginx.sh and tasmoadmin.sh
| rewrite ^/([a-zA-Z_]+)/?$ /index.php?page=$1; | ||
| } | ||
| } | ||
| include /etc/nginx/servers/*.conf; |
There was a problem hiding this comment.
Please use the Nginx config structure as used by other community add-ons as well.
Which is not this. Keeping things similar makes maintenance easier.
There was a problem hiding this comment.
This was how vscode did it... https://github.com/hassio-addons/addon-vscode/tree/master/vscode/rootfs/etc/nginx/servers
|
Thanks for your work, but this is made from a single add-on perspective (instead of the similarity between all the add-on in this repository). One of the main reasons to use TasmoAdmin is to manage your Tasmota devices across your network centrally, including firmware upgrades. This makes this add-on unsuitable for Ingress from a general standpoint. I'm really not keen on supporting Ingress in this application. |
|
If you not support ingress for me it is not addon for Home Assistant. It is as other external software. If it is addon to Hassio i think that should supoort ingress. It is my opinion. We need central managment for all and if we install in Hassio we want have access from Hassio GUI. Look many people need this in GUI as side bar - Ingrees |
|
I completely agree! Honestly the only rub I see is that without also exposing the container port then you can't do firmware upgrades of your devices. But I imagine an enhancement to the hass.io ingress could be made to allow an addon to whitelist some anonymous paths which would then allow our devices access to the firmware files and avoid the need to expose the port. But until that happens, I think opening the port is a fine workaround but we'd still get the benefit of easy access to the tasmoadmin web ui to manage the device settings. |
That is nice, but not all add-ons are capable or sane to use Ingress on. Ingress is a feature, not a requirement. For example, some add-ons require non-TCP ports, others serve things that are not "inside" Home Assistant or the application itself is simply not able to handle dynamic subfolders in requests paths.
Home Assistant has offered a
Which is one of the main goals of this project! Centrally managing your Tasmota Devices. For control, we use Home Assistant, right?
That is not how Ingress works. |
But that requires that I expose that port externally just to manage the devices from the UI. The purpose of the ingress is to allow access to the web applications without having to expose a given port. |
Only if you actually want to upgrade/configure devices when you are externally yourself, other cases that seems not needed. |
|
Okay...I appreciate the little bit of direction in the review, i've made many updates...feel free to continue to close the Issues that I'm sure will continue to roll in ;) If anyone wants a version of the TasmoAdmin addon with Ingress support, i've setup a hass.io repository you can add: |
|
@ammmze In all fairness and friendliness, that is really short-sighted to say like that. Some users want A others want B, there is no possible way to please everyone. For example, Grafana added Ingress, and I'm still closing issues that continue to roll in asking to remove it. So it is not black or white, it is a choice that I made carefully. I'm fine with somebody not to agree on that. That is what forks are for 👍 |
|
Not trying to be insulting or anything. Though to be honest it seems like it would be relatively easy to have a configuration option to enable/disable the ingress which gives the user the ability to choose. After all, Home Assistant was designed to give the user the ability to customize, why should the hass.io add-ons be any different. |
|
Hass.io cannot disable Ingress, it is statically enabled in the add-on configuration. |
|
Sounds like an opportunity for improvement! If nothing else disable the ingress server in nginx though maybe hass.io may consider it as not having come up...idk. My point is that we're not at the end of the road. Things can (and should) change and be enhanced over time. |
|
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread. |
Proposed Changes
Related Issues