Page 3 of 3
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Thursday 29 April 2021 11:58
by waaren
knireis wrote: ↑Thursday 29 April 2021 11:45
2021-04-29 11:42:14.346 Error: EventSystem: problem writing file: /opt/domoticz/userdata/scripts/dzVents/generated_scripts/linphone-init.lua
Seems to be an access issue?
Yes.
I do not use docker yet so cannot advise but would it possible to manually create this folder in the docker env. and set the rights in such a way that domoticz can write these scripts?
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Thursday 29 April 2021 13:06
by Gravityz
did you check if that directory path exists on your pi
i found that it is not so much a rights issue but wether the directory exists.
domoticz can create/write the file but does not create the directories if they do not exist.
path on your pi which you mapped to /opt/docker
****/docker/domoticz
directory path which needs to exist
****/docker/domoticz/scripts/dzVents/generated_script
****/docker/domoticz/scripts/dzVents/scripts
so manually create those directories
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Thursday 29 April 2021 13:09
by knireis
you are right, the directories did not exist (i use a QNAP).
I created them and now the script starts.
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Thursday 29 April 2021 13:22
by Gravityz
good to hear.
i am still not switched over to the docker version but decided some time a go to test it.
every problem i have discovered sofar(JSON file not existing, script errrors, script directory mappings) have been fixed .
still need to figur out if serial drivers on my synology will inteferee with the current package
knireis wrote: ↑Thursday 29 April 2021 13:09
you are right, the directories did not exist (i use a QNAP).
I created them and now the script starts.
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Thursday 29 April 2021 16:35
by waltervl
Gravityz wrote: ↑Thursday 29 April 2021 13:06
directory path which needs to exist
****/docker/domoticz/scripts/dzVents/generated_script
****/docker/domoticz/scripts/dzVents/scripts
so manually create those directories
Is this something that can be done with the Docker composer file so you do not have to do this everytime you update the Domoticz docker image?
Or will updating the Domoticz docker leave this untouched?
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Thursday 29 April 2021 18:01
by knireis
you don't need to do this everytime
you map the drive location to a folder on the host so it is persistent when you upgrade or reinstall the docker
in my case i had to create the specified folders on the host
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Monday 07 February 2022 21:00
by dens1975
I recently moved from the Jadahl package to the docker container. I still having some issues with bash scripts. They are executed and when I look in the docker terminal I see the reason is: wget: not found
So what am I missing here? wget should be installed by default? Or is it some reference somewhere?
Hope someone can point me in the right direction.
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Monday 07 February 2022 23:07
by pvklink
You can login into the docker container and execute wget in the container to check if the command is installed....
sudo docker exec -it domoticz wget
or
sudo docker exec -it domoticz/bin/bash
then: wget
exit
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Tuesday 08 February 2022 13:06
by dens1975
pvklink wrote: ↑Monday 07 February 2022 23:07
You can login into the docker container and execute wget in the container to check if the command is installed....
sudo docker exec -it domoticz wget
or
sudo docker exec -it domoticz/bin/bash
then: wget
exit
Thanks, tried both and first says: OCI runtime exec failed: exec failed: container_linux.go:367: starting container process caused: exec: "wget": executable file not found in $PATH: unknown
second command: wget: command not found
Found command somewhere: apt-get install -y wget
Executed from terminal in docker container
Now it works again! Solved.
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Tuesday 08 February 2022 13:52
by waltervl
Open Docker on your Synology, go to the Domoticz container, select Details, Terminal, and open 'bash'.
Code: Select all
apt-get update
apt-get install wget
It perhaps is needed to use 'sudo' in front of these commands.
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Thursday 10 March 2022 13:32
by Emax
Experimenting further with scripts on the official docker image i notice that blocky scripts are generated ok but on the dzvents part it fails with:
Code: Select all
2021-03-18 21:19:18.108 Status: dzVents: Write file: /opt/domoticz/userdata/scripts/dzVents/generated_scripts/Script #2.lua
2021-03-18 21:19:18.108 Error: EventSystem: problem writing file: /opt/domoticz/userdata/scripts/dzVents/generated_scripts/Script #2.lua
i suspect this is because of a issue with read/writing rights in the container.
I tried to set the correct rights through putty with:
Code: Select all
docker exec -it DomoTest chmod -R 777 /opt/domoticz/userdata/
Just moved from docker container Linuxserver/Domotiz 2020.2 version to official Domoticz docker 2022.1 and got the exact same problem. Creating the directories solved the issue, but the root cause seems to be that the container creates the scripts-directory in /opt/domiticz/scripts/, while Domoticz expects it to be at /opt/domoticz/userdata/scripts/
So it seems to be an issue with creation of the container. Was this already adresses somewhere?
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Thursday 10 March 2022 13:45
by Gravityz
You need to mount /opt/domoticz/userdata to a directory outside of the container
once you do that the script directory under userdata is used
after that manually(only once) create the following directories to that place
in my case
i mounted external directory domoticz/docker to /op/domoticz/userdata
after that i created on my synology
/volume1/docker/domoticz/scripts/dzVents/generated_scripts
/volume1/docker/domoticz/scripts/dzVents/scripts
/volume1/docker/domoticz/scripts/logrotate
/volume1/docker/domoticz/scripts/templates
Emax wrote: ↑Thursday 10 March 2022 13:32
Experimenting further with scripts on the official docker image i notice that blocky scripts are generated ok but on the dzvents part it fails with:
Code: Select all
2021-03-18 21:19:18.108 Status: dzVents: Write file: /opt/domoticz/userdata/scripts/dzVents/generated_scripts/Script #2.lua
2021-03-18 21:19:18.108 Error: EventSystem: problem writing file: /opt/domoticz/userdata/scripts/dzVents/generated_scripts/Script #2.lua
i suspect this is because of a issue with read/writing rights in the container.
I tried to set the correct rights through putty with:
Code: Select all
docker exec -it DomoTest chmod -R 777 /opt/domoticz/userdata/
Just moved from docker container Linuxserver/Domotiz 2020.2 version to official Domoticz docker 2022.1 and got the exact same problem. Creating the directories solved the issue, but the root cause seems to be that the container creates the scripts-directory in /opt/domiticz/scripts/, while Domoticz expects it to be at /opt/domoticz/userdata/scripts/
So it seems to be an issue with creation of the container. Was this already adresses somewhere?
[/quote]
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Monday 14 March 2022 17:11
by Emax
Gravityz wrote: ↑Thursday 10 March 2022 13:45
You need to mount /opt/domoticz/userdata to a directory outside of the container
once you do that the script directory under userdata is used
after that manually(only once) create the following directories to that place
in my case
i mounted external directory domoticz/docker to /op/domoticz/userdata
after that i created on my synology
/volume1/docker/domoticz/scripts/dzVents/generated_scripts
/volume1/docker/domoticz/scripts/dzVents/scripts
/volume1/docker/domoticz/scripts/logrotate
/volume1/docker/domoticz/scripts/templates
This is about fixing the issue, I wonder about what is causing the issue. Why are those directories not created when installing the container? And why do I have and /opt/domoticz/scripts with has all the directories that are missing under /opt/domoticz/userdata/scripts, while these directories are not used from /opt/domoticz/scripts. To me that sounds like the scripts directory was created in an incorrect folder when installing the docker container.
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Monday 14 March 2022 17:23
by Gravityz
i think this is by design.
it is not an error like you think it is.
you can install the container and put your scripts and the database in the default directory.
as far as i can tell this works.(this is the reason the default directories are created inside the container)
problem however it that every time you upgrade the container you need to move all the custom files to inside the container.
this is why most container support the ability to mount an external directory to an internal mountpoint.
this way you only need to upgrade the container and everrything(database, scripts etc) stays outside the container but mapped to the internal directory of that container.
now why do we not create those external directories, easy everybody has different systems(pi,synology,pc) and is using different directories and mountpoints.
you can not create such a thing because it depends on the platform.
the minute i found out that i could solve the problem by creating external directories i did. I then tried to automate this but since it was only necessary the first time i stopped.
i made myself a really good readme so that i know how to install, upgrade and downgrade the domoticz container without loosing data
hopefully things are clear now and if i misunderstood your problem then hopefully somebody else can answer it.
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Friday 17 June 2022 15:25
by sammyke007
waltervl wrote: ↑Tuesday 08 February 2022 13:52
Open Docker on your Synology, go to the Domoticz container, select Details, Terminal, and open 'bash'.
Code: Select all
apt-get update
apt-get install wget
It perhaps is needed to use 'sudo' in front of these commands.
I'm going to switch to a Dockered Domoticz and I need wget, jq and oathtool for scripts. This does indeed work, but I guess this installs inside the container so you'll have to run command after each update / container recreation, correct?
Is it possible to edit the "official" dockerfile so you can pass extra packages as an environment variable?
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Friday 17 June 2022 23:20
by waltervl
Yes, you have to install this every time you update your container
I stopped with docker but I know there was some discussion about this topic on the forum. But no real solution.
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Saturday 18 June 2022 9:15
by sammyke007
Ok, that's what I taught indeed. May I ask what type of installation you prefer now?
I'm running Proxmox with a VM for HASS OS and an LXC container for my Docker containers (zigbee2mqtt, zwavejs2mqtt, mosquitto, ...). Do you use a full VM for Domoticz?
Re: Using Docker and userscripts (Lua, DzVents, Python)
Posted: Saturday 18 June 2022 14:41
by waltervl
I use a x86 board running Ubuntu. Only function is Domoticz so no need to use docker or VM.