Git Product home page Git Product logo

Comments (21)

oznu avatar oznu commented on May 14, 2024 2

Either way will work, it's probably more of a personal preference thing. Personally, I like to manage all my containers through a single docker-compose.yml file as I find it easier.

from docker-homebridge.

oznu avatar oznu commented on May 14, 2024 1

You can have up to 100 devices exposed through a single homebridge instances, but if you want to run multiple instances of Homebridge on the same host doing that with Docker is fairly trivial.

You need to change some Homebridge config settings to make sure it does not conflict with your first instance:

These can all be changed in the config.json file created after you run the container for the first time.

As for actually launching a second docker container, just make sure the container name is unique, in my examples I use --name=homebridge, so for a second instance you might use --name=homebridge-two.

Once the second container is up and running, you should be able to pair it with iOS just like you did with the first.

If you're using Docker Compose just create a second entry under services:

version: '2'
services:
  homebridge:
    image: oznu/homebridge:latest
    network_mode: host
    volumes:
      - ./volumes/homebridge:/homebridge
  homebridge-two:
    image: oznu/homebridge:latest
    network_mode: host
    volumes:
      - ./volumes/homebridge-two:/homebridge

from docker-homebridge.

jeylites avatar jeylites commented on May 14, 2024

Thanks for the explanation! I’m going to give this a shot after my RPI3 comes in the mail. This would definitely solve my current issue to testing purposes.

Noob question, Are all the Homebridge services isolated from each other? Meaning first container running Homebridge 1, second container running Homebridge 2?

from docker-homebridge.

oznu avatar oznu commented on May 14, 2024

As long as you specify unique /homebridge volume mount locations for each container, they will be isolated from one another.

from docker-homebridge.

jeylites avatar jeylites commented on May 14, 2024

from docker-homebridge.

jeylites avatar jeylites commented on May 14, 2024

@oznu

Good news is the Pi came in and I've successfully deployed your script. The first homebridge service works with homeApp.

Creating Containers
I'm a bit lost in creating containers. How do I go about that?
When creating a directory, does that mean you are creating a container? (3. Create Docker Compose Manifest)

Is there a way to run Docker on RPI and use Kitematic or similar to control containers from a GUI?

from docker-homebridge.

oznu avatar oznu commented on May 14, 2024

Docker Compose is doing the hard work in the background to create and manage the containers for you.

Each entry under services: represents another container.

version: '2'
services:
  homebridge:
    image: oznu/homebridge:raspberry-pi
    restart: always
    network_mode: host
    volumes:
      - ./config:/homebridge
    environment:
      - PGID=1000
      - PUID=1000
  homebridge-testing:
    image: oznu/homebridge:raspberry-pi
    restart: always
    network_mode: host
    volumes:
      - ./config-testing:/homebridge
    environment:
      - PGID=1000
      - PUID=1000

Start it using these steps:

  1. Run docker-compose up -d homebridge - this will launch the first container in the background.
  2. Run docker-compose up homebridge-testing - this will create the config-testing volume and populate the default config.json. You will get an error saying the port is already in use. Press CTRL+C to exit the container.
  3. Edit the ./config-testing/config.json file as per instructions in my first comment.
  4. Make sure it's working by running docker-compose up homebridge-testing. If it is, press CTRL+C then restart it in background mode by running docker-compose up -d.

As for a Kitematic on Raspberry Pi, I've seen a few ways to do it over the years, most were quite complicated though. Portainer is a web based alternative that might suit your needs, it has an ARM image that should run on the Raspberry Pi, though I have not tested it.

from docker-homebridge.

jeylites avatar jeylites commented on May 14, 2024

@oznu

understood, I'm assuming I have to create a directory for "homebridge-testing"

mkdir /home/pi/homebridge cd /home/pi/homebridge

I'm guessing not but at this point, should I create a new file called docker-compose.yml using nano for "homebridge-testing" or use the previous docker-compose that was created for "homebridge"?

from docker-homebridge.

jeylites avatar jeylites commented on May 14, 2024

@oznu

After tinkering for some time, I got it working. I created an individual Docker Compose Manifest for each homebridge service. I then copied the service example from your previous post to the docker-compose.yml file. Ever since I have added another. I now have three services running without any problems.

The next step will be to install the following:-

  • Peter Scargill the script - MQTT & NODE red
  • FFmpeg with the OpenMAX H.264 GPU acceleration

Peter Scargill
Homebridge IP Camera

Though I'm uncertain how to go about installing them in a docker environment.

A general question, suppose I have to install Domoticz, or the above. Do I have to deploy them in containers or can install them outside the docker setup?

Portainer - looks interesting, I got to read up about it.

Thank you in advance!

from docker-homebridge.

jeylites avatar jeylites commented on May 14, 2024

I couldn’t find a FFmpeg OMX Docker image so I installed as a global library. I can’t seem to get that to talk to one of the container running the IP Cam plugin.

from docker-homebridge.

oznu avatar oznu commented on May 14, 2024

Which homebridge plugin are you trying to install?

from docker-homebridge.

jeylites avatar jeylites commented on May 14, 2024

homebridge-camera-ffmpeg-omx
https://www.npmjs.com/package/homebridge-camera-ffmpeg-omx

Before Docker, I was running ffmpeg on RPI3 and noticed there was a 6 sec delay in receiving streams so I gave ffmpeg omx a try which made a huge improvement. There are still delays but not as bad.

Correct me if I’m wrong, can’t I globally install ffmpeg omx on a specific container without Dockering it as an image?

from docker-homebridge.

oznu avatar oznu commented on May 14, 2024

To get the plugin to work when running Docker in a container you would need to have ffmpeg installed in the container as well. The default ffmpeg package can be installed by adding PACKAGES=ffmpeg as an environment variable, but this version does not have omx support.

I've had a quick look at what would be required to compile it from source. It looks like the package libomxil-bellagio, which is required to build ffmpeg with omx support, is not available in the Alpine Linux repositories.

You might have better luck with an alternative Raspbian based Homebridge Docker image. I haven't used any I can recommend, but here is an example of building ffmpeg with omx using resin/rpi-raspbian:jessie as the base image:

https://github.com/alexellis/raspberrypi-youtube-streaming/blob/master/Dockerfile

from docker-homebridge.

VeniceNerd avatar VeniceNerd commented on May 14, 2024

@jeylites would you mind posting your step by step instructions on how you got your additional images up and running? I'm really struggling! Thank you!

from docker-homebridge.

jeylites avatar jeylites commented on May 14, 2024

@VeniceNerd sure... this is what I have gathered from @oznu

### SETUP BASED ON RASPBERRY PI 3

Prerequisite

  • Plan your container & service names
  • Create a docker-compose.yml file on txt or atom
    Here is an example of mine of four homebridge service running. Named as follow...
  1. homebridge
  2. homeoutside
  3. homeinside
  4. homecam
version: '2'
services:
  homebridge:
    image: oznu/homebridge:raspberry-pi
    restart: always
    network_mode: host
    volumes:
      - ./config:/homebridge
    environment:
      - PGID=1000
      - PUID=1000
  homeoutside:
    image: oznu/homebridge:raspberry-pi
    restart: always
    network_mode: host
    volumes:
      - ./config-homeoutside:/homebridge
    environment:
      - PGID=1000
      - PUID=1000
  homeinside:
    image: oznu/homebridge:raspberry-pi
    restart: always
    network_mode: host
    volumes:
      - ./config-homeinside:/homebridge
    environment:
      - PGID=1000
      - PUID=1000
  homecam:
   image: oznu/homebridge:raspberry-pi
   restart: always
   network_mode: host
   volumes:
      - ./config-homecam:/homebridge
   environment:
      - PGID=1000
      - PUID=1000
      - PACKAGES=ffmpeg 

Follow instructions on Step 1 & Step 2

3. Create Docker Compose Manifest

Create a new directory and change into it:

mkdir /home/pi/homebridge
cd /home/pi/homebridge

Create a new file called docker-compose.yml using nano:

  • refer to prerequisite file, copy the content to nano

nano docker-compose.yml

Start it using these steps:

  1. cd /home/pi/homebridge

  2. Run docker-compose up -d - this will launch the first container in the background.

  3. Edit the ./config/config.json file .

You need to change some Homebridge config settings to make sure it does not conflict with your first instance:

Homebridge Port - change it away from the default 51826
Homebridge Username - change it away from the default CC:22:3D:E3:CE:30- make sure you only use hexadecimal characters
Homebridge Name - Optional. This makes it easy to identify which instance is which in iOS.

These can all be changed in the config.json file created after you run the container for the first time.

from docker-homebridge.

jeylites avatar jeylites commented on May 14, 2024

Hi @oznu I been wanting to ask on the following but I keep forgetting. After tinkering for a while, I noticed there are two ways to get the instances going.

A) like you suggested, create the instances within the same directory like below
screen shot 2018-01-28 at 4 12 55 am

B) create an individual directory & nano.yml files for each instances like below.
screen shot 2018-01-28 at 4 19 11 am

The question is, are there right & wrong to Step A or Step B? because they both seem to work.

from docker-homebridge.

jeylites avatar jeylites commented on May 14, 2024

After testing for a few days now on Setup A and B, setup B seem to load Homebridge faster than Setup A . Again I’m not sure on the right and wrong of this setup.

from docker-homebridge.

alton76 avatar alton76 commented on May 14, 2024

Hi - thanks for laying it all out here. I ran into similar issues and got it running after going through this post. I'm also curious about the A and B setup. Which is better? I noticed you could do both and they still work.

I also see you have got ffmpeg running on a different post. That's probably going to be my next step once I get this right.

from docker-homebridge.

jeylites avatar jeylites commented on May 14, 2024

@alton76

I'm not sure myself which is right or wrong. Currently, I have setup A running for a couple weeks without any problems, I'm will be testing setup B soon when my second Pi comes in.

Meanwhile, hopeful, we could get @oznu comments on this.

from docker-homebridge.

iPadArmChair avatar iPadArmChair commented on May 14, 2024

Digging up this old thread from Google - I've got homebridge running on my Synology, but want to add a 2nd Home. I've followed the steps above by changing the Port, Username, and Name.

I'm getting errors on the 2nd container that "Error: listen EADDRINUSE: address already in use :::51826"
Are those ports that both containers are trying to use? Suggestions?

from docker-homebridge.

jeylites avatar jeylites commented on May 14, 2024

from docker-homebridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.