xonecas.io
8058
Ir

irvc / commit cda9732

feat: seed dev db with some users

xonecas2026-10-15 cda97320480ccb6816aa6ce2681a70178a2bf098 parent f6af39f

4 files changed

deploy/dev/Containerfile+1−1
@@ -16,7 +16,7 @@ COPY web/ ./
1616 RUN npm run build
1717
1818 FROM docker.io/library/alpine:3.21
19-RUN apk add --no-cache ca-certificates && adduser -D -u 1000 irvc
19+RUN apk add --no-cache ca-certificates sqlite && adduser -D -u 1000 irvc
2020 WORKDIR /app
2121 COPY --from=server /out/irvc /app/irvc
2222 COPY --from=web /src/dist /app/web/dist
deploy/dev/README.md+9−2
@@ -18,12 +18,19 @@ are `Secure`, and browsers only accept those on `https` or `localhost`.
1818 State lives in the `irvc-dev_irvc-data` volume (`/data`: `irvc.db`, `media`).
1919 Reset it with `podman-compose down -v`.
2020
21-## Invite
21+## Test users
2222
23-The DB starts empty. Create an invite, then open its `/join?token=...` URL:
23+A one-shot `seed` service waits for the DB, then inserts test accounts
24+(`deploy/dev/seed.sql`). Password for all: `11111111`.
25+
26+- `sean`, `bananaman`, `wombat`, `moonlord`, `toaster`, `kebab`
27+
28+Seed passwords are reset on every `up`. To add another invite instead:
2429
2530 podman exec irvc-dev_irvc_1 /app/irvc invite
2631
32+Then open its `/join?token=...` URL.
33+
2734 ## Frontend dev (HMR)
2835
2936 The container serves the built frontend. For hot reload, run Vite on the host
deploy/dev/compose.yaml+22−0
@@ -20,6 +20,28 @@ services:
2020 - livekit
2121 restart: unless-stopped
2222
23+ seed:
24+ image: localhost/irvc:dev
25+ network_mode: host
26+ volumes:
27+ - irvc-data:/data
28+ - ./seed.sql:/seed.sql:ro
29+ entrypoint:
30+ - /bin/sh
31+ - -c
32+ - |
33+ i=0
34+ until sqlite3 "$$IRVC_DB_PATH" 'SELECT 1 FROM users LIMIT 1' >/dev/null 2>&1; do
35+ i=$$((i + 1))
36+ [ "$$i" -ge 120 ] && { echo "seed: timed out waiting for db" >&2; exit 1; }
37+ sleep 0.5
38+ done
39+ sqlite3 "$$IRVC_DB_PATH" < /seed.sql
40+ echo "seed: test users ready"
41+ depends_on:
42+ - irvc
43+ restart: "no"
44+
2345 livekit:
2446 image: docker.io/livekit/livekit-server:latest
2547 network_mode: host
deploy/dev/seed.sql+10−0
@@ -0,0 +1,10 @@
1+-- Dev-only test users. Password for every account: 11111111
2+-- Hashes are argon2id, matching auth.go's hashPassword (t=1, m=64MiB, p=4, keylen=32).
3+INSERT INTO users (username, pass_hash, created_at) VALUES
4+ ('sean', 'gZforph+de817Cr6ohhoug$m2bqf60Ll68Vixhp44xXtM7m6/HqYCcrxvIuv7mAX7Q', strftime('%s', 'now')),
5+ ('bananaman', 'kQYrZURG60asQB45U8av2g$rac2chwUDfSlXhu2GQCYV9GauBaKKbtkgpwsHXXqNlg', strftime('%s', 'now')),
6+ ('wombat', 'iWzC1hCpH2VkorVItZ9oIg$iUv73VNZ8DO29QeKeioHFg3sDt+Fdg05YUa+475QM/0', strftime('%s', 'now')),
7+ ('moonlord', 'zVCrYmMgKvADAdOQi2Kzkg$b4RsSbtwR/b6hO8Tgq11H7e3+4SWvVNcqmiOZpy+E80', strftime('%s', 'now')),
8+ ('toaster', 'pd9PFENM1ZH/kNVWatUlGg$9tH8upyAAphKdfPjDf6MTpbEFvuDUVuniI9dP4koTZ4', strftime('%s', 'now')),
9+ ('kebab', 'PR1xIg+JM9Tb90jb+ob2Ow$thOTNwhjuDIHDPu4B093ghmk+LpSy13XWoczwUny6j8', strftime('%s', 'now'))
10+ON CONFLICT(username) DO UPDATE SET pass_hash = excluded.pass_hash;