Files
busbar-designer/deploy
wenil 0aa38809b4 holder: switch to OpenSCAD Manifold backend (10-50x faster renders)
OpenSCAD 2021.01 (Debian 13 default) is single-threaded CGAL. The Manifold
backend, available in OpenSCAD 2024+, parallelises CSG operations and
gives massive speedups on multi-cell holders.

Bench on this LXC (6 cores), realistic params:
  6x12  (72 cells):  CGAL  3.14s -> Manifold 0.08s   (37x)
  10x20 (200 cells): -                       1.41s
  15x25 (375 cells): -                       1.97s

Installation steps performed on the server (manual, not in this repo):
  wget https://files.openscad.org/snapshots/OpenSCAD-2026.04.26-x86_64.AppImage
  ./AppImage --appimage-extract  (no FUSE required)
  ln -s squashfs-root/AppRun /usr/local/bin/openscad-nightly

Code changes:
- holder.py: new OPENSCAD_BACKEND env var (default "Manifold");
  appends "--backend Manifold" to the openscad call when set.
- deploy/busbar-designer.service: points OPENSCAD_BIN at the
  extracted nightly and sets OPENSCAD_BACKEND=Manifold.

Real-time progress percentage was investigated but not implemented:
OpenSCAD has no headless --progress flag, so live % from the CLI is
not feasible. With Manifold making renders sub-second to a few seconds,
the existing indeterminate progress bar + elapsed timer is sufficient.
2026-05-25 11:35:20 +03:00
..
2026-05-24 18:59:50 +03:00

Deploy

Two scripts here, plus the systemd unit.

File Where it runs What it does
install.sh inside a Debian/Ubuntu host Clones the repo, sets up Python venv, installs deps, starts systemd unit.
update.sh inside the LXC/VM/server git pull + refresh Python deps + systemctl restart.
busbar-designer.service systemd Unit file template; install.sh substitutes paths/user/port.

Both scripts are idempotent (safe to re-run) and use only stdlib + Debian-shipped tools.

Want to create the LXC and provision it in one go? See the manual walk-through in the main README.md (Quick start / Deploy section). The earlier proxmox-lxc.sh whiptail helper was removed — the Proxmox web UI + this install.sh are simpler and easier to debug.


Push to your Gitea (one time)

git remote add gitea https://gitea.example.com/me/busbar-designer.git
git push gitea main

If your Gitea uses a self-signed cert, set GIT_SSL_NO_VERIFY=1 (or install the CA into the system trust store).


Inside a Debian / Ubuntu host (LXC, VM, bare)

REPO_URL=https://gitea.example.com/me/busbar-designer.git \
bash -c "$(curl -fsSL https://gitea.example.com/me/busbar-designer/raw/branch/main/deploy/install.sh)"

Defaults: /opt/busbar-designer, user busbar, port 5000. Override with INSTALL_DIR, SVC_USER, PORT.

What it installs:

  • Debian packages: git python3 python3-venv libgl1 libglu1-mesa libxrender1 libxext6 libsm6 libgomp1 openscad xvfb
  • Python venv with build123d, Flask, ezdxf, gunicorn
  • systemd unit (substituted with your paths/user/port)

Updating after git push

From the Proxmox host:

pct exec 210 -- bash /opt/busbar-designer/deploy/update.sh

Or SSH in and:

sudo bash /opt/busbar-designer/deploy/update.sh

Does git fetch + reset --hard on the tracked branch, refreshes Python deps, restarts the service.


Backup & restore

All user data lives in /opt/busbar-designer/data/busbar.db (SQLite, single file).

# Backup (from Proxmox host)
pct exec 210 -- cat /opt/busbar-designer/data/busbar.db > busbar-backup-$(date +%F).db

# Restore
cat busbar-backup-2026-05-24.db | pct exec 210 -- bash -c \
  'systemctl stop busbar-designer && cat > /opt/busbar-designer/data/busbar.db && chown busbar:busbar /opt/busbar-designer/data/busbar.db && systemctl start busbar-designer'

Or use Proxmox's own LXC backup (vzdump) which captures the whole rootfs (slower, captures everything).


Troubleshooting

Symptom Fix
Git clone fails with TLS error Set GIT_SSL_NO_VERIFY=1, or install your Gitea CA cert into /usr/local/share/ca-certificates.
Service starts then dies journalctl -u busbar-designer -n 100. Usually OCP wheel didn't install — check Python version.
/api/holder/render returns 500 which openscad. If missing: apt install -y openscad.
Browser shows 502 / can't connect Check IP with hostname -I. If DHCP, the IP may have changed.
Port 5000 already in use Edit systemd unit: Environment=PORT=5050 and ExecStart=...--bind=0.0.0.0:5050.