Sign inSign up

roobbb/owserver

By roobbb

•Updated about 3 years ago

runs 1-wire server based on debian:stable-slim and installed via apt-get and flexible configuration

Image
1

10K+

roobbb/owserver repository overview

⁠One-Wire Docker-Container

⁠Variables declared inside docker-file for setting defaults:
VARVALUEhint
WEB_PORT2121sets value inside /etc/owfs.conf for http port
OWFS_PORT4304sets value inside /etc/owfs.conf for owserver's port
FTP_PORT2120sets value inside /etc/owfs.conf for ftp port
OW_DEVICEonewiresets value inside /etc/owfs.conf for mapped device
OW_SERVER127.0.0.1sets value inside /etc/owfs.conf for owserver's adress
use 127.0.0.1 when a locally installed service should have access or when start container with --net=host option
set a name or alias when another container should get access see examples for more details

Those variables can be overwritten when starting the container. The new value from cli will be put inside the containers /etc/owfs.conf again and substitute the defaults.

⁠Variables evaluated by main script (start.sh) when starting the container
VARVALUEhint
CUSTOM_CONFIG_ENABLED1starts with full custom config file, other than 1 means disabled
CUSTOM_CONFIG_FILE/path/filenameset the full path and filename of the custom config
make sure you mapped it in there (e.g. -v /mypath/to_my_config:/root/.local/share)
SERVICES_LVL1, 2 or 31 starts owserver only, no owhttpd or owftpd
2 starts owserver and owhttpd, no owftpd
3 start all 3 services
leaving this away or giving any other value than 1-3 means use the default: 3
⁠run example: start with standard config (a udev rule sets a denkovi-usb-device to /dev/onewire):

let's assume you have set a symlink for your device via udev-rule like found here https://wiki.fhem.de/wiki/OWServer_%26_OWDevice#Konfiguration_von_owserver⁠

set udev-rule for a Denkovi-Device on host*
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="DAE001xy", SUBSYSTEMS=="usb", ACTION=="add", MODE="0660", GROUP="plugdev", SYMLINK+="onewire"

docker run -d \
   --name=owserver \
   --net=host \
   --restart=always \
   -v /etc/localtime:/etc/localtime:ro \
   --device=/dev/onewire \
roobbb/owserver
  • standard config binds owserver on localhost:4304 and owhttpd on port 2121
  • if another process on your host should connect to owserver, the unix socket localhost:4304 doesn't work with docker - therefore owserver is set on 127.0.0.1:4304 by default

* please check with "ls -l /dev/onew*" if the udev-rule creates a symlink which links the correct device e.g. ttyUSB1; if not, try to take SUBSYSTEM=="tty" instead of SUBSYSTEMS=="usb"
pls. find some more details under Troubleshooting page on Github https://github.com/roobbb/owserver/wiki/6.-Troubleshooting#2022-06-22⁠

⁠run example: start owserver only with default values
docker run -d \
   --name=owserver \
   --net=host \
   --restart=always \
   -v /etc/localtime:/etc/localtime:ro \
   --device=/dev/onewire \
   -e SERVICES_LVL=1 \
roobbb/owserver
⁠run example: overwriting defaults

If your host's device is other than "onewire", then you always have to set "OW_DEVICE=" to that device name. Otherwise you can leave it away (because the default comes in affect).

docker run -d \
   --name=owserver \
   --net=host \
   --restart=always \
   -v /etc/localtime:/etc/localtime:ro \
   --device=/dev/ttyUSB0 \
   -e WEB_PORT=1234 \
   -e OW_DEVICE=ttyUSB0 \
   -e FTP_PORT=21 \
roobbb/owserver
  • this example keeps OWFS_PORT to it's default (4304) but changes the rest
  • you can set one, all values or omit some

If you like to set your own owfs.conf, then pass the variable CUSTOM_CONFIG_ENABLED=1 and map your config-path into the container's file system und finally tell the main script where you put your own config file.

⁠run example: running a custom config
docker run -d \
   --name=owserver \
   --net=host \
   --restart=always \
   -v /etc/localtime:/etc/localtime:ro \
   -v /mypath/to_my_config:/root/.local/share \
   --device=/dev/ttyS0 \
   -e CUSTOM_CONFIG_ENABLED=1 \
   -e CUSTOM_CONFIG_FILE=/root/.local/share/owfs.example \
roobbb/owserver:dev
  • starts the dev-version with custom config "owfs.example" wich activates the fake-server (you could omit the paramter " --device=/dev/ttyS0" in this example, because the owfs.example doesn't point to any device)
  • you should reach the Web-Interface via http://yourHost:2121/⁠ even if you dont have a real 1-wire device connected/ mapped
⁠example enter the running container

docker exec -it owserver /bin/bash

⁠stopping the container

docker stop owserver

⁠example definition in FHEM (when FHEM is installed locally and running on your host directly)

define myOWServer OWServer 127.0.0.1:4304
attr myOWServer room OneWire

⁠example when FHEM even runs in a container

add a new user-defined-network

  docker network create mynet
  • edit owfs.example and change server ip-address from 127.0.0.1 to the name of the docker container which we want to start (owserver) or its network-alias (myserver), even the server's port should be the same as what we want to map

  • start owserver-container with new network and alias and map ports as required

    docker run -d \
      --rm \
      --name=owserver \
      --net=mynet \
      --network-alias myserver \
      -p 2121:2121 \
      -v /etc/localtime:/etc/localtime:ro \
      -v /mypath/to_my_config:/root/.local/share \
      --device=/dev/ttyUSB0 \
      -e CUSTOM_CONFIG_ENABLED=1 \
      -e CUSTOM_CONFIG_FILE=/root/.local/share/owfs.example \
    roobbb/owserver:dev
    
  • check if the web-interface is reachable via http://yourHost:2121/⁠ or via http://localhost:2121/⁠

  • start the official FHEM container as it matches your requirements (for more details please check Readme on Github https://github.com/fhem/fhem-docker⁠ or FHEM board https://forum.fhem.de/index.php?topic=89745.0⁠)

  • please make sure FHEM is member of at least one network where owserver is connected to (mynet in this example)

example for this testing here:

  docker run -d --rm --net=mynet -p 8083:8083 --name fhem  fhem/fhem
  • please check if you can reach FHEM's web-if via http://yourHost:8083/fhem⁠
  • define a device for owserver in FHEM - let's assume you wrote "myserver:4304" into your owfs.example as owserver's adress

define myLocalOWServer OWServer myserver:4304
attr myLocalOWServer room OWDevice
attr myLocalOWServer nonblocking 1

  • you should see lots of readings right after entering the define-command - if not, please check server adress+port as defined in owfs.example and start-command of owserver-container

  • of course you can start owserver and FHEM with the option "--net=host" and both of them can be member of further networks as long as both share at least one network

  • if you use "--net=host" you have to set owserver to 127.0.0.1:4304 again - just like you should, when FHEM would run as a local service

⁠another example with standard config and network-alias
  docker run -d --rm \
    --name=owserver \
    --net=testnet \
    --network-alias tryme \
    -p 1234:1234 \
    -v /etc/localtime:/etc/localtime:ro \
    -v ~/dockertests/owserver:/root/.local/share 
    --device=/dev/ttyS0 \
    -e OW_SERVER=tryme \
    -e WEB_PORT=1234 \
  roobbb/owserver:dev
  • the mapped port must be same as the web port and network-alias should be the same as server address
  • when you omit network-alias the server address must be the same as the container name (--name=...)
⁠Troubleshooting

2021-09-05:
I had some trouble getting the newly updated container to run. There were log messages likes these:

  cannot read realtime clock: Operation not permitted

Even when I set --privileged it did not start - owserver just failed.
This issue only occurred on my raspberry which runs dietpi-os. No issues while testing on my amd64-machine. It turns out the libseccomp2 is outdated and should be updated manually as described here: https://github.com/itzg/docker-minecraft-server/issues/755#issuecomment-781615497⁠
After that the latest push runs fine. But side-effects may appear ... lets give it a try

What I did:
checked installed version

  myDietpi@myServer:~ $ dpkg -l | grep libsecc
  ii  libseccomp2:armhf             2.3.1-2.1+deb9u1                  armhf        high level interface to Linux seccomp filter

checked for latest armhf version under suggested link: http://ftp.debian.org/debian/pool/main/libs/libseccomp/⁠
downloaded the matching version (which was still the same as Powerbolt1989 wrote in his post)

  wget http://ftp.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.1-1_armhf.deb

and finally installed it

  sudo dpkg -i libseccomp2_2.5.1-1_armhf.deb

Tag summary

Content type

Image

Digest

sha256:ea77c516e…

Size

29 MB

Last updated

about 3 years ago

docker pull roobbb/owserver