Files
busbar-designer/deploy/busbar-designer.service
T
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

48 lines
1.7 KiB
Desktop File

; systemd unit for running busbar-designer in a Proxmox LXC (or any Linux VM)
; without Docker. Assumes the project lives at /opt/busbar-designer and you've
; created a venv there with `python3 -m venv .venv && .venv/bin/pip install -r
; requirements.txt gunicorn`.
;
; Install:
; sudo cp deploy/busbar-designer.service /etc/systemd/system/
; sudo systemctl daemon-reload
; sudo systemctl enable --now busbar-designer
;
; Logs: journalctl -u busbar-designer -f
[Unit]
Description=Busbar Designer (Flask + build123d)
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=busbar
Group=busbar
WorkingDirectory=/opt/busbar-designer
Environment=HOST=0.0.0.0
Environment=PORT=5000
Environment=FLASK_DEBUG=0
Environment=PATH=/opt/busbar-designer/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
; Use OpenSCAD nightly (extracted AppImage) for the Manifold backend.
; Falls back to system "openscad" (CGAL) if this binary is missing.
Environment=OPENSCAD_BIN=/usr/local/bin/openscad-nightly
Environment=OPENSCAD_BACKEND=Manifold
; HOME points inside the project so ezdxf / matplotlib / build123d can write
; their config + cache while ProtectHome=true still hides the real /home.
Environment=HOME=/opt/busbar-designer/data
Environment=XDG_CONFIG_HOME=/opt/busbar-designer/data/.config
Environment=XDG_CACHE_HOME=/opt/busbar-designer/data/.cache
ExecStart=/opt/busbar-designer/.venv/bin/gunicorn --bind=0.0.0.0:5000 --workers=2 --threads=2 --timeout=300 app:app
Restart=on-failure
RestartSec=5
; Hardening
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/opt/busbar-designer
[Install]
WantedBy=multi-user.target