stjohnjohnson / smartthings-mqtt-bridge

Bridge between SmartThings and MQTT
https://hub.docker.com/r/stjohnjohnson/smartthings-mqtt-bridge/
MIT License
367 stars 243 forks source link

config not saving #47

Closed shaddow825 closed 8 years ago

shaddow825 commented 8 years ago

I am running this in docker on a qnap and if anything unexpected happens like a reboot, the config file is gone and a default one is replaced in the shared directory. None of my other docker containers have this problem. Any ideas or something to look for?

stjohnjohnson commented 8 years ago

No, it shouldn't. As long as you mounted in your config.yml into /config, it shouldn't replace it: https://github.com/stjohnjohnson/smartthings-mqtt-bridge/blob/master/server.js#L52

I wonder what's going on. Can you share your docker-compose or docker run commands?

shaddow825 commented 8 years ago

That's the thing, I always catch it after its running as a default already so I am assuming it finds no default there and is creating it. I just can't figure out why the file wouldn't be there. Last time it happened it was a power blip and the qnap rebooted, all other containers were fine as far as their config dirs on the host. But this isn't the first time it's happened but it is the one where I remember the exact scenario. I'll play around and see if I can reproduce any way to get any more info.

I ran it just with your basic settings from the readme but I changed the network to be --net=host and in my config file I change the ports to 8181 due to a conflict with my wifi controller software.

docker run \ -d \ --name="mqtt-bridge" \ -v /etc/conf/mqtt-bridge:/config \ --net=host \ stjohnjohnson/smartthings-mqtt-bridge

shaddow825 commented 8 years ago

OK, I just figured it out. When looking closer I had put the config directory for this container int /etc/conf and the rest in /etc/config. Looks like the root (including etc) dir is somewhat virtual on the qnap with links to the actual HDs (raid array) for certain directories, the /etc/conf not being one, so at each reboot it was gone and the container, as it started, created it new. I moved it and I suspect I won't have any more issues :)