frugal-iot-server 2.0.9 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/config.d/email.yaml +1 -1
- package/config.d/opensearch.yaml +2 -2
- package/config.d/schema/modules.yaml +13 -0
- package/config.d/schema/topics.yaml +50 -0
- package/docs/OPENWRT.md +208 -0
- package/extras/frugaliot.service +1 -1
- package/extras/mosquitto.conf +1 -1
- package/frugal-iot-createdb.sql +10 -1
- package/frugal-iot-server.js +26 -5
- package/lib/grafana.js +2 -2
- package/lib/language-requests.js +50 -0
- package/package.json +7 -6
- package/public/service-worker.js +10 -2
- package/scripts/addbridge-pi.zsh +1 -1
- package/scripts/addbridge-prod.zsh +2 -2
- package/scripts/addorganization.zsh +11 -2
- package/scripts/diagnostic.zsh +4 -4
- package/scripts/grafana-token.js +1 -1
- package/scripts/init.zsh +5 -1
- package/scripts/install-openwrt.sh +709 -0
- package/scripts/install-pi.sh +46 -12
- package/scripts/openwrt-preflight.sh +363 -0
- /package/{GRAFANA.md → docs/GRAFANA.md} +0 -0
- /package/{INSTALL-OPENSEARCH.md → docs/INSTALL-OPENSEARCH.md} +0 -0
- /package/{INSTALLATION.md → docs/INSTALLATION.md} +0 -0
package/scripts/diagnostic.zsh
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env zsh
|
|
2
2
|
#
|
|
3
|
-
# Report the state of a Frugal IoT installation, for working out why something in INSTALLATION.md
|
|
3
|
+
# Report the state of a Frugal IoT installation, for working out why something in docs/INSTALLATION.md
|
|
4
4
|
# did not do what it said it would. It only looks - it changes nothing.
|
|
5
5
|
#
|
|
6
6
|
# Run it from the directory the server is installed in (the one holding frugal-iot.db):
|
|
@@ -85,7 +85,7 @@ for c in node npm sqlite3 zsh mosquitto mosquitto_passwd mosquitto_sub; do
|
|
|
85
85
|
esac
|
|
86
86
|
else
|
|
87
87
|
item "$c: NOT INSTALLED"
|
|
88
|
-
[[ $c == (node|npm|sqlite3) ]] && problem "$c is not installed - see INSTALLATION.md step 3"
|
|
88
|
+
[[ $c == (node|npm|sqlite3) ]] && problem "$c is not installed - see docs/INSTALLATION.md step 3"
|
|
89
89
|
fi
|
|
90
90
|
done
|
|
91
91
|
|
|
@@ -355,7 +355,7 @@ broker_setting() { # name -> value from the broker's own configuration, sudo on
|
|
|
355
355
|
broker_setting acl_file; ACLFILE="$BROKER_SETTING"
|
|
356
356
|
if [[ -z "$ACLFILE" ]]; then
|
|
357
357
|
item "acl_file: NOT SET - every account that can log in can reach every topic, across all organizations"
|
|
358
|
-
problem "The broker has no acl_file. Re-run the install script, or see INSTALLATION.md 'Turn on access control'"
|
|
358
|
+
problem "The broker has no acl_file. Re-run the install script, or see docs/INSTALLATION.md 'Turn on access control'"
|
|
359
359
|
else
|
|
360
360
|
item "acl_file: $ACLFILE"
|
|
361
361
|
if [[ -r "$ACLFILE" ]] || { have sudo && sudo -n test -r "$ACLFILE" 2>/dev/null; }; then
|
|
@@ -608,7 +608,7 @@ else
|
|
|
608
608
|
fi
|
|
609
609
|
|
|
610
610
|
# Swapping to an SD card wears it fast. On a Pi 4 there should be little or none; a Pi Zero W may
|
|
611
|
-
# need some. See INSTALLATION.md, "Wear and tear on the SD card".
|
|
611
|
+
# need some. See docs/INSTALLATION.md, "Wear and tear on the SD card".
|
|
612
612
|
if have free; then
|
|
613
613
|
item "swap: $(free -h | awk '/^Swap:/ {print $3 " used of " $2}')"
|
|
614
614
|
fi
|
package/scripts/grafana-token.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*
|
|
3
|
-
* Issue, list or revoke the tokens Grafana uses to read an organization's history (GRAFANA.md).
|
|
3
|
+
* Issue, list or revoke the tokens Grafana uses to read an organization's history (docs/GRAFANA.md).
|
|
4
4
|
*
|
|
5
5
|
* npx --no frugal-iot-grafana-token add <org> <username> <name> prints the token - once, it is not kept
|
|
6
6
|
* npx --no frugal-iot-grafana-token list <org>
|
package/scripts/init.zsh
CHANGED
|
@@ -48,7 +48,11 @@ copy_if_missing() {
|
|
|
48
48
|
fi
|
|
49
49
|
elif [[ -e "$from" ]]; then
|
|
50
50
|
mkdir -p "${to:h}"
|
|
51
|
-
cp
|
|
51
|
+
# extras/ holds a directory (grafana/) as well as files, and a plain cp refuses a directory -
|
|
52
|
+
# which under "set -e" ended the whole init, after server.yaml had been created but before it
|
|
53
|
+
# was pointed at node_modules. The re-run then saw an existing server.yaml and left it alone, so
|
|
54
|
+
# "/" 404ed. -R for a directory, so a failure here cannot strand a half-initialised install.
|
|
55
|
+
if [[ -d "$from" ]]; then cp -R "$from" "$to"; else cp "$from" "$to"; fi
|
|
52
56
|
COPIED+=("$to")
|
|
53
57
|
echo " created ${to}"
|
|
54
58
|
fi
|