Open poldim opened 5 years ago
I will preface this with I-have-no-clue-what-I'm-doing......BUT, I got it working in a container.
Just run git clone
, update the settings file & create a file called Dockerfile
with contents
FROM node:8-alpine
WORKDIR /app
COPY . /app
RUN npm install
CMD node index.js
Then just run docker build -t poldim/cgateweb .
and docker run -d poldim/cgateweb
This is the first container I've ever built, so, it might be fundamentally wrong, but it works:
sudo docker run -d poldim/cgateweb
CONNECTED TO C-GATE COMMAND PORT: 10.30.30.100:20023
CONNECTED TO C-GATE EVENT PORT: 10.30.30.100:20025
CONNECTED TO MQTT: 10.30.20.100:1883
ALL CONNECTED
Getting all values
C-Bus status received: 254/56/0 ON
C-Bus status received: 254/56/0 65%
C-Bus status received: ...
It would probably be good to create the docker such that the settings files can be configured through environmental variables to make it easy to use with docker-compose...
Awesome, thanks! When I get a chance I'll add it to the repo.
@poldim @the1laz - I pretty much did the same but with the extra step of changing the settings.js file before you do the docker build (ip addresses and all that). As you mention, would be good if the settings file sat outside the container with environment variables for persistent changes, but not the end of the world.
Also, running on a Qnap and having Home Assistant, MQTT & CGate in docker containers too, I had to set --net=host (on all) to make sure they can all talk to each other (too lazy to do the proper networking setup...)
And I just noticed @poldim you said 'update the settings file', so ignore that bit... :) Doh
Just to say, thanks for this. I just implemented three docker containers - ser2sock, Cgate and Cgateweb. I'm a docker newbie, so didn't quite manage to sort out the networking properly either, but only have Cgate on host networking.
I already had working containers for MQTT, hass, etc, so all is now good
Planning to, just haven't got around to it yet...