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:
@@ -9,8 +9,27 @@ import { RelayPool } from 'applesauce-relay'
|
||||
// Relay pool for all WebSocket connections
|
||||
export const pool = new RelayPool()
|
||||
|
||||
// App relays (local dev relay)
|
||||
export const APP_RELAYS = ['ws://localhost:7777']
|
||||
/**
|
||||
* Determine app relay URLs at runtime.
|
||||
*
|
||||
* Priority:
|
||||
* 1. VITE_NOSTR_RELAYS env var (set in .env for local dev)
|
||||
* 2. Auto-detect: proxy through same host at /relay (Docker / production)
|
||||
*/
|
||||
function getAppRelays(): string[] {
|
||||
const envRelays = import.meta.env.VITE_NOSTR_RELAYS as string | undefined
|
||||
if (envRelays) {
|
||||
const parsed = envRelays.split(',').map((r: string) => r.trim()).filter(Boolean)
|
||||
if (parsed.length > 0) return parsed
|
||||
}
|
||||
|
||||
// Production / Docker: relay is proxied through nginx at /relay
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
|
||||
return [`${protocol}//${window.location.host}/relay`]
|
||||
}
|
||||
|
||||
// App relays (local dev relay or proxied production relay)
|
||||
export const APP_RELAYS = getAppRelays()
|
||||
|
||||
// Lookup relays for profile metadata
|
||||
export const LOOKUP_RELAYS = ['wss://purplepag.es']
|
||||
|
||||
Reference in New Issue
Block a user