-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
I posted this issue in the docker image repo (WebThingsIO/gateway-docker#42), but have since found more info on the problem. The arduino-cli
that comes pre-packaged in the Candle-manager-addon
does not work within the mozillaiot/gateway
Docker image (which is based on node:12-buster-slim
). The workaround for me was to download the arduino-cli
from https://arduino.github.io/arduino-cli/installation/ and update the SHA256SUMS file (using sed
).
Here's my docker create/startup script that installs the addon and performs the above workaround.
#!/bin/bash
TMP_DIR=./.tmp
IOT_DATA=/home/pi/Development/iot/data
ADDONS="$IOT_DATA/addons"
CANDLE_ADDON_SRC="https://s3-us-west-2.amazonaws.com/mozilla-gateway-addons/Candle-manager-addon-1.1.0-linux-arm-v3.5.tgz"
CANDLE_ADDON_DIR="$ADDONS/Candle-manager-addon"
ARDUINO_CLI_TAR="https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_ARMv7.tar.gz"
docker run \
-it \
-e TZ=America/Chicago \
-v /home/pi/Development/iot/data:/home/node/.mozilla-iot \
--device "/dev/ttyUSB0:/dev/ttyUSB0" \
--network="host" \
--log-opt max-size=1m \
--log-opt max-file=10 \
--name webthings-gateway \
mozillaiot/gateway:latest
mkdir -p $ADDONS
if [ ! -d $CANDLE_ADDON_DIR ]; then
mkdir -p $TMP_DIR
curl -L $CANDLE_ADDON_SRC | tar xzv --directory $TMP_DIR
mv $TMP_DIR/package $CANDLE_ADDON_DIR
curl -kL $ARDUINO_CLI_TAR | tar xzv --directory $TMP_DIR
mv $TMP_DIR/arduino-cli $CANDLE_ADDON_DIR/arduino-cli/linux-arm/arduino-cli
ARDUINO_CLI_SUM=`cd $CANDLE_ADDON_DIR && sha256sum ./arduino-cli/linux-arm/arduino-cli`
sed -i -e "s%^.*\s*\.\/arduino-cli\/linux-arm\/arduino-cli\$%$ARDUINO_CLI_SUM%g" $CANDLE_ADDON_DIR/SHA256SUMS
rm -rf $TMP_DIR
fi
# Have to restart it because the first run exits with an SQLITE error
docker restart webthings-gateway
Metadata
Metadata
Assignees
Labels
No labels