8058
Ir
irvc / files
irvc / README.md
3.4 KB
1# IRVC — Internet Relay Voice Chat 2 3A WebRTC-powered text and voice chat. Private, self-hosted, personal server. 4See [irvc.md](./irvc.md) for the design and [DEPLOY.md](./DEPLOY.md) for the 5deployment runbook. 6 7## Architecture 8 9Three processes on one host: 10 11- **livekit-server** — voice and screen share. Ephemeral rooms. 12- **irvc** (this repo, Go) — API, auth, text chat and presence over WebSocket, 13 media uploads, SQLite. 14- **Caddy** — TLS + reverse proxy for the frontend, API, and LiveKit signal. 15 16## Local dev (Podman) 17 18An alternate, disposable dev path that does not touch the bare-metal setup: 19`deploy/dev/` builds irvc + the frontend into one image and runs it with 20LiveKit under Podman. 21 22 cd deploy/dev 23 podman-compose up -d --build 24 25Serves <http://localhost:8080>. The container serves the built frontend; run 26`cd web && npm run dev` for HMR (Vite proxies `/api` to `:8080`). See 27`deploy/dev/README.md` for invites, state, and reset. 28 29## System dependencies 30 31The deployment path below is bare Linux, no Docker. On Arch: 32 33 sudo pacman -S go nodejs npm caddy 34 35`livekit-server` is not packaged on Arch. Install its release binary to 36`~/.local/bin` (or `/usr/local/bin`) from the 37[livekit releases](https://github.com/livekit/livekit/releases). 38 39## Build 40 41`make` builds both the Go server and the web frontend. Or step by step: 42 43 go build -o irvc . 44 cd web && npm install && npm run build 45 46`web/dist` is served by the Go process. `make test` runs the Go and npm tests; 47`make fmt` formats. For frontend work, `cd web && npm run dev` runs Vite. 48 49## Configuration 50 51Secrets come from the shell env: 52 53| Var | Default | Notes | 54| --- | --- | --- | 55| `IRVC_LISTEN_ADDR` | `:8080` | | 56| `IRVC_DB_PATH` | `irvc.db` | SQLite file, the only state | 57| `IRVC_SESSION_SECRET` | — | **required**; signs session cookies | 58| `IRVC_LIVEKIT_URL` | — | e.g. `wss://livekit.example.com` (browser-facing) | 59| `IRVC_LIVEKIT_API_KEY` | — | must match livekit-server | 60| `IRVC_LIVEKIT_SECRET` | — | must match livekit-server | 61| `IRVC_MEDIA_DIR` | `media` | uploaded media storage, the only other state | 62| `IRVC_MAX_UPLOAD` | `8388608` | max media upload bytes | 63| `IRVC_GIPHY_API_KEY` | — | Giphy API key; `/gif` and the gif picker are disabled without it | 64 65Voice is disabled if the LiveKit vars are unset. 66 67The address, DB, media, upload, and LiveKit URL settings also have flags 68(`--listen`, `--db`, `--media-dir`, `--max-upload`, `--livekit-url`). Run 69`./irvc --help`. `./irvc --gen-secret` prints a random session secret. 70 71Example `livekit.yaml` (run with `livekit-server --config livekit.yaml`): 72 73 port: 7880 74 rtc: 75 tcp_port: 7881 76 port_range_start: 50000 77 port_range_end: 60000 78 use_external_ip: true 79 keys: 80 irvc: <IRVC_LIVEKIT_SECRET> 81 82## Invites 83 84Single-use, 14-day expiry. Create one: 85 86 ./irvc invite 87 88It prints the token and a `/join?token=...` link. Revoke = delete the row. 89 90## Run 91 92 export IRVC_SESSION_SECRET=... 93 export IRVC_LIVEKIT_URL=wss://livekit.example.com 94 export IRVC_LIVEKIT_API_KEY=irvc 95 export IRVC_LIVEKIT_SECRET=... 96 ./irvc 97 98Caddy terminates TLS and proxies both hosts to their local ports: 99 100 irvc.example.com { 101 reverse_proxy 127.0.0.1:8080 102 } 103 104 livekit.example.com { 105 reverse_proxy 127.0.0.1:7880 106 } 107 108Media ports (`7881/tcp`, `50000-60000/udp`) are exposed raw, not proxied; 109open them in the host firewall. 110 111## Service 112 113Run both under systemd so they start on boot and restart on crash.