Remove proxmox-lxc.sh; recommend manual LXC creation via Proxmox UI

The whiptail helper added cognitive overhead without saving much time vs.
the standard Proxmox web UI. Removed it from deploy/ and rewrote README +
deploy/README to point at the manual flow:

  1. Create LXC via Proxmox UI (Debian 12, 4c/8GB/32GB, nesting=1)
  2. Inside: curl deploy/install.sh — provisions everything

install.sh and update.sh stay (those are useful).
This commit is contained in:
wenil
2026-05-24 19:51:30 +03:00
parent 6bc922cabf
commit cd2840fbb3
3 changed files with 40 additions and 283 deletions
+27 -73
View File
@@ -1,111 +1,65 @@
# Deploy
Three scripts here, plus the systemd unit.
Two scripts here, plus the systemd unit.
| File | Where it runs | What it does |
|-------------------------------|--------------------------------|---------------------------------------------------------------------------|
| `proxmox-lxc.sh` | **Proxmox VE host** as root | Creates an unprivileged Debian 12 LXC, then runs `install.sh` inside it. |
| `install.sh` | **inside** an LXC/VM/server | 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`. |
| `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. |
All scripts are idempotent (safe to re-run) and use only stdlib + Debian-shipped tools (`pct`, `pveam`, `whiptail`, `git`, `python3`). No external dependencies.
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.
---
## Step 0 — push to your Gitea (one time)
## Push to your Gitea (one time)
```bash
# on your laptop, in this repo
git remote add gitea https://gitea.local/me/busbar-designer.git
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` everywhere (or install the cert into the system trust store).
If your Gitea uses a self-signed cert, set `GIT_SSL_NO_VERIFY=1` (or install the CA into the system trust store).
---
## Path A — Proxmox VE host (recommended)
One-liner from the Proxmox shell:
## Inside a Debian / Ubuntu host (LXC, VM, bare)
```bash
bash -c "$(curl -fsSL https://gitea.local/me/busbar-designer/raw/branch/main/deploy/proxmox-lxc.sh)"
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)"
```
(Substitute `https://gitea.local/me/busbar-designer/raw/branch/main/deploy/proxmox-lxc.sh` with your repo's raw URL. Gitea's raw URL format is `https://<host>/<user>/<repo>/raw/branch/<branch>/<path>`.)
Defaults: `/opt/busbar-designer`, user `busbar`, port `5000`. Override with `INSTALL_DIR`, `SVC_USER`, `PORT`.
You'll get whiptail prompts for:
- Container ID (defaults to next available)
- Hostname (`busbar-designer`)
- Disk size (4 GB), cores (2), RAM (1024 MB)
- Storage pool, network bridge, IP (`dhcp` or `1.2.3.4/24,gw=1.2.3.1`)
- Repo URL & branch
- Skip TLS verify? (yes if your Gitea uses self-signed certs)
The script will:
1. Download Debian 12 template if missing.
2. Create the LXC, start it.
3. Inside the LXC: clone the repo, install everything, enable systemd.
4. Print the URL + root password + management commands.
To skip prompts (CI / scripted re-deploys):
```bash
CTID=210 HOSTNAME=busbar DISK_SIZE=4 CORES=2 RAM=1024 \
BRIDGE=vmbr0 IP=dhcp STORAGE=local-lvm \
REPO_URL=https://gitea.local/me/busbar-designer.git BRANCH=main \
bash deploy/proxmox-lxc.sh
```
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)
---
## Path B — inside an existing LXC / VM / bare server
Already have a Debian 12 / Ubuntu 22.04 / 24.04 host? Just run the installer:
```bash
REPO_URL=https://gitea.local/me/busbar-designer.git \
bash -c "$(curl -fsSL https://gitea.local/me/busbar-designer/raw/branch/main/deploy/install.sh)"
```
Defaults to `/opt/busbar-designer`, user `busbar`, port `5000`. Override with `INSTALL_DIR`, `SVC_USER`, `PORT`.
---
## Updating
## Updating after `git push`
From the Proxmox host:
```bash
pct exec 210 -- bash /opt/busbar-designer/deploy/update.sh
```
From inside the LXC:
Or SSH in and:
```bash
sudo bash /opt/busbar-designer/deploy/update.sh
```
The updater does `git fetch + reset --hard` on the tracked branch, refreshes Python deps, restarts the service.
### Optional: auto-deploy via Gitea webhook
In your Gitea repo → **Settings → Webhooks → Add Webhook (Gitea)**:
- URL: `http://<lxc-ip>:5050/hook` (you'd need to add a tiny webhook listener; not built-in)
- Trigger: `Push`
- Branch filter: `main`
Out of the box there's no webhook endpoint — the simplest path is a cron `*/5 * * * * root bash /opt/busbar-designer/deploy/update.sh` if you want polling, or just SSH and re-run `update.sh` after each push.
Does `git fetch + reset --hard` on the tracked branch, refreshes Python deps, restarts the service.
---
## Backup & restore
Everything user-generated lives in `/opt/busbar-designer/data/busbar.db` (SQLite, single file).
All user data lives in `/opt/busbar-designer/data/busbar.db` (SQLite, single file).
```bash
# Backup (from Proxmox host)
@@ -116,7 +70,7 @@ 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 via Proxmox's own LXC backup (`vzdump`) which captures the whole rootfs.
Or use Proxmox's own LXC backup (`vzdump`) which captures the whole rootfs (slower, captures everything).
---
@@ -124,8 +78,8 @@ Or via Proxmox's own LXC backup (`vzdump`) which captures the whole rootfs.
| Symptom | Fix |
|--------------------------------------------------|---------------------------------------------------------------------------------------|
| `pveversion: command not found` | The Proxmox script is not running on a PVE host. Use `install.sh` directly inside the LXC. |
| Git clone fails with TLS error | Set `GIT_SSL_NO_VERIFY=1` env var, or install your Gitea CA cert into `/usr/local/share/ca-certificates`. |
| Service starts, then dies | `pct exec <CTID> -- journalctl -u busbar-designer -n 100`. Usually the build123d wheel didn't install — Debian 12 ships Python 3.11 which is fine. |
| Browser shows 502 / can't connect | Check the LXC's IP with `pct exec <CTID> -- ip a`. If using DHCP, the IP may have changed. |
| `pveam download` fails | Run `pveam update` on the host first. |
| 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`. |