Ship prebuilt Zigbee2MQTT bundle for edge installs
This commit is contained in:
parent
fdf5693507
commit
a0cfc13d01
|
|
@ -1,25 +1,39 @@
|
||||||
# Vendored Zigbee2MQTT Bundle
|
# Vendored Zigbee2MQTT Bundle
|
||||||
|
|
||||||
This directory contains a vendored Zigbee2MQTT source archive used by `stage_z2m_03_code.sh`.
|
This directory contains a vendored Zigbee2MQTT bundle used by `stage_z2m_03_code.sh`.
|
||||||
|
|
||||||
Default behavior:
|
Default behavior:
|
||||||
|
|
||||||
- `stage_z2m_03_code.sh` first looks for a bundled Zigbee2MQTT source archive or directory in `stage_z2m/`
|
- `stage_z2m_03_code.sh` first looks for a bundled Zigbee2MQTT archive or directory in `stage_z2m/`
|
||||||
- network download is disabled by default
|
- network download is disabled by default
|
||||||
- network fallback is available only when `Z2M_ALLOW_NETWORK_FALLBACK=1`
|
- network fallback is available only when `Z2M_ALLOW_NETWORK_FALLBACK=1`
|
||||||
|
|
||||||
|
Bundle requirement:
|
||||||
|
|
||||||
|
- prefer a prebuilt bundle that already contains `dist/`
|
||||||
|
- this avoids running `pnpm exec tsc` on the Edge device
|
||||||
|
- some Edge ARM64 targets can fail during TypeScript compilation with `SIGILL`, while runtime works fine with a prebuilt `dist/`
|
||||||
|
- if `dist/controller.js` and `dist/util/onboarding.js` are present, `stage_z2m` skips the compile step and only writes the runtime hash
|
||||||
|
|
||||||
Current vendored archive:
|
Current vendored archive:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
file : stage_z2m/zigbee2mqtt.tar.gz
|
file : stage_z2m/zigbee2mqtt.tar.gz
|
||||||
source : https://codeload.github.com/Koenkk/zigbee2mqtt/tar.gz/refs/heads/master
|
source : prebuilt bundle derived from https://codeload.github.com/Koenkk/zigbee2mqtt/tar.gz/refs/heads/master
|
||||||
version : 2.9.2
|
version : 2.9.2
|
||||||
sha256 : 3a540374330bcbf1513f05485e84d507e768936f592ba4c4b22c694f201a4ae9
|
sha256 : f5fddb095c4aecf002602e0aa4096a9144b2394e59b7a25647c1d8b605d0cca1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Important:
|
||||||
|
|
||||||
|
- the current archive includes prebuilt `dist/`
|
||||||
|
- this lets Edge skip the local TypeScript compile step
|
||||||
|
- on devices where `tsc` crashes, this is the required production format
|
||||||
|
|
||||||
Update workflow:
|
Update workflow:
|
||||||
|
|
||||||
1. Download the new archive snapshot from the desired ref or tag.
|
1. Prepare a Zigbee2MQTT bundle from the desired ref or tag.
|
||||||
2. Replace `stage_z2m/zigbee2mqtt.tar.gz`.
|
2. Ensure the bundle contains compiled `dist/`.
|
||||||
3. Update the `version`, `source`, and `sha256` fields in this file.
|
3. Replace `stage_z2m/zigbee2mqtt.tar.gz`.
|
||||||
4. Re-test `stage_z2m` on Edge before using it in production.
|
4. Update the `version`, `source`, and `sha256` fields in this file.
|
||||||
|
5. Re-test `stage_z2m` on Edge before using it in production.
|
||||||
|
|
|
||||||
|
|
@ -416,6 +416,28 @@ write_if_changed() {
|
||||||
mv -f "$tmp" "$target"
|
mv -f "$tmp" "$target"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
verify_systemd_unit_file() {
|
||||||
|
local unit_name="$1"
|
||||||
|
local unit_path="$2"
|
||||||
|
|
||||||
|
[ -f "$unit_path" ] || die "Expected systemd unit file is missing: ${unit_path}"
|
||||||
|
|
||||||
|
if command -v systemd-analyze >/dev/null 2>&1; then
|
||||||
|
systemd-analyze verify "$unit_path" >/dev/null 2>&1 \
|
||||||
|
|| die "systemd-analyze verify failed for ${unit_name} (${unit_path})"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
verify_systemd_unit_registration() {
|
||||||
|
local unit_name="$1"
|
||||||
|
|
||||||
|
require_cmd systemctl
|
||||||
|
systemctl list-unit-files "$unit_name" --no-legend 2>/dev/null \
|
||||||
|
| awk '{print $1}' \
|
||||||
|
| grep -qx "$unit_name" \
|
||||||
|
|| die "systemd did not register unit after daemon-reload: ${unit_name}"
|
||||||
|
}
|
||||||
|
|
||||||
safe_inplace_edit() {
|
safe_inplace_edit() {
|
||||||
local target="$1"
|
local target="$1"
|
||||||
local tmp
|
local tmp
|
||||||
|
|
@ -839,12 +861,17 @@ build_z2m() {
|
||||||
export CI=1
|
export CI=1
|
||||||
log_build_versions "$build_user"
|
log_build_versions "$build_user"
|
||||||
build_snapshot
|
build_snapshot
|
||||||
|
|
||||||
|
if [ -f "${Z2M_DIR}/dist/controller.js" ] && [ -f "${Z2M_DIR}/dist/util/onboarding.js" ]; then
|
||||||
|
log "Detected prebuilt Zigbee2MQTT dist/ bundle -> skipping TypeScript compilation on edge"
|
||||||
|
else
|
||||||
run_logged_build_step \
|
run_logged_build_step \
|
||||||
"tsc" \
|
"tsc" \
|
||||||
"$TSC_TIMEOUT_SECONDS" \
|
"$TSC_TIMEOUT_SECONDS" \
|
||||||
"$TSC_LOG" \
|
"$TSC_LOG" \
|
||||||
sudo -u "$build_user" env CI=1 COREPACK_ENABLE_DOWNLOAD_PROMPT=0 nice -n 5 bash -lc "cd '$Z2M_DIR' && pnpm exec tsc --pretty false" \
|
sudo -u "$build_user" env CI=1 COREPACK_ENABLE_DOWNLOAD_PROMPT=0 nice -n 5 bash -lc "cd '$Z2M_DIR' && pnpm exec tsc --pretty false" \
|
||||||
|| die "TypeScript build step failed"
|
|| die "TypeScript build step failed"
|
||||||
|
fi
|
||||||
run_logged_build_step \
|
run_logged_build_step \
|
||||||
"writehash" \
|
"writehash" \
|
||||||
"$WRITEHASH_TIMEOUT_SECONDS" \
|
"$WRITEHASH_TIMEOUT_SECONDS" \
|
||||||
|
|
@ -1015,6 +1042,7 @@ LimitNOFILE=65536
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
Alias=iomatex-z2m.service
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
write_if_changed /usr/local/sbin/iomatex-z2m-healthcheck.sh 0755 root root <<EOF
|
write_if_changed /usr/local/sbin/iomatex-z2m-healthcheck.sh 0755 root root <<EOF
|
||||||
|
|
@ -1078,6 +1106,10 @@ Persistent=true
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=timers.target
|
WantedBy=timers.target
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
verify_systemd_unit_file "zigbee2mqtt.service" "/etc/systemd/system/zigbee2mqtt.service"
|
||||||
|
verify_systemd_unit_file "iomatex-z2m-healthcheck.service" "/etc/systemd/system/iomatex-z2m-healthcheck.service"
|
||||||
|
verify_systemd_unit_file "iomatex-z2m-healthcheck.timer" "/etc/systemd/system/iomatex-z2m-healthcheck.timer"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_web_status_proxy() {
|
install_web_status_proxy() {
|
||||||
|
|
@ -1268,6 +1300,8 @@ Group=root
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
verify_systemd_unit_file "iomatex-z2m-web.service" "/etc/systemd/system/iomatex-z2m-web.service"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_help_command() {
|
install_help_command() {
|
||||||
|
|
@ -1330,9 +1364,13 @@ EOF
|
||||||
|
|
||||||
enable_and_restart_services() {
|
enable_and_restart_services() {
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable zigbee2mqtt >/dev/null 2>&1 || true
|
verify_systemd_unit_registration "zigbee2mqtt.service"
|
||||||
systemctl enable iomatex-z2m-healthcheck.timer >/dev/null 2>&1 || true
|
verify_systemd_unit_registration "iomatex-z2m-healthcheck.service"
|
||||||
systemctl enable iomatex-z2m-web.service >/dev/null 2>&1 || true
|
verify_systemd_unit_registration "iomatex-z2m-healthcheck.timer"
|
||||||
|
verify_systemd_unit_registration "iomatex-z2m-web.service"
|
||||||
|
systemctl enable zigbee2mqtt
|
||||||
|
systemctl enable iomatex-z2m-healthcheck.timer
|
||||||
|
systemctl enable iomatex-z2m-web.service
|
||||||
systemctl restart zigbee2mqtt || systemctl start zigbee2mqtt
|
systemctl restart zigbee2mqtt || systemctl start zigbee2mqtt
|
||||||
systemctl restart iomatex-z2m-web.service || systemctl start iomatex-z2m-web.service
|
systemctl restart iomatex-z2m-web.service || systemctl start iomatex-z2m-web.service
|
||||||
systemctl start iomatex-z2m-healthcheck.timer || true
|
systemctl start iomatex-z2m-healthcheck.timer || true
|
||||||
|
|
@ -1348,6 +1386,8 @@ MQTT base_topic : ${MQTT_BASE_TOPIC}
|
||||||
Public Web UI : http://<device-ip>:${WEB_PORT_PUBLIC}
|
Public Web UI : http://<device-ip>:${WEB_PORT_PUBLIC}
|
||||||
Internal frontend : http://127.0.0.1:${WEB_PORT_INTERNAL}
|
Internal frontend : http://127.0.0.1:${WEB_PORT_INTERNAL}
|
||||||
Help : iomatex-help-z2m (or iomatex-z2m)
|
Help : iomatex-help-z2m (or iomatex-z2m)
|
||||||
|
Primary systemd unit : zigbee2mqtt.service
|
||||||
|
Alias systemd unit : iomatex-z2m.service
|
||||||
Logs : journalctl -u zigbee2mqtt -f
|
Logs : journalctl -u zigbee2mqtt -f
|
||||||
Web gateway logs : journalctl -u iomatex-z2m-web -f
|
Web gateway logs : journalctl -u iomatex-z2m-web -f
|
||||||
Critical state files : ${Z2M_DATA_DIR}/configuration.yaml, ${Z2M_DATA_DIR}/database.db, ${Z2M_DATA_DIR}/coordinator_backup.json, ${Z2M_DATA_DIR}/state.json
|
Critical state files : ${Z2M_DATA_DIR}/configuration.yaml, ${Z2M_DATA_DIR}/database.db, ${Z2M_DATA_DIR}/coordinator_backup.json, ${Z2M_DATA_DIR}/state.json
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue