Flask backend and ui tweaks

This commit is contained in:
Mikkeli Matlock
2026-01-26 11:35:17 +09:00
parent 38229543af
commit 60a1c1811e
10 changed files with 221 additions and 43 deletions

View File

@@ -2,24 +2,34 @@
Build, deploy, and setup helpers for the Smart Serow project.
## Build & Deploy
## UI Build & Deploy
| Script | Purpose |
|--------|---------|
| `build.py` | Cross-compile Flutter app for ARM64. Runs `generate_theme.py` first. |
| `deploy.py` | rsync bundle to Pi, optionally restart service |
| `deploy.py` | rsync UI bundle to Pi, optionally restart service |
| `build-deploy.py` | Convenience wrapper: build → deploy → restart |
```bash
# Typical workflow
python3 build.py # Build only
python3 deploy.py --restart # Deploy and restart service
python3 build-deploy.py # All-in-one
# Clean rebuild (clears CMake cache)
python3 build.py --clean
python3 build.py --clean # Clean rebuild
```
## Backend Deploy
| Script | Purpose |
|--------|---------|
| `deploy_backend.py` | rsync Python backend to Pi, optionally restart service |
```bash
python3 deploy_backend.py # Deploy only
python3 deploy_backend.py --restart # Deploy and restart service
```
Backend and UI are **completely independent** — separate paths, separate services, separate deploys.
## Theme Generation
| Script | Purpose |
@@ -32,13 +42,19 @@ Called automatically by `build.py`. Looks for theme matching `navigator` in `con
| Script | Purpose |
|--------|---------|
| `pi_setup.sh` | First-time Pi configuration (deps, permissions, systemd service) |
| `smartserow-ui.service.sample` | Systemd unit file template |
| `pi_setup.sh` | First-time Pi config (deps, permissions, UI systemd service) |
| `smartserow-ui.service.sample` | UI systemd unit template |
| `smartserow-backend.service.sample` | Backend systemd unit template |
```bash
# On the Pi
# On the Pi (UI)
chmod +x pi_setup.sh
./pi_setup.sh
# Backend service (manual for now)
sudo cp smartserow-backend.service.sample /etc/systemd/system/smartserow-backend.service
sudo systemctl daemon-reload
sudo systemctl enable smartserow-backend
```
## Configuration
@@ -53,7 +69,10 @@ chmod +x pi_setup.sh
"user": "pi",
"host": "raspberrypi.local",
"remote_path": "/opt/smartserow",
"service_name": "smartserow-ui"
"service_name": "smartserow-ui",
"assets_path": "~/smartserow-ui/assets",
"backend_path": "/opt/smartserow-backend",
"backend_service": "smartserow-backend"
}
```