# 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) ```bash 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) ```bash 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: ```bash pct exec 210 -- bash /opt/busbar-designer/deploy/update.sh ``` Or SSH in and: ```bash 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). ```bash # 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`. |