gleeds / cloudbbq

A Bluetooth to MQTT bridge for the Tenergy Solis Digital Meat Thermometer and other similar devices.
MIT License
45 stars 12 forks source link

Documentation: Docker Support #19

Open digital-dann opened 3 years ago

digital-dann commented 3 years ago

After some fiddling, I found a way to build a Docker container for this. Docker my preferred way to run this, even on a Raspberry Pi. Some people might find this useful, too:

Dockerfile

FROM node:10-buster

RUN git clone https://github.com/gleeds/cloudbbq.git \
  && cd cloudbbq \
  && npm install

COPY docker-entrypoint.sh /entrypoint.sh

RUN chmod u+x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]

docker-entrypoint.sh

#!/bin/sh

cd /cloudbbq
exec npm start

docker-compose.yml

version: '3'
services:
  cloudbqq:
    container_name: cloudbbq
    image: cloudbbq:latest
    network_mode: host
    volumes:
      - ./default.json:/cloudbbq/config/default.json
    restart: unless-stopped
gleeds commented 3 years ago

Interesting. I like this because for people who don't need to make changes to the software, it gets around all of the pain of getting the native node modules to compile with a specific Node version. It's also a pleasant surprise that the bluetooth stack is accessible in the container.

It would be nice to just build an "official" container and put it in a public registry, though GitHub's Runners appear to only support x86 right now and I don't think there is an easy free way to do this in ARM with a self-hosted runner.

I'll give this some more thought if there is a better way to incorporate this.

digital-dann commented 3 years ago

It would be simple enough to create a DOCKER.md file with this information and just link to it from the README.md. If you create a Docker Hub repo for this, I would be willing to upload images for this. You may want to start creating releases in Github to match the docker image releases as well.

Beyond this, there are many things that can be done to improve the MQTT compatibility and also ways to tweak the Docker image to make it much more user friendly. I'm open to submitting merge requests.

gleeds commented 3 years ago

Turns out I was wrong earlier, docker buildx works on the GitHub runners, so while slow I can indeed have the CI pipeline build arm and arm64 containers. I tested a container built this way on a Pi 3 with 32bit PiOS and it seems to work, but I'd love for you to give it a try too. You can try this compose file. https://github.com/gleeds/cloudbbq/blob/master/docker-compose.yml

I think for this container to be generally friendly to use, cloudbbq would need a better configuration system (Kinda like what Spring Boot does) that can load from both a config file or from environmental variables.

Also, I'm interested in what MQTT changes you'd like to see. In the past I tried to get it to work with AWS IoT Core but couldn't get past their more complex auth system at the time.