feat(printer): badge print queue, Pi worker, captive-portal setup, admin printing view

- migration 20261018170000: pgmq badge_print/badge_print_dlq, print_stations,
  token-gated printer RPCs (claim/complete/fail/heartbeat), admin RPCs,
  welcome_checkin enqueue; badge_print_tests.sql (101 assertions)
- apps/printer: Python worker (Playwright render -> brother_ql via pyusb),
  comitup captive-portal (Wi-Fi + HTTPS endpoint + anon key + token),
  arm64 image build + idempotent Pi setup/install scripts, 77 pytest
- apps/admin: Printing view, station management/DLQ, global printer status
  pill, Print button on Registrations, standalone print renderer entry
  (print.html -> dist-print) with bundled fonts
- docs: printing.md + architecture/schema/rpcs/tests/admin-app updates,
  apps/printer/AGENT.md operating manual
- e2e: printing.spec.ts

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
committed 2026-10-18 22:25:38 +02:00
1 parent 0f3720d48a
commit 00c89c1b48
55 files changed
+7406 -29

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
# Copy setup (+ worker image when present) to the Pi and run it as root.
# Usage: apps/printer/pi/install.sh [ssh-target] (default: convivo-pi)
# Env: PI_SUDO_PASSWORD (prompted if unset), STAGE_APP / STAGE_WIFI_PORTAL / REBOOT forwarded to setup.sh.
# SKIP_BUILD=1 reuses an existing image tar instead of rebuilding it.
# SKIP_IMAGE=1 does not upload the image tar (reuse the image already on the Pi).
set -euo pipefail
TARGET="${1:-convivo-pi}"
DIR="$(cd "$(dirname "$0")" && pwd)"
ROOT="$(cd "$DIR/../../.." && pwd)"
SETUP="$DIR/setup.local.sh"
[[ -f $SETUP ]] || SETUP="$DIR/setup.sh"
PORTAL="$ROOT/apps/printer/portal/portal.py"
IMAGE="$DIR/convivo-printer-image.tar.gz"
# /tmp is a small RAM tmpfs on the Pi; the image tarball needs disk.
REMOTE=/var/tmp/convivo-setup
if [[ "${SKIP_BUILD:-0}" != 1 && "${SKIP_IMAGE:-0}" != 1 ]]; then
# SKIP_IMAGE reuses the Pi's image, so a local build would only be discarded.
# Cross-build the arm64 image from the repo root (default docker builder).
if ! docker buildx inspect default 2>/dev/null | grep -q linux/arm64; then
echo "linux/arm64 not in buildx default builder — installing QEMU binfmt" >&2
docker run --privileged --rm tonistiigi/binfmt --install arm64
fi
echo "Building convivo-printer image (arm64) → $IMAGE"
(
cd "$ROOT"
docker buildx build --platform linux/arm64 \
-f apps/printer/Dockerfile \
--build-arg "APP_VERSION=$(git rev-parse --short HEAD)-$(date +%Y%m%d%H%M)" \
-t convivo-printer:latest \
--output "type=docker,dest=-" . | gzip > "$IMAGE"
)
fi
ssh "$TARGET" "mkdir -p $REMOTE"
scp -q "$SETUP" "$TARGET:$REMOTE/setup.sh"
scp -q "$PORTAL" "$TARGET:$REMOTE/portal.py"
if [[ "${SKIP_IMAGE:-0}" == 1 ]]; then
# Reuse the image already loaded on the Pi; drop any stale tar so setup.sh does not load it.
ssh "$TARGET" "rm -f $REMOTE/convivo-printer-image.tar.gz"
else
[[ -f $IMAGE ]] && scp -q "$IMAGE" "$TARGET:$REMOTE/convivo-printer-image.tar.gz"
fi
if [[ -z "${PI_SUDO_PASSWORD:-}" ]]; then
read -rsp "sudo password for $TARGET: " PI_SUDO_PASSWORD
echo
fi
STAGE_ENV=()
for v in STAGE_APP STAGE_WIFI_PORTAL REBOOT; do
[[ -n "${!v:-}" ]] && STAGE_ENV+=("$v=${!v}")
done
printf '%s\n' "$PI_SUDO_PASSWORD" | ssh "$TARGET" "sudo -S -p '' env ${STAGE_ENV[*]:-} bash $REMOTE/setup.sh"