PermaLink Installing HomeBridge as Docker Image on Synology02/08/2016 08:29 PM
This article explains how to install and omeBridge, an opensource implementation of Apples HomeKit API, on a Synology Diskstation.
This tutorial requires that you own a Synology Diskstation with an Intel CPU that can run Docker.

Step 1: Enable SSH
You will need access to the commandline. To do so enable SSH on the Diskstation.



Step 2: Install Docker
Docker is available as official package by Synology. Before Synology published a Docker package, it was necessary to bootstrap your Synology Diskstation and install Docker manually. This is no longer necessary, ignore these (old) instructions if you own a Diskstation with Intel CPU that can run Synologies official Docker package.



Step 3: Download the HomeBridge Docker Image
Start the Docker Package and search the registry for "homebridge".



Select "cbrandlehner/homebridge" and klick "Download".
In the next dialog select "0.6-SNAPSHOT".


The download might take some time. You can view the progress in the view "Image".

Step 4: Configuration data for your image
The Docker application needs to access configuration data and needs a place to store information and logs.

Start the "Control Panel" and change to "Shared Folder". Click "Create" to create a new shared folder.



User "Admin" needs "Read/Write" access to that folder. You can set access rights for all other users to "No access".









Now open "File Station" and navigate to the new folder "Docker". Create a new directoy "homebridge".



Step 4: Configuration
Homebridge will require a configuration file in "/volume1/docker/homebridge". Homebridge will look for a file config.json. You can find a sample config file on github: https://raw.githubusercontent.com/cbrandlehner/homebridge-docker/master/config-sample.json
It is very important that your config file is correct and matches the homebridge plugins in your docker container. I strongly recommend to install Homebridge in a non dockerized environment for testing before starting with this docker environment.
I found it useful to store the config.json file in my home directoy on the diskstation and then move the file to the homebridge directory.

Step 5: Configure the Docker Image
Start the Docker GUI, select the homebridge Image and click "Launch with wizard".



Homebridge only uses port 51826. Add this port by clicking the large "+". The Homebridge plugins I used in cbrandlehner/homebridge do not use any other ports. "Automatically map ports" is not necessary.



No change needed with Step 2.



Click "Advanced Settings".



Klick "Add Folder".



Choose the folder "docker/homebridge" you created previously.



Docker will ask you where to mount that folder within the container.



Choose "/root/.homebridge" as Mount path and remove the "Read-Only" restriction.



Review settings:



Step 6: Starting the container
Open a SSH session with your Synology Diskstation. If you are on Windows, you can use putty or MobaXterm to do so.

"docker images" will show you a list of your images:



Now run the command
docker run -d --net=host -p 51826:51826 -v /volume1/docker/homebridge:/root/.homebridge cbrandlehner/homebridge:0.6-SNAPSHOT

Step 7: Debug

If you like to debug, you can run a bash shell within your docker image:
docker run -i -t --entrypoint /bin/bash --net=host -p 51826:51826 -v /volume1/docker/homebridge:/root/.homebridge cbrandlehner/homebridge:0.6-SNAPSHOT

Now you can start homebridge with "/root/run.sh"

The AVAHI warning can be ignored:

# /root/run.sh
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs>
*** WARNING *** The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister>
Loaded plugin: homebridge-ninjablock-humidity
Registering accessory 'homebridge-ninjablock-humidity.NinjaBlock-Humidity'
---
Loaded plugin: homebridge-ninjablock-temperature
Registering accessory 'homebridge-ninjablock-temperature.NinjaBlock-Temperature'
---
Loaded plugin: homebridge-philipshue
Registering platform 'homebridge-philipshue.PhilipsHue'
---
Loaded config.json with 2 accessories and 1 platforms.
---
Loading 1 platforms...
[Phillips Hue] Initializing PhilipsHue platform...
[Phillips Hue] PhilipsHue Platform Plugin Version 0.0.2
[Phillips Hue] Fetching Philips Hue lights...
Loading 2 accessories...
[NinjaBlock Temp] Initializing NinjaBlock-Temperature accessory...
[NinjaBlock Humidity Sensor] Initializing NinjaBlock-Humidity accessory...
[Phillips Hue] Initializing platform accessory 'Hue Spot'...
[Phillips Hue] Initializing platform accessory 'Hue Spot 1'...
[Phillips Hue] Initializing platform accessory 'Hue Spot 2'...
[Phillips Hue] Initializing platform accessory 'LivingColors 1'...
[Phillips Hue] Initializing platform accessory 'LightStrips 1'...
Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

    ┌────────────┐
    │ 031-45-154 │
    └────────────┘

Homebridge is running on port 51826.



The script to build the docker image is a GitHub project: https://github.com/cbrandlehner/homebridge-docker
The docker image is on Docker Hub: https://hub.docker.com/r/cbrandlehner/homebridge/

I appreciate any feedback, please leave a STAR on GitHub oder Docker Hub. Thanks!


This page has been accessed 7247 times. .
Comments:v
No comments.
Disclaimer
The weblog represent my personal views and comments and does not represent the views of my current or previous employers or customers.

About me
By Category
The BlogRoll
Christians sites
other Bloggers
Travel related
RSS News Feed OpenNTF
Monthly Archive
2016
2014
2013
2012
2011
2010
2010
2010
2010
2009
2009
2009
2009
2009
2009
2009
2009
2008
2008
2008
2008
2008
2008
2008
2007
2007
2007
2007
2007
2007
2007
2007
2007
2007
2006
2006
2006
2006
2006
2006
2006
2006
2006
2006
2006
2006
2005
2005
2005
2005
2005
2005
2005
2005
2005
2005
2005
2004
2004
2004
2004
2004
2004
2004
2004
2004
2004
2004
2004
2003
2003
Full Archive
Advertisement