feat: add Proxmox LXC deployment files

- Add deploy/proxmox-lxc-setup.sh to configure the frontend inside a Debian/Ubuntu LXC.
- Add deploy/thermopro-frontend.service systemd unit.
- Add deploy/README.md with Proxmox CT creation, file transfer, setup, proxy, and update steps.
- Update frontend README.md to point to the deployment guide.
This commit is contained in:
Keith Solomon
2026-07-20 20:37:02 -05:00
parent c80de43f55
commit 5fda27794d
4 changed files with 229 additions and 1 deletions
+136
View File
@@ -0,0 +1,136 @@
# Deploying the Frontend to a Proxmox LXC Container
This folder contains everything you need to run the ThermoPro CYD frontend inside an unprivileged Proxmox LXC container.
## Overview
1. Create a Debian 12 (or Ubuntu 22.04/24.04) LXC container in Proxmox.
2. Copy the `frontend/` directory into the container.
3. Run `deploy/proxmox-lxc-setup.sh` inside the container.
4. The container starts the Flask/Waitress app as a systemd service on port 5000.
5. Put the container behind a reverse proxy (Caddy/Nginx) for HTTPS and a friendly URL.
## Container specs (suggested)
- **OS template:** Debian 12 Standard (or Ubuntu 22.04/24.04 Standard)
- **Cores:** 1
- **Memory:** 512 MB
- **Root disk:** 4 GB
- **Network:** DHCP or static IP on your LAN
## One-time setup
### 1. Create the LXC
In the Proxmox web UI:
- Click **Create CT**.
- Choose a Debian 12 template (download from the UI if needed).
- Set hostname, password/SSH key, storage, network, etc.
- Finish and start the container.
Or via the Proxmox shell:
```bash
pct create 300 local:vztmpl/debian-12-standard_12.x-amd64.tar.zst \
--hostname thermopro-frontend \
--cores 1 \
--memory 512 \
--swap 0 \
--rootfs local-lvm:4 \
--net0 name=eth0,bridge=vmbr0,ip=dhcp \
--ostype debian \
--unprivileged 1
pct start 300
```
### 2. Copy the frontend into the container
From your development machine or the Proxmox host:
```bash
# From the repo root
cd /path/to/ThermoPro-CYD
tar -czf /tmp/frontend.tar.gz frontend/
# Push it into the container
pct push 300 /tmp/frontend.tar.gz /tmp/frontend.tar.gz
# Extract it
pct exec 300 -- mkdir -p /opt
pct exec 300 -- tar -xzf /tmp/frontend.tar.gz -C /opt
```
### 3. Run the setup script inside the container
```bash
pct exec 300 -- bash /opt/frontend/deploy/proxmox-lxc-setup.sh
```
This installs Python dependencies into `vendor/`, creates the `thermopro` user, sets up the systemd service, and starts it.
### 4. Find the container IP
```bash
pct exec 300 -- ip -4 addr show eth0
```
Visit `http://<container-ip>:5000`.
## Configuration
Edit the service file to point at your CYD and tune behavior:
```bash
pct exec 300 -- nano /etc/systemd/system/thermopro-frontend.service
```
Key environment variables:
| Variable | Default | Description |
|----------|---------|-------------|
| `CYD_BASE_URL` | `http://192.168.2.55` | Base URL of the CYD bridge |
| `POLL_INTERVAL` | `5` | Seconds between backend polls of the CYD |
| `DATABASE_PATH` | `/data/thermopro.db` | SQLite path (persistent mount) |
After editing:
```bash
pct exec 300 -- systemctl daemon-reload
pct exec 300 -- systemctl restart thermopro-frontend
```
## Reverse proxy / HTTPS (recommended)
Use Caddy or Nginx on the Proxmox host, another container, or your router to expose the app on a friendly URL. Example Caddyfile:
```
bbq.example.com {
reverse_proxy http://<container-ip>:5000
}
```
## Updating the app
To push a new version:
```bash
# Re-tar the frontend folder and push it into the container
tar -czf /tmp/frontend.tar.gz frontend/
pct push 300 /tmp/frontend.tar.gz /tmp/frontend.tar.gz
# Extract over the install directory and restart
pct exec 300 -- bash -c "tar -xzf /tmp/frontend.tar.gz -C /opt && chown -R thermopro:thermopro /opt/frontend && systemctl restart thermopro-frontend"
```
## Persistent data
By default the SQLite database is written to `/data/thermopro.db` inside the container. Proxmox backups include the container root disk, so the database is preserved. If you prefer to store it on the host, add a bind mount in the Proxmox container config:
```bash
# On the Proxmox host
mkdir -p /var/lib/thermopro-data
pct set 300 -mp0 /var/lib/thermopro-data,mp=/data
```
Then restart the container.