tronbyt/README.md
2026-03-10 16:53:05 -07:00

67 lines
3.2 KiB
Markdown

# Tronbyt
Run a [Tronbyt](https://github.com/tronbyt/server) server as a toes app. Tronbyt is a self-hosted replacement for Tidbyt's cloud — it renders Starlark apps into WebP frames and pushes them to Tidbyt LED displays over your local network.
This app spawns the pre-built Tronbyt Go binary as a subprocess and proxies all traffic (HTTP + WebSocket) to it over a unix socket. The Go server handles everything — web dashboard, device connections, app rendering. Bun just sits in front and makes it a good toes citizen.
## Install
### 1. Deploy to your toes server
```sh
git remote add toes http://git.toes.local/tronbyt
git push toes main
```
Pushing to the git tool deploys the app, runs `bun install` (which downloads the binary), and starts it automatically.
### 2. The binary
The Tronbyt Go binary is downloaded automatically during `bun install` via the postinstall script. It assumes you're running on a Raspberry Pi (linux-arm64) — which is what toes is designed for.
The binary is gitignored since it's platform-specific and ~50MB. If you need to re-download it or the postinstall didn't run, you can grab it manually:
```sh
curl -L -o bin/tronbyt-server-linux-arm64 \
https://github.com/tronbyt/server/releases/latest/download/tronbyt-server-linux-arm64
chmod +x bin/tronbyt-server-linux-arm64
```
If the binary already exists in `bin/`, the postinstall skips the download.
### 3. First boot
On first start, the server clones the [community Starlark apps repo](https://github.com/tronbyt/apps) (~15 seconds). With `PRODUCTION=false` (the default), firmware downloads are skipped.
All data (SQLite DB, cloned apps, firmware) is stored in the app's `DATA_DIR`, which persists across restarts and deploys.
## Configure your Tidbyt
1. Flash your Tidbyt with [Tronbyt firmware](https://github.com/tronbyt/server/releases) (see firmware flashing docs)
2. During device setup, set the **Image URL** to:
```
http://tronbyt.toes.local/<device-id>/next
```
The device ID is assigned when you add the device in the Tronbyt web dashboard.
**Important:** The Image URL must be the full path including `/<device-id>/next` — the device uses it exactly as-is.
## Environment Variables
Set these through `toes env tronbyt` to override defaults:
| Variable | Default | Description |
|---|---|---|
| `PRODUCTION` | `false` | Set `true` to enable firmware downloads for OTA updates |
| `SINGLE_USER_AUTO_LOGIN` | `true` | Auto-login without password (good for home network) |
| `SYSTEM_APPS_AUTO_REFRESH` | `true` | Auto-refresh community apps repo every 12h |
## How the binary is managed
- `bun install` runs `scripts/postinstall.sh`, which downloads `tronbyt-server-linux-arm64` into `bin/` if it doesn't already exist
- At runtime, the app looks for a binary in `bin/` matching the current platform (`tronbyt-server-{darwin|linux}-{arm64|amd64}`)
- If the binary isn't found, the app logs an error with the download URL and the expected filename
- The binary runs as a child process with `stdout`/`stderr` inherited (logs show up in toes)
- On shutdown (SIGTERM from toes), the app forwards SIGTERM to the Go process
- The unix socket is created in `DATA_DIR/tronbyt.sock` and cleaned up on startup to handle stale sockets from crashes