mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 03:01:21 +02:00
In non-proxy VP modes (Immediate / Review / Print Queue), the slicer now sees real AMS / FTS / nozzle / k-profile state from the target printer and streams the live camera — full slicer-as-remote functionality without giving up Bambuddy's queue / archive / dispatch features. Architecture (cached-as-base, single source of truth). The bridge caches the latest real push_status and info.get_version response from Bambuddy's existing per-printer MQTT subscription — no second session on the printer, firmware in-flight budget unaffected (#1164). _send_status_report serves a near-byte-identical copy of the cached push with only the upload-state- machine fields overridden. Command responses (extrusion_cali_get, AMS write acks, xcam) fan out raw — they carry sequence_ids the slicer is waiting on. Slicer-issued commands forward to the printer except project_file / gcode_file, which still terminate locally because the file lives on Bambuddy. Camera is a raw TCPProxy on bind_ip:322 → printer:322, same approach proxy mode uses. Field-shape gotchas pinned in the bridge module's docstring and the new test file: - Real Bambu pushes use json.dumps(indent=4) wire format. Compact JSON fails BambuStudio's Send pre-flight silently. - net.info[*].ip is the FTP destination IP (little-endian uint32). Without rewriting to the VP bind IP, the slicer FTPs straight to the real printer. - upgrade_state.sn rewritten to VP serial; AMS-hardware sn fields (n3f/0.sn etc.) left alone. - ipcam.rtsp_url passes through unchanged; BambuStudio overrides the URL host with the device IP it bound on, so :322 lands on the VP's TCPProxy. - extrusion_cali_get must forward; answering it locally hides the user's stored per-filament k-profiles. Setup nuance for camera: the VP's access code must match the target printer's because the slicer authenticates RTSPS with whatever access code is in its profile. MQTT and FTP work either way. Tested e2e with BambuStudio and OrcaSlicer against H2D (dual-nozzle, AMS 2 Pro + AMS HT) and X1C across all three non-proxy modes — sync, send, k-profile lookup, AMS configuration from slicer, and live camera all work. Proxy mode is untouched: SlicerProxyManager owns its own proxies and never instantiates SimpleMQTTServer or MQTTBridge. 25 new tests in backend/tests/unit/test_vp_mqtt_bridge.py cover lifecycle, caching, identity / IP rewriting, wire format, slicer→printer routing, and the LE-uint32 IP encoder against the real H2D capture value.
99 lines
4.4 KiB
YAML
99 lines
4.4 KiB
YAML
services:
|
|
bambuddy:
|
|
image: ghcr.io/maziggy/bambuddy:latest
|
|
build: .
|
|
# Usage:
|
|
# docker compose up -d → pulls pre-built image from ghcr.io
|
|
# docker compose up -d --build → builds locally from source
|
|
container_name: bambuddy
|
|
# Run as current user to avoid permission issues with mounted volumes
|
|
# Override with: PUID=$(id -u) PGID=$(id -g) docker compose up -d
|
|
user: "${PUID:-1000}:${PGID:-1000}"
|
|
#
|
|
# Allow binding to privileged ports (322, 990) as non-root user — required
|
|
# for FTPS in every VP mode and for the RTSPS camera proxy in proxy mode +
|
|
# non-proxy modes that have a target printer configured. Without this, the
|
|
# FTP and RTSP listeners silently fail.
|
|
cap_add:
|
|
- NET_BIND_SERVICE
|
|
#
|
|
# LINUX: Use host mode for printer discovery and camera streaming
|
|
network_mode: host
|
|
#
|
|
# macOS/WINDOWS: Docker Desktop doesn't support host mode.
|
|
# Comment out "network_mode: host" above and uncomment "ports:" below.
|
|
# Note: Printer discovery won't work - add printers manually by IP.
|
|
#ports:
|
|
# - "${PORT:-8000}:8000"
|
|
# - "3000:3000" # Virtual printer bind/detect
|
|
# - "3002:3002" # Virtual printer bind/detect
|
|
# - "8883:8883" # Virtual printer MQTT
|
|
# - "990:990" # Virtual printer FTP control
|
|
# - "6000:6000" # Virtual printer file transfer tunnel
|
|
# - "322:322" # Virtual printer RTSP camera (X1/H2/P2; proxy mode + non-proxy modes with a target printer)
|
|
# - "2024-2026:2024-2026" # Virtual printer proprietary ports (A1/P1S)
|
|
# - "50000-50100:50000-50100" # Virtual printer FTP passive data
|
|
volumes:
|
|
- bambuddy_data:/app/data
|
|
- bambuddy_logs:/app/logs
|
|
#
|
|
# Share virtual printer certs with native installation
|
|
# This ensures the slicer only needs to trust one CA certificate.
|
|
- ./virtual_printer:/app/data/virtual_printer
|
|
#
|
|
# Mount scheduled backup output to NAS or external storage
|
|
# Backups default to DATA_DIR/backups/ inside the data volume.
|
|
# Uncomment to store them externally (e.g. on a NAS share).
|
|
#- /path/to/nas/bambuddy-backups:/app/data/backups
|
|
#
|
|
# Tailscale integration (optional): mount the host's tailscaled socket
|
|
# so Bambuddy can request Let's Encrypt certs for virtual printers via
|
|
# your tailnet's MagicDNS name. Requires:
|
|
# 1. Tailscale installed + `tailscale up` completed on the host
|
|
# 2. `sudo tailscale set --operator=<container-user>` on the host so
|
|
# the user running the container can call `tailscale cert`
|
|
# Without this mount, the Tailscale toggle in the UI is harmless —
|
|
# Bambuddy falls back to self-signed certs.
|
|
#- /var/run/tailscale/tailscaled.sock:/var/run/tailscale/tailscaled.sock
|
|
environment:
|
|
- TZ=${TZ:-Europe/Berlin}
|
|
# Port BamBuddy runs on (default: 8000)
|
|
# Usage: PORT=8080 docker compose up -d
|
|
- PORT=${PORT:-8000}
|
|
# Virtual printer: Set to the Docker host's IP when using bridge mode (ports:).
|
|
# Required for FTP passive mode to work behind NAT.
|
|
# Example: VIRTUAL_PRINTER_PASV_ADDRESS=192.168.1.100
|
|
#- VIRTUAL_PRINTER_PASV_ADDRESS=
|
|
#
|
|
# External PostgreSQL (optional — uses SQLite by default)
|
|
# Example: DATABASE_URL=postgresql+asyncpg://bambuddy:password@db-host:5432/bambuddy
|
|
#- DATABASE_URL=
|
|
#
|
|
# Slicer API sidecar (optional — Settings → "Use Slicer API" toggles this on).
|
|
# Default points at the OrcaSlicer sidecar on the docker host; change if you
|
|
# run the sidecar on a different host/port. The matching docker-compose.yml
|
|
# for the sidecars lives in the orca-slicer-api fork
|
|
# (https://github.com/maziggy/orca-slicer-api).
|
|
#- SLICER_API_URL=http://localhost:3003
|
|
restart: unless-stopped
|
|
|
|
# Optional: External PostgreSQL database
|
|
# Uncomment to run Postgres alongside Bambuddy (or use an external Postgres host)
|
|
#postgres:
|
|
# image: postgres:16-alpine
|
|
# container_name: bambuddy-db
|
|
# restart: unless-stopped
|
|
# environment:
|
|
# POSTGRES_USER: bambuddy
|
|
# POSTGRES_PASSWORD: changeme
|
|
# POSTGRES_DB: bambuddy
|
|
# volumes:
|
|
# - bambuddy_pgdata:/var/lib/postgresql/data
|
|
# ports:
|
|
# - "5432:5432"
|
|
|
|
volumes:
|
|
bambuddy_data:
|
|
bambuddy_logs:
|
|
#bambuddy_pgdata:
|