File tree Expand file tree Collapse file tree 7 files changed +40
-28
lines changed
Expand file tree Collapse file tree 7 files changed +40
-28
lines changed Original file line number Diff line number Diff line change 1- FROM node:12-buster -slim
1+ FROM node:20-bookworm -slim
22
33EXPOSE 8080 4443
44
55ARG DEBIAN_FRONTEND=noninteractive
66RUN set -x && \
7- echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list && \
87 apt update && \
98 apt dist-upgrade -y && \
109 apt install -y \
@@ -15,19 +14,21 @@ RUN set -x && \
1514 git \
1615 iputils-ping \
1716 libcap2-bin \
17+ libdbus-1-dev \
1818 libffi-dev \
1919 libnss-mdns \
2020 libpng-dev \
2121 libtool \
2222 lsb-release \
2323 mosquitto \
2424 net-tools \
25+ pipx \
2526 pkg-config \
26- python \
27- python-six \
2827 python3 \
2928 python3-pip \
3029 python3-setuptools \
30+ python3-six \
31+ python-is-python3 \
3132 sudo \
3233 zlib1g-dev && \
3334 apt clean && \
@@ -37,7 +38,9 @@ RUN set -x && \
3738 echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
3839
3940COPY --chown=node:node . /home/node/webthings/gateway/
40- RUN pip3 install -r /home/node/webthings/gateway/requirements.txt
41+ RUN pipx install cookiecutter && \
42+ pipx runpip cookiecutter install -r \
43+ /home/node/webthings/gateway/requirements.txt
4144
4245USER node
4346WORKDIR /home/node/webthings/gateway
Original file line number Diff line number Diff line change 11# WebThings Gateway
22
3- Docker image based on Debian Buster for running the
3+ Docker image based on Debian Bookworm for running the
44[ WebThings Gateway] ( https://github.com/WebThingsIO/gateway ) . The image
55is built for AMD64, ARMv7, and ARMv8 (AArch64).
66
Original file line number Diff line number Diff line change @@ -58,8 +58,8 @@ $ sudo apt install \
5858 libudev-dev \
5959 libusb-1.0-0-dev \
6060 pkg-config \
61- python -six \
62- python3-pip
61+ python3 -six \
62+ python3-pip \
6363$ sudo -H python3 -m pip install git+https://github.com/WebThingsIO/gateway-addon-python#egg=gateway_addon
6464```
6565
Original file line number Diff line number Diff line change @@ -11,15 +11,21 @@ ln -sf "/usr/share/zoneinfo/$TZ" /etc/localtime
1111# Run avahi-daemon in the background
1212/usr/sbin/avahi-daemon -s -D
1313
14- # Run the gateway
15- export WEBTHINGS_HOME=/home/node/.webthings
14+ # If legacy .mozilla-iot directory exists, then move it to .webthings
15+ if [[ " $WEBTHINGS_HOME " == " $HOME /.webthings" &&
16+ -d " $HOME /.mozilla-iot" &&
17+ ! -e " $HOME /.webthings" ]]; then
18+ mv " $HOME /.mozilla-iot" " $HOME /.webthings"
19+ fi
1620
17- if [[ -d /home/node/.mozilla-iot && ! -e /home/node/.webthings ]]; then
18- pushd /home/node
19- ln -sf .mozilla-iot .webthings
20- chown -R node:node .mozilla-iot
21- popd
21+ # If .webthings directory doesn't exist then create it
22+ if [[ ! -e /home/node/.webthings ]]; then
23+ mkdir -p /home/node/.webthings
2224fi
2325
24- chown -R node:node " ${WEBTHINGS_HOME} "
26+ # Give the Node user access to the .webthings data directory
27+ chown -R node:node /home/node/.webthings
28+
29+ # Run the gateway
30+ export WEBTHINGS_HOME=/home/node/.webthings
2531su node -c " cd /home/node/webthings/gateway && ./run-app.sh"
Original file line number Diff line number Diff line change @@ -45,6 +45,13 @@ run_app() {
4545 npm run " ${start_task} " -- $args
4646}
4747
48+ # If legacy .mozilla-iot directory exists, then move it to .webthings
49+ if [[ " $WEBTHINGS_HOME " == " $HOME /.webthings" &&
50+ -d " $HOME /.mozilla-iot" &&
51+ ! -e " $HOME /.webthings" ]]; then
52+ mv " $HOME /.mozilla-iot" " $HOME /.webthings"
53+ fi
54+
4855if ! is_container; then
4956 if [ ! -f .post_upgrade_complete ]; then
5057 ./tools/post-upgrade.sh
5360 _node_version=$( node --version | egrep -o ' [0-9]+' | head -n1)
5461 if [[ ! -f " ${WEBTHINGS_HOME} /.node_version" ||
5562 " $( < " ${WEBTHINGS_HOME} /.node_version" ) " != " ${_node_version} " ]]; then
56- cd " ${HOME} /webthings/gateway"
5763 mkdir -p " ${WEBTHINGS_HOME} /config"
64+ cd " ${HOME} /webthings/gateway"
5865 ./tools/update-addons.sh
59- cd -
60- echo " ${_node_version} " > " ${WEBTHINGS_HOME} /.node_version"
6166 fi
6267fi
6368
64- if [[ " $WEBTHINGS_HOME " == " $HOME /.webthings" &&
65- -d " $HOME /.mozilla-iot" &&
66- ! -e " $HOME /.webthings" ]]; then
67- mv " $HOME /.mozilla-iot" " $HOME /.webthings"
68- fi
69-
7069mkdir -p " ${WEBTHINGS_HOME} /log"
7170
7271if [ -f " ${WEBTHINGS_HOME} /log/run-app.log" ]; then
Original file line number Diff line number Diff line change 1- const migrate = require ( '../build/migrate' ) . default ;
2- const db = require ( '../build/db' ) . default ;
1+ const migrate = require ( '../build/migrate' ) ;
2+ const db = require ( '../build/db' ) ;
33db . open ( ) ;
44
5- const AddonManager = require ( '../build/addon-manager' ) . default ;
5+ const AddonManager = require ( '../build/addon-manager' ) ;
66
77migrate ( )
88 . then ( ( ) => {
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ set -e -x
4+
35export NVM_DIR=" $HOME /.nvm"
6+
47[ -s " $NVM_DIR /nvm.sh" ] && \. " $NVM_DIR /nvm.sh" # This loads nvm
58
9+
610node " $( readlink -f " $( dirname " $0 " ) " ) /update-addons.js"
You can’t perform that action at this time.
0 commit comments