Files
worldwideview/docker-compose.yml
Silvertakana 7c87c99c62 feat: auto port isolation for multi-worktree dev (#222)
* fix(e2e): guard marketplace webServer and exclude per-app tests from main Playwright config

Root cause: playwright.config.ts unconditionally started the marketplace dev server at
../worldwideview-marketplace. In CI only worldwideview is checked out, so spawn() received
a non-existent cwd which Node.js surfaces as "spawn /bin/sh ENOENT", crashing the entire
test run before any browser launched.

Two targeted fixes:
1. Wrap the marketplace webServer entry in fs.existsSync(MARKETPLACE_DIR) so CI skips it
   gracefully. Use playwright.marketplace.config.ts to run cross-app marketplace tests locally.
2. Add testIgnore for web-auth.spec.ts and marketplace-from-instance.spec.ts — both target
   sibling repos (worldwideview-web / worldwideview-marketplace) and have their own dedicated
   configs (playwright.web.config.ts / playwright.marketplace.config.ts). The main config
   should only exercise the worldwideview app itself.

* feat(09-02): add playwright.cross-app.config.ts and .env.test for cross-origin specs

- Add playwright.cross-app.config.ts with dual webServer array (wwv.local:3001 + marketplace.wwv.local:3002)
- testMatch targets both upcoming cross-app spec files; baseURL set to marketplace.wwv.local:3002
- Create worldwideview/.env.test with PLAYWRIGHT_TEST_EMAIL + PLAYWRIGHT_TEST_PASSWORD (gitignored)
- Add explicit .env.test entry to .gitignore (was not covered by existing .env/.env.local patterns)
- Bump version 2.20.2 -> 2.21.0 (feat: minor)

* feat(09-02): add cross-app Playwright specs for redirect handshake and sign-out (REQ-16)

- Add marketplace-redirect-handshake.spec.ts: 2 tests verifying next= param construction and login-then-redirect-back flow
- Add marketplace-sign-out.spec.ts: 1 test verifying avatar dropdown sign-out clears session and returns to marketplace home
- Update playwright.cross-app.config.ts to load .env.test credentials via fs (no dotenv package required)
- All specs target https://marketplace.wwv.local:3002 (never localhost:3002) for correct .wwv.local cookie domain
- 3 tests total listed by playwright --list

* feat: add planning-sync hook script for .planning branch isolation

* fix: guard planning-sync against missing .planning, wrong repo, and silent checkout failures

- Exit early if .planning/.git doesn't exist (avoids false-success on machines without the private repo)
- Exit early if CWD is not a worldwideview repo or worktree (prevents syncing from wwv-data-engine etc.)
- Wrap both checkout calls in exit-code checks so failures emit WARNING messages instead of false success

* feat: add post-checkout hook for .planning auto-sync

* fix: add existence guard to post-checkout hook before calling planning-sync

* docs: add .planning branch convention to worktree-bootstrap skill

* feat(11-01): add LegalFooter component and .legal-footer CSS class

- Create src/components/layout/LegalFooter.tsx as a Server Component
- Export named function LegalFooter with two external anchors
- Both anchors use target="_blank" rel="noopener noreferrer" (T-11-01)
- Links target locked URLs: privacy-policy and cloud-terms-of-service
- Append .legal-footer + a + a:hover rules to globals.css
- position:fixed bottom:0 z-index:10 per UI-SPEC
- Bump version 2.23.2 -> 2.23.3

* feat(11-01): remove Vercel Analytics, mount LegalFooter in root layout

- Remove @vercel/analytics/next import from layout.tsx (D-02)
- Remove {process.env.VERCEL && <Analytics />} JSX (D-02, T-11-02)
- Add import { LegalFooter } from @/components/layout/LegalFooter
- Render <LegalFooter /> as last child of <body> (D-04)
- Remove @vercel/analytics from dependencies in package.json
- Regenerate pnpm-lock.yaml after dependency removal
- AdSense block (lines 27-37) untouched per D-03
- Bump version 2.23.3 -> 2.23.4

* fix(worktree): fix link_planning hook path conversion for Windows

Worktrunk substitutes {{ worktree_path }} as a Unix-style path
(/c/dev/...) which cmd.exe cannot resolve. It also strips $ sigils
from variable names before executing hook commands, making inline
PowerShell variables unusable.

Extract junction logic to .agents/scripts/link-planning.ps1 and
unlink-planning.ps1. The hooks now call powershell -File with
the path as an argument, avoiding both issues entirely.

* docs: add ADR-004 and phase-2 implementation plans

Adds the Supabase session cookies httponly ADR alongside the six
implementation plan documents produced during the auth gate phase.

* feat(auth): implement Phase 2 cloud auth gate (ADR-003 closeout)

- Cloud edition login page redirects to NEXT_PUBLIC_AUTH_HOST_URL;
  local/demo editions keep the NextAuth credentials form
- Delete signup pages and Supabase PKCE callback route from worldwideview
  (auth host owns them per ADR-003)
- Add Supabase SSR helpers (cookieOptions, server, client) with
  httpOnly:true cookies per ADR-004
- Dual-dispatch install-redirect and grant-token: Supabase on cloud,
  NextAuth on local/demo; redirect param unified to ?next=
- Add streaming mode to safeFetch for MJPEG camera proxy streams
- Extract LoginForm into its own component
- Update Playwright config to conditionally start marketplace dev server

* fix(types): cast undici ReadableStream body to BodyInit to satisfy DOM types

node:stream/web ReadableStream is structurally incompatible with the DOM
ReadableStream expected by the Response constructor -- the pipeThrough
signature differs on the T | undefined generic bound. Cast to BodyInit
(which is the correct type for the streaming pass-through) to resolve
the TS2345 error in ssrf.ts line 112.

* fix(e2e): exclude cross-app marketplace specs from default Playwright run

marketplace-redirect-handshake.spec.ts and marketplace-sign-out.spec.ts
require a running marketplace.wwv.local:3002 instance (cross-app
environment). They were being picked up by playwright.config.ts in CI
where that host does not exist, causing ERR_NAME_NOT_RESOLVED failures.
Added both files to testIgnore alongside the existing exclusions; they
should be run via playwright.cross-app.config.ts only.

* fix: add pointer event support to bottom panel resize for webkit

Playwright's webkit engine dispatches pointermove/pointerup reliably
during synthetic drags but mousemove sometimes does not fire. Add
pointermove and pointerup listeners alongside the existing mouse
listeners, and add onPointerDown to the drag handle, so the resize
test passes across all three browser engines.

* fix(marketplace): derive redirect/entry allowlists from env vars

Hardcoded ALLOWED_REDIRECT_HOSTS and entry-URL allowlists rejected custom
deployment hostnames (e.g. marketplace.wwv.local) causing 400 errors on
grant-token, install-redirect, and validateManifest.

All three validators now read NEXT_PUBLIC_MARKETPLACE_URL,
NEXT_PUBLIC_WWV_MARKETPLACE_URL, and MARKETPLACE_URL at module load and add
each hostname to their respective allowlists. Unparsable env values are
skipped silently. No hostnames are hardcoded; validators are inert when the
env vars are absent (production config unchanged).

* fix: parameterize engine host port binding via WWV_ENGINE_HOST_PORT

* fix: read engine port from NEXT_PUBLIC_WWV_LOCAL_ENGINE_PORT in engineManifest

* fix: read engine port from NEXT_PUBLIC_WWV_LOCAL_ENGINE_PORT in resolveEngineUrl

* feat: add dev-all.mjs orchestrator with auto engine port detection

Replaces the concurrently one-liner dev:all script with a Node.js
orchestrator that finds a free port starting at 5000, then injects
WWV_ENGINE_HOST_PORT, NEXT_PUBLIC_WWV_LOCAL_ENGINE_PORT, and
COMPOSE_PROJECT_NAME before starting the app and backends concurrently.

* feat: wire dev:all to auto-port orchestrator

* fix: skip WS auth in local engine container and silence concurrently deprecation

* fix: set NODE_ENV=development in engine container to allow WWV_SKIP_WS_AUTH

* chore: regenerate pnpm-lock.yaml for wwv-lib workspace deps

Merge from main introduced @worldwideview/wwv-lib-aviation and
@worldwideview/wwv-lib-incidents in package.json but pnpm-lock.yaml
(inherited from main) had no entries for them. pnpm install
--no-frozen-lockfile regenerated the lockfile to include both
workspace packages, unblocking the frozen-lockfile CI enforcement.
2026-06-03 21:25:35 +12:00

100 lines
3.1 KiB
YAML

services:
wwv:
build:
context: .
args:
- NEXT_PUBLIC_WWV_EDITION=${NEXT_PUBLIC_WWV_EDITION:-local}
- NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL=${NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL:-}
- NEXT_PUBLIC_SUPABASE_URL=${NEXT_PUBLIC_SUPABASE_URL:-}
- NEXT_PUBLIC_SUPABASE_ANON_KEY=${NEXT_PUBLIC_SUPABASE_ANON_KEY:-}
- NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=${NEXT_PUBLIC_GOOGLE_MAPS_API_KEY:-}
- NEXT_PUBLIC_BING_MAPS_KEY=${NEXT_PUBLIC_BING_MAPS_KEY:-}
- NEXT_PUBLIC_CESIUM_ION_TOKEN=${NEXT_PUBLIC_CESIUM_ION_TOKEN:-}
- NEXT_PUBLIC_ADSENSE_CLIENT_ID=${NEXT_PUBLIC_ADSENSE_CLIENT_ID:-}
ports:
- "3000:3000"
volumes:
- wwv-data:/app/data
- ./public/plugins-local:/app/public/plugins-local:ro
env_file:
- path: .env
required: false
environment:
- "AUTH_SECRET=${AUTH_SECRET:-default_secret_for_local_dev}"
- "ENCRYPTION_MASTER_KEY=${ENCRYPTION_MASTER_KEY:-local_dev_encryption_key_change_in_prod}"
- "WWV_DEMO_ADMIN_SECRET=${WWV_DEMO_ADMIN_SECRET:-}"
- "WWV_BRIDGE_TOKEN=${WWV_BRIDGE_TOKEN:-}"
- "DATABASE_URL=postgresql://postgres:postgres@db:5432/worldwideview?schema=public"
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
restart: unless-stopped
db:
image: postgres:15-alpine
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: worldwideview
ports:
- "${WWV_DB_PORT:-5432}:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d worldwideview"]
interval: 5s
timeout: 5s
retries: 5
start_period: 60s
wwv-data-engine:
image: ghcr.io/silvertakana/wwv-data-engine:latest
command: >
sh -c "
echo 'Syncing workspace dependencies...' &&
if [ -d \"$$SEEDERS_DIR/community\" ]; then cd $$SEEDERS_DIR/community && CI=true pnpm install --ignore-scripts && pnpm -r rebuild better-sqlite3 esbuild; fi &&
if [ -d \"$$SEEDERS_DIR/private\" ]; then cd $$SEEDERS_DIR/private && CI=true pnpm install --ignore-scripts && pnpm -r rebuild better-sqlite3 esbuild; fi &&
cd /app && node dist/server.js"
ports:
- "${WWV_ENGINE_HOST_PORT:-5000}:5000"
volumes:
- ./local-seeders:/app/seeders
environment:
- PORT=5000
- REDIS_URL=redis://wwv-redis:6379
- SEEDERS_DIR=/app/seeders
- DB_PATH=/app/data/engine.db
- WWV_SKIP_WS_AUTH=true
- NODE_ENV=development
depends_on:
wwv-redis:
condition: service_healthy
restart: unless-stopped
profiles:
- engine
wwv-redis:
image: redis:7-alpine
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 3s
retries: 5
profiles:
- engine
networks:
coolify:
external: true
volumes:
wwv-data:
postgres-data: