add boot-time synth-diagnostic.service

- synth-diagnostic.service: runs test-unit.py before pipeline services
- Type=oneshot, After=prometheus-exporter, Before=pipeline services
- Pipeline services: After=synth-diagnostic
- deploy: restart prometheus-exporter → start synth-diagnostic → restart pipeline
- install.sh: includes synth-diagnostic in SERVICES array
This commit is contained in:
2026-06-24 02:48:40 -07:00
parent 2e10839fc9
commit b445c272fb
8 changed files with 46 additions and 6 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
set -euo pipefail set -euo pipefail
REPO="/home/arduino/uno-q-audio-synth" REPO="/home/arduino/uno-q-audio-synth"
SERVICES=(midi-bridge pd-synth-onboard led-matrix-viz prometheus-exporter) SERVICES=(synth-diagnostic midi-bridge pd-synth-onboard led-matrix-viz prometheus-exporter)
for svc in "${SERVICES[@]}"; do for svc in "${SERVICES[@]}"; do
sudo cp "$REPO/system/$svc.service" /etc/systemd/system/ sudo cp "$REPO/system/$svc.service" /etc/systemd/system/
+3 -1
View File
@@ -104,7 +104,9 @@ deploy:
cd {{REPO_DIR}} && git pull && \ cd {{REPO_DIR}} && git pull && \
chmod +x scripts/*.py scripts/*.sh 2>/dev/null; \ chmod +x scripts/*.py scripts/*.sh 2>/dev/null; \
echo '{{BOARD_PASS}}' | sudo -S systemctl daemon-reload && \ echo '{{BOARD_PASS}}' | sudo -S systemctl daemon-reload && \
echo '{{BOARD_PASS}}' | sudo -S systemctl restart midi-bridge pd-synth-onboard led-matrix-viz prometheus-exporter && \ echo '{{BOARD_PASS}}' | sudo -S systemctl restart prometheus-exporter && \
echo '{{BOARD_PASS}}' | sudo -S systemctl start synth-diagnostic && \
echo '{{BOARD_PASS}}' | sudo -S systemctl restart midi-bridge pd-synth-onboard led-matrix-viz && \
echo '[OK] Deployed + restarted'" echo '[OK] Deployed + restarted'"
# Start synth (onboard audio) # Start synth (onboard audio)
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# run-tests.sh — wrapper for test-unit.py with exit code mapping
set -euo pipefail
BOARD="${BOARD_HOST:-192.168.9.167}"
cd /home/arduino/uno-q-audio-synth
echo "[diag] Running synth pipeline diagnostics against $BOARD..."
python3 scripts/test-unit.py "$BOARD"
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "[diag] All tests PASSED — pipeline healthy"
else
echo "[diag] Tests FAILED (exit $exit_code) — check dashboard for details"
fi
exit $exit_code
+1 -1
View File
@@ -1,6 +1,6 @@
[Unit] [Unit]
Description=LED Matrix MIDI Visualization Description=LED Matrix MIDI Visualization
After=arduino-router.service After=arduino-router.service synth-diagnostic.service
[Service] [Service]
User=arduino User=arduino
+1 -1
View File
@@ -1,6 +1,6 @@
[Unit] [Unit]
Description=MIDI rawmidi → Pd UDP bridge (auto-detects gadget/host) Description=MIDI rawmidi → Pd UDP bridge (auto-detects gadget/host)
After=multi-user.target After=multi-user.target synth-diagnostic.service
[Service] [Service]
Type=simple Type=simple
+1 -1
View File
@@ -1,6 +1,6 @@
[Unit] [Unit]
Description=Pure Data Synth (Onboard PMIC Audio) Description=Pure Data Synth (Onboard PMIC Audio)
After=multi-user.target After=multi-user.target synth-diagnostic.service
Wants=midi-bridge.service Wants=midi-bridge.service
[Service] [Service]
+1 -1
View File
@@ -1,6 +1,6 @@
[Unit] [Unit]
Description=Prometheus metrics exporter for synth pipeline Description=Prometheus metrics exporter for synth pipeline
After=multi-user.target After=multi-user.target synth-diagnostic.service
[Service] [Service]
Type=simple Type=simple
+19
View File
@@ -0,0 +1,19 @@
[Unit]
Description=Synth pipeline diagnostic — runs unit tests at boot
DefaultDependencies=no
After=multi-user.target prometheus-exporter.service
Before=midi-bridge.service pd-synth-onboard.service led-matrix-viz.service
[Service]
Type=oneshot
ExecStart=/home/arduino/uno-q-audio-synth/scripts/run-tests.sh
StandardOutput=journal
StandardError=journal
RemainAfterExit=yes
# Don't let failures cascade — critical for headless boot
# On failure: services won't start, board stays SSH-accessible
FailureAction=none
[Install]
WantedBy=multi-user.target