Using Docker and userscripts (Lua, DzVents, Python)
Posted: Thursday 18 March 2021 19:28
I just want to bring up a discussion about using user scripts (Lua, python, DzVents) running outside the internal eventsystem and in a Domoticz Docker. This install gets more attention but it also should be easy to maintain by the user. Let us see if we come to a possible solution to configure Domoticz and the Docker image so it will work easily. I hope experience Docker users can shine a light on this.
Use case: When using the Domoticz Docker install users have difficuly to setup and later update their own users scripts (lua, Python, DzVents). See viewtopic.php?f=4&t=35454
Currently advised is to create a folder on the host (eg ./config) and map that to /opt/domoticz/userdata in the docker.
When launching the docker container for the first time, a plugin folder is created in the userdata folder You need to place your python plugins in this folder.
When updating the Docker image the plugins are not erased by the new image. Everything OK!
Also the database is created in the userdata folder so no issues when updating.
But what with the users scripts?
You cannot create a scripts folder in userdata because there is already a scripts folder that contains all kind of script that are needed to run Domoticz (and DzVents etc). So everytime a new image is imported the scripts folder will be overwritten by the Docker image.
Questions:
1. Is this the correct conclusion? Will userscripts be overwritten in an Domoticz Docker update?
2. Is there a Docker configuration way that some kind of userdata scripts folder can be merged with the scripts folder in the Docker image?
3. Are the lua, python and DzVents scripts from the eventsystem really stored in the database and no issues when updating?
Possible solution I see when the questions above give no satisfying solution and that would have impact on the Domoticz sources/configuration:
Is it possible to create a userscripts folder in userdata (like the plugins folder) and have Domoticz also look at that folder for scripts next to the original scripts and the scripts from the eventsystem. So at startup of Domoticz deamon look at 2 folders scripts and userscripts ?
Use case: When using the Domoticz Docker install users have difficuly to setup and later update their own users scripts (lua, Python, DzVents). See viewtopic.php?f=4&t=35454
Currently advised is to create a folder on the host (eg ./config) and map that to /opt/domoticz/userdata in the docker.
When launching the docker container for the first time, a plugin folder is created in the userdata folder You need to place your python plugins in this folder.
When updating the Docker image the plugins are not erased by the new image. Everything OK!
Also the database is created in the userdata folder so no issues when updating.
But what with the users scripts?
You cannot create a scripts folder in userdata because there is already a scripts folder that contains all kind of script that are needed to run Domoticz (and DzVents etc). So everytime a new image is imported the scripts folder will be overwritten by the Docker image.
Questions:
1. Is this the correct conclusion? Will userscripts be overwritten in an Domoticz Docker update?
2. Is there a Docker configuration way that some kind of userdata scripts folder can be merged with the scripts folder in the Docker image?
3. Are the lua, python and DzVents scripts from the eventsystem really stored in the database and no issues when updating?
Possible solution I see when the questions above give no satisfying solution and that would have impact on the Domoticz sources/configuration:
Is it possible to create a userscripts folder in userdata (like the plugins folder) and have Domoticz also look at that folder for scripts next to the original scripts and the scripts from the eventsystem. So at startup of Domoticz deamon look at 2 folders scripts and userscripts ?