Add Nostr relay + seed data to Docker deployment

- Add nostr-rs-relay service to docker-compose for persistent
  comments, reactions, and profiles on the dev server
- Add one-shot seeder container that auto-populates the relay
  with test personas, reactions, and comments on first deploy
- Proxy WebSocket connections through nginx at /relay so the
  frontend connects to the relay on the same host (no CORS)
- Make relay URL dynamic: reads from VITE_NOSTR_RELAYS in dev,
  auto-detects /relay proxy path in production Docker builds
- Make seed scripts configurable via RELAY_URL and ORIGIN env vars
- Add wait-for-relay script for reliable container orchestration
- Add "Resume last played" hero banner on My List tab

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Dorian
2026-02-12 12:33:22 +00:00
parent 725896673c
commit 0a7543cf32
9 changed files with 162 additions and 12 deletions

23
Dockerfile.seed Normal file
View File

@@ -0,0 +1,23 @@
# Seeder container — populates the Nostr relay with test profiles,
# reactions, and comments so the dev deployment has content.
#
# Runs once and exits. docker-compose "restart: no" keeps it from looping.
FROM node:20-alpine
WORKDIR /app
# Install dependencies
COPY package*.json ./
RUN npm ci --ignore-scripts
# Copy only what the seed scripts need
COPY scripts/ ./scripts/
COPY src/data/testPersonas.ts ./src/data/testPersonas.ts
COPY tsconfig.json ./
# Default env (overridden by docker-compose)
ENV RELAY_URL=ws://relay:8080
ENV ORIGIN=http://localhost:7777
CMD ["sh", "-c", "node scripts/wait-for-relay.mjs && npx tsx scripts/seed-profiles.ts && npx tsx scripts/seed-activity.ts && echo '✅ Seeding complete!'"]