SciFiFarms / TechnoCore

TechnoCore: an IoT stack powered by Docker Swarm
GNU General Public License v3.0
20 stars 1 forks source link

Add Platform IO container #17

Closed TheHackmeister closed 6 years ago

TheHackmeister commented 6 years ago

Add a new PlatformIO service to the docker file as well as the necessary steps The actual PlatformIO image will be in a separate repository. Eventually, I'd like to move all of the images to their own repo so that docker hub can automatically create and deploy new images.

Docker swarm does not yet support device mounting. To work around this, I had the PlatformIO service actually be a docker container that creates a standalone container (not on swarm) that has /dev/ttyUSB0 mounted as a device. It's pretty hacky and absolutely a security risk... But it works... Mostly. The container won't actually start unless an ESP8266 is plugged in. The swarmkit issue includes a discussion on how to implement device mounting: https://github.com/docker/swarmkit/issues/1244

This also contains a few modifications needed to make standalone containers attachable to swarm networks.

The PlatformIO container will accept MQTT messages on platformio/build/[BOARD=nodemcuv2] that contains the JSON config for the ESP8266. The config will replace $mqtt_username and $mqtt_password with RabbitMQ creds generated in Vault.

BOARD will be passed in the PlatformIO --environment flag to target a specific environment in the PlatformIO build file. Currently, only nodemcuv2 is supported.