Add option 'eval'

This commit is contained in:
Max Winterstein
2021-02-27 00:34:33 +01:00
parent 5ffd106fa6
commit e76b9908d5
5 changed files with 85 additions and 35 deletions

View File

@@ -1,5 +1,8 @@
# Changelog # Changelog
## [0.8.0] - 2021-02-26
- Introduce `eval` configuration option (see *Documentation* for more)
## [0.7.0] - 2021-02-13 ## [0.7.0] - 2021-02-13
- Added some more ports to be possibly exposed - Added some more ports to be possibly exposed

51
ioBroker/DOCS.md Normal file
View File

@@ -0,0 +1,51 @@
# Home Assistant Add-on: ioBroker
## Installation
After installation, and successful startup, the ioBroker instance should be available at port `8081`.
If your HA instance is running with SSL support, the `OPEN WEB UI` button might not work correctly.
**Note:** As this image is not based on the official home assistant add-on images the Supervisor has some delay on the add-on state (i guess this is the reason).
It might be up and running while the `Info` tab is not aware of this right now. Page reload might help.
## Updating `js-controller`
The bundled `js-controller` is not (always) the most recent version. (Thanks to *tintim* [#21](1)).
Updating can be archived manually via `portainer` or by using the [`eval` setting](#eval-(string)).
Manually:
Jump into the container via `portainer` and run line by line:
```bash
maintenance on
iobroker update
iobroker upgrade self
curl -sL https://iobroker.net/fix.sh | bash
```
## Configuration
### `eval` (string)
Allows to pass some bash commands to run every time before the start of ioBroker.
This can be used e.g. to upgrade the `js-controller`.
Example:
```yaml
eval: "iobroker update && iobroker upgrade self"
```
You might want to disable this after a run.
*Only use when you know what you are doing!*
## TODO
* Get the panel integration working (if this is possible)
* Use some official base image (maybe running the buanet dockerfile onto office image work)
## Technical notes
The `buanet` docker image contains some pretty useful startup script.
To ensure data stays persistent across restarts I simply softlink `/data` to `/opt/iobroker`.
I removed some check that was not compatible with the symlink and not needed in our case.
I added the unmodified version as a reference.
[1]: https://github.com/MaxWinterstein/homeassistant-addons/issues/21

View File

@@ -1,14 +1,20 @@
---
# 🚨 !!Important Update Notice!! 🚨 ### 🚨 Important Inforation 🚨
This addon recently switched to pre-build images. The Update progress might fail when the installed version is <0.6.0. * This addon recently switched to pre-build images. The Update progress might fail when the installed version is <0.6.0.
Copy your *Configuration* to your clipboard and Uninstall/Install manually. Copy your *Configuration* to your clipboard and Uninstall/Install manually.
* I do not guarantee that your ioBroker configuration will not get deleted! This is some experimental release!
--- ---
# Home Assistant Add-on: ioBroker # Home Assistant Add-on: ioBroker
--- ![Supports aarch64 Architecture][aarch64-shield]
## 🚨 I do not guarantee that your ioBroker configuration will not get deleted! This is some experimental release! 🚨 ![Supports amd64 Architecture][amd64-shield]
--- ![Supports armv7 Architecture][armv7-shield]
![Supports armhf Architecture][armhf-shield]
![Supports i386 Architecture][i386-shield]
<a href="https://www.buymeacoffee.com/MaxWinterstein" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="41" width="174"></a>
This is a pretty basic implementation of ioBroker as Home Assistant Add-on. This is a pretty basic implementation of ioBroker as Home Assistant Add-on.
It is meant to provide some playground. It is meant to provide some playground.
@@ -16,23 +22,12 @@ It is meant to provide some playground.
Mostly created as playfield for: https://blog.fuzzymistborn.com/controlling-eufy-security-devices-with-iobroker/ Mostly created as playfield for: https://blog.fuzzymistborn.com/controlling-eufy-security-devices-with-iobroker/
and https://community.home-assistant.io/t/eufy-camera-integration/121758 and https://community.home-assistant.io/t/eufy-camera-integration/121758
See the Documentation (DOCS.md) for more info.
**This is no official add-on, neither from Home Assisant, nor from ioBroker.** **This is no official add-on, neither from Home Assisant, nor from ioBroker.**
## Installation [aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
After installation, and successful startup, the ioBroker instance should be available at port `8081`. [amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
If your HA instance is running with SSL support, the `OPEN WEB UI` button might not work correctly. [armhf-shield]: https://img.shields.io/badge/armhf-no-red.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg
**Note:** As this image is not based on the official home assistant add-on images the Supervisor has some delay on the add-on state (i guess this is the reason). [i386-shield]: https://img.shields.io/badge/i386-no-red.svg
It might be up and running while the `Info` tab is not aware of this right now. Page reload might help.
## TODO
* Get the panel integration working (if this is possible)
* Use some official base image (maybe running the buanet dockerfile onto office image work)
## Technical notes
The `buanet` docker image contains some pretty useful startup script.
To ensure data stays persistent across restarts I simply softlink `/data` to `/opt/iobroker`.
I removed some check that was not compatible with the symlink and not needed in our case.
I added the unmodified version as a reference.

View File

@@ -1,6 +1,6 @@
{ {
"name": "ioBroker", "name": "ioBroker",
"version": "0.7.0", "version": "0.8.0",
"image": "maxwinterstein/homeassistant-addon-iobroker-{arch}", "image": "maxwinterstein/homeassistant-addon-iobroker-{arch}",
"webui": "http://[HOST]:[PORT:8081]/", "webui": "http://[HOST]:[PORT:8081]/",
"slug": "iobroker", "slug": "iobroker",
@@ -11,8 +11,12 @@
"arch": ["armv7", "aarch64", "amd64"], "arch": ["armv7", "aarch64", "amd64"],
"startup": "application", "startup": "application",
"boot": "auto", "boot": "auto",
"options": {}, "options": {
"schema": {}, "eval" : ""
},
"schema": {
"eval" : "str?"
},
"ports": { "ports": {
"8081/tcp": 8081, "8081/tcp": 8081,
"8082/tcp": null, "8082/tcp": null,

View File

@@ -10,13 +10,7 @@ if find /data/iobroker -maxdepth 0 -empty | read v; then
cp -r -v /opt/iobroker_ori/* /opt/iobroker/ cp -r -v /opt/iobroker_ori/* /opt/iobroker/
chown -R $SETUID:$SETGID /data/iobroker/ chown -R $SETUID:$SETGID /data/iobroker/
fi fi
## some debugging stuff
#echo ---
#ls -liah /opt/
#echo ---
#ls -liah /data/iobroker
#echo ---
#ls -liah /opt/iobroker/
# end hass addon custom mount block # end hass addon custom mount block
# Setting healthcheck status to "starting" # Setting healthcheck status to "starting"
@@ -497,6 +491,9 @@ echo ' '
echo "Starting ioBroker..." echo "Starting ioBroker..."
echo ' ' echo ' '
echo "Running 'eval' commands"
eval $(jq -r .eval /data/options.json)
# Setting healthcheck status to "running" # Setting healthcheck status to "running"
echo "running" > /opt/scripts/.docker_config/.healthcheck echo "running" > /opt/scripts/.docker_config/.healthcheck