Announcement

Collapse
No announcement yet.

HS3 in Docker Container

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

    HS3 in Docker Container

    I currently have my HS3 server running in a Win8.1 virtual machine under Hyper-V on a Windows 2016 Server. Everything is working just fine and it stable. So you ask "why change it?".

    I've been working with Docker for Windows lately and have deployed my Homebridge service, which was running in the same VM as HS3, to a Linux container without any issues. It runs faster and has eliminated the occasional timeout with homekit api. Being encouraged by this I have started investigating moving HS3 to a windows container. The benefits would be less resource consumption and not having to maintain the VM with patching and updates. I would simply have to take down the container every so often and create a new one which will update all the components.

    Before anyone suggests that I switch to the Linux version of HS3, I have considered it and I would like to attempt the Windows route first. I have not switched my configuration to Linux yet and since HS3 is a native Windows application this is where I would like to start.

    The installation of HS3 in the container was successful. However I cannot get the HS3 application to start. Since containers are versions of Windows Server without the desktop experience, I suspect that it will not start because it's attempting to launch the GUI. There are no errors in application or system logs and it's not getting to the point where it creates the HS3 log, so I have no errors to provide.

    Does anyone know of a way to launch HS3 in Windows without the GUI?

    Thanks for your help!

    #2
    Curious whether you have a command line using Docker?

    Note here I have never utilized Docker.

    Here way back in early Windows Homeseer 3 I would run plugins via the command line to test them.
    - Pete

    Auto mator
    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

    HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
    HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

    X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

    Comment


      #3
      Yes, you can initiate either a cmd shell or powershell. There are various ways to inject a command into the container at the time it is built or after it has started. You can also attach to detached container or run it in interactive mode.

      It is just like managing a cloud instance of a Windows server or one that does not have the desktop experience installed. When you login you get a powershell prompt. The latest version of Server (1709) doesn't even have an option to add the desktop. You can use external tools on other machines (Honolulu) to manage. Windows Server is becoming more like Linux all the time

      Comment


        #4
        Originally posted by HTGeek View Post
        ... The installation of HS3 in the container was successful. However I cannot get the HS3 application to start. Since containers are versions of Windows Server without the desktop experience, I suspect that it will not start because it's attempting to launch the GUI. There are no errors in application or system logs and it's not getting to the point where it creates the HS3 log, so I have no errors to provide.

        Does anyone know of a way to launch HS3 in Windows without the GUI?

        Thanks for your help!
        Run HS3 as a service (search threads on this)

        Comment


          #5
          Thanks for the suggestion Claude, I have searched and read the many posts on running HS3 as a "service". However, I think the most telling post was from macromark https://forums.homeseer.com/showthread.php?t=184724 where he states "HS3 doesn't run as a Windows service. We did this intentionally to mitigate support traffic caused by incompatible Windows drivers" and provides a "how to" using task scheduler to launch HS3. I use this method on my Hyper-V Windows VM.

          I have also attempted to use NSSM as you have suggested but with no success in the container. NSSM works fine and indicates the service has started but no HS3 log is created as it appears to "hang" just as it does when launched from a command prompt.

          I'm now working on an experiment to prove the theory that any application will start and execute as long as it does not execute any instructions involving a form or window and when it does it will wait indefinitely for a resource which does not exist in the container. Even NSSM behaved this way, when you supply the required parameters it operates in a "command line" mode displaying only to the console but when you don't it attempts to launch the GUI and hangs.

          My experiment is to write a simple forms app in VB which will write messages to the console and then reference a form. I'm guessing that I will see the console messages and then it will hang without issuing any errors.

          stay tuned....

          Comment


            #6
            Originally posted by HTGeek View Post
            ... Even NSSM behaved this way, when you supply the required parameters it operates in a "command line" mode displaying only to the console but when you don't it attempts to launch the GUI and hangs ...
            I'm puzzled at why HS3 would launch the GUI under NSSM. It may be a 'container' thing, although I can't see the logic, but I trust it does as you say.

            In normal Windows, HS3 certainly doesn't launch the GUI.

            Comment


              #7
              My research has concluded and my theory was proved to be correct.

              First I created a simple VB app which writes messages to the console and then attempts desktop interaction in two ways. The first is a messagebox (the built in method of displaying messages in .Net framework) and the second is a form with no controls.

              The console messages appear as predicted and the messagebox caused an exception until I changed the "MessageBoxOptions.ServiceNotification" on the call and this eliminated the exception. This is not the default and I doubt many developers would set this option unless they anticipated that the application would be run as a service.

              The form does cause the application to hang. I was able to run the application in debug in the docker container and it is hung in a .Net Framework thread operation "System.Windows.Forms.Application.ThreadContext.RunMessageLo opInner". I did a little research and found an article on how Forms applications could hang when an internal "hidden" window used by SystemEvents class is not receiving messages and the UI thread blocks indefinitely. Hence, no error or exception is thrown.

              HS3 does not have a GUI per-say, but it does launch a form at start-up which displays a progress bar and any messages during the start-up sequence. Closing the form is the way to shut down the application gracefully. This form is created and "hidden" when using the NSSM and Scheduled tasks method of starting the application. The ".NET-BroadcastEventWindow" hidden window is also created, if it doesn't already exist, but in the docker container these hidden windows cannot be created.

              Since the problem appears to be related to invoking a windows Form, this could be avoided by HS3 bypassing the Form during startup. I've never seen a pop-up message from HS3 but if MessageBox is being used they would have to add the ServiceNotification option. I tried to use the /nosplash command line option when starting HS3 in the hopes that they might be using a splash window during startup but that did not work.

              Unless one of the developers at Homeseer has a better idea or there is an undocumented command line option for bypassing the start-up form already, I think I'm at a dead end here.

              Comment


                #8
                Originally posted by HTGeek View Post
                The installation of HS3 in the container was successful. However I cannot get the HS3 application to start. Since containers are versions of Windows Server without the desktop experience, I suspect that it will not start because it's attempting to launch the GUI. There are no errors in application or system logs and it's not getting to the point where it creates the HS3 log, so I have no errors to provide.

                Does anyone know of a way to launch HS3 in Windows without the GUI?

                Thanks for your help!
                It may not be this but try checking these 3 entries in the settings.ini file and make sure they're all set to False

                gLaunchWebStartup=False
                gCheckForUpdates=False
                gStartSpeakerClient=False

                There shouldn't be a port issue in a container, but it might be worth changing the web server port to something other than 80, unless you already have that
                cheeryfool

                Comment


                  #9
                  I am currently running https://hub.docker.com/r/marthoc/homeseer with dedicated IP on Synology DS716+II with Synology's native Docker package 17.05.0-0395 (and Virtual Machine Manager 2.3.3-9020). I mentioned VMM as it utilizes a virtual switch that effects how you assign a network connection to a Docker container (ref https://forums.homeseer.com/forum/ho...95#post1092395. The method to deploy is very simple.

                  1. From web UI login as admin.
                  2. Create share called HomeSeer with default admin user read-write access. Note location of folder, e.g. /volume2/HomeSeer
                  3. SSH to Synology, login as admin and become root:
                  Code:
                  [FONT=courier new]$ sudo su -[/FONT]
                  4. If you have an existing instalation, do this first... Note you will need to substitute the USB device for your Z-stick
                  Code:
                  [FONT=courier new]# docker stop Syno-HomeSeer-Marthoc
                  # docker rm  Syno-HomeSeer-Marthoc[/FONT]
                  5. Then move onto downloading the image and creating the container
                  Code:
                  [FONT=courier new]# docker pull marthoc/homeseer
                  # docker run -it -d \
                      --name Syno-HomeSeer-Marthoc \
                      -v //volume2/HomeSeer:/HomeSeer \
                      -v /etc/localtime:/etc/localtime:ro \
                      --net=pub_net --ip=192.168.1.115 \
                      --device /dev/ttyACM0:/dev/ttyACM0 \
                      marthoc/homeseer:latest[/FONT]
                  6. From HS, Shutdown HS (might not stay shutdown, alternatively shutdown from Synology UI)
                  7. From Syn Web UI, edit container and set to always restart
                  8. Start Container

                  9. Browse to HomeSeer IP, register with serial # and password
                  10. Optionally browse to Setup, select Restore and provide backup file. HS will restore in about half a minute and then restart
                  11. On HS, Plug-ins, Additional Interfaces, Select Lighting & Primary Tech, HomeSeer Z-Wave
                  12. Then select Download and install
                  13. Enable plugins, etc...
                  14. Backup

                  Comment


                    #10
                    My first attempt at installing HomeSeer was on a windows server 2016 core VM. I couldn't get past the license registration as it would throw some exception, presumably due to missing dependencies.

                    ​​​​​I've recently spent some time with docker, both Linux and windows, came to the conclusion it's more of a pain than its worth. Particularly when dealing with external traffic.

                    Have you done a Get-WindowsFeature inside a windows server container? A huge amount of the server features are unavailable, basically unless you want to run a web server or maybe a DNS server, don't bother.

                    Server core 2019 will start happily on 512MB of ram and a fresh install OS disk is <6GB. I saw little reason to move away from what I knew and what was easy (which is Hyper-V vms).

                    With a little bit of determination I could probably get HS3 to run on core, no doubt by applying the license elsewhere. But as my HS install has grown, with extra plugins making use of extra devices and their own programs, like RFXCOM, I've come to appreciate it's probably safer to just leave it as a desktop experience application.

                    Comment


                      #11
                      Yeah here running HA, NodeRed and a couple of other docker applications on the Ubuntu 18.04 64 bit HS3Pro box plus one W2016 virtual box image all doing well these days. Leaving HS3 Pro alone for time bean.

                      For the W2016 VB bridging an autonomous NIC port on the box. Personally see that W2016 (and W2019) is way thinner than W10 these days.
                      - Pete

                      Auto mator
                      Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

                      HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                      HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                      X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                      Comment


                        #12
                        Originally posted by Fellhahn View Post
                        With a little bit of determination I could probably get HS3 to run on core, no doubt by applying the license elsewhere. But as my HS install has grown, with extra plugins making use of extra devices and their own programs, like RFXCOM, I've come to appreciate it's probably safer to just leave it as a desktop experience application.
                        Based on my prior research, I think you will have the same issues with core as the docker image is very similar in that it doesn't support any desktop mode and will hang as soon as a form is referenced. Since HS developers have rejected the service-only option for compatibility reasons in the past, I don't see a way around this.

                        Comment


                          #13
                          Hi,

                          I'm usnig Docker on the Synology with the Marthoc/homeseer image, works just fine when running on the brigdge network with port 80. I now do however want to run this on the host network. For that I changed the webserver port to 1881, connected a new image to the host network, all fine, but... I cannot connect to the webserver..... (although the console says it is listening on that port) , any ideas ?

                          Comment


                            #14
                            Originally posted by vinisz View Post
                            Hi,

                            I'm usnig Docker on the Synology with the Marthoc/homeseer image, works just fine when running on the brigdge network with port 80. I now do however want to run this on the host network. For that I changed the webserver port to 1881, connected a new image to the host network, all fine, but... I cannot connect to the webserver..... (although the console says it is listening on that port) , any ideas ?
                            What Synology are you using to host your docker image and are you using it for anything else ( media server / transcoder / etc )? I am looking at a WD MyCloud Pro that I'm comfortable with running a family Plex server, but I hadn't considered spinning up an HS docker on it. I am still considering an SEL-PRO (just for simplicity) since my personal PC that will be running other virtuals is going to be so far away from all the rest of my security and HA gear. But since the WD NAS will be right there with the equipment maybe that's an option...

                            Comment

                            Working...
                            X