Announcement

Collapse
No announcement yet.

UltraLighting3 inside of docker - it is totally possible

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    UltraLighting3 inside of docker - it is totally possible

    OK - I had done a bunch of searching on this forum as a new user. It seems like a couple of folks were attempting to run UtlraLighting3 inside of docker and gave up because the standard docker networking (bridge or host) were a little wonky. Well - they solved all that with "macvlan" enabled networking. Just wanted to share with you what actually works.

    Context:
    1) I have a home network on 192.168.90.0/24 which means I have ips of 1-254 to play with inside this network.
    2) I reserve for static addressing of things I know about and care about ips from 1-127 and 128-254 are set up as DHCP distributed
    3) I have a home automation server running on a NUC that is hard wired and on a IP in the manual range - it runs CentOs 8 and docker on top of it.
    4) I have carved out a smaller range of 192.168.90.112/28 (meaning the ips ending with 112-127) to be managed by docker in this example for the values I'm showing below.

    What I did:
    1) create a docker network that understands the full subnet for my network, but that will only issue IPs for 192.168.90.112/28 to the containers it spins up. Use "macvlan" type which will actually bring up containers as their own fully fledged IP peers to the other devices on the lan - beware - this will consume an IP per container brought up on that network - plus the one IP for the gateway. So the IP is going to be completely different from the docker host when you go to login to the homeseer app.

    Code:
    docker network create -d macvlan -o parent=enp0s25 \
      --attachable=true \
      --subnet 192.168.90.0/24 \
      --gateway 192.168.90.1 \
      --ip-range 192.168.90.112/28 \
      --aux-address 'host=192.168.90.112' \
      mynet
    2) On my OS the primary ethernet network is "enp0s25" and I'm going to create a internal virtual nic card inside the CentOs host:
    Code:
    ip link add mynet-shim link enp0s25 type macvlan  mode bridge
    3) Assign the 192.168.90.112 ip address specifically to the virtual network interface
    Code:
    ip addr add 192.168.90.112/32 dev mynet-shim
    4) bring up the virtual nic:
    Code:
    ip link set mynet-shim up
    5) Add a static route to the virtual nic
    Code:
    ip route add 192.168.90.112/28 dev mynet-shim
    6) run docker based on "marthoc"'s image on docker hub (ACM0 = my zwave stick)

    Code:
    docker run -d --name homeseer \
      --network=mynet \
      --restart always  \
      -v /mnt/backup:/backup \
      -v /home/davequick/homeseer:/HomeSeer \
      -p 80:80 \
      -p 10200:10200 \
      -p 10300:10300 \
      -p 10401:10401 \
      -p 11000:11000 \
      -p 56700:56700/udp \
      --device /dev/ttyACM0:/dev/ttyUSB0 \
      marthoc/homeseer
    7) Rejoice - now all udp traffic on 56700 makes it to and from the docker container just fine and UltraLighting3 works fine.


    ---

    Anyway - just figured I'd save other the hassle for anyone else attempting to do this.
    Last edited by davequick; June 27, 2019, 06:51 PM. Reason: make it so the docker invoke doesn't go into a horizontally scrollable box. Looks better this way.
Working...
X