Compare commits

...
Author SHA1 Message Date
Antigravity AI 596e994b85 feat(docker): add healthchecks to web app and db services 2026-05-10 14:50:53 +12:00
Antigravity AI df9ae78943 fix(plugins): resolve race condition loading plugins before host globals
Wait for injectHostGlobals to complete before initializing MarketplaceSync. This fixes the 'React is not defined / __WWV_HOST__ is undefined' error when mounting the AppShell.
2026-05-10 14:42:57 +12:00
7 changed files with 38 additions and 7 deletions

No files matched your search

+3
View File
@@ -87,4 +87,7 @@ RUN chmod +x ./docker-entrypoint.sh
EXPOSE 3000 3001
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=5 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1
ENTRYPOINT ["./docker-entrypoint.sh"]
+14 -1
View File
@@ -7,6 +7,12 @@ services:
POSTGRES_DB: postgres
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
wwv-cloud:
build:
@@ -30,8 +36,15 @@ services:
- "traefik.http.routers.wwv.entrypoints=web,websecure"
# - "traefik.http.routers.wwv.tls.certresolver=letsencrypt"
- "traefik.http.services.wwv.loadbalancer.server.port=3000"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
depends_on:
- db
db:
condition: service_healthy
traefik:
image: traefik:v3.0
+6
View File
@@ -13,6 +13,12 @@ services:
- "WWV_DEMO_ADMIN_SECRET=${WWV_DEMO_ADMIN_SECRET:-}"
- "WWV_BRIDGE_TOKEN=${WWV_BRIDGE_TOKEN:-}"
- "DATABASE_URL=${DATABASE_URL:-postgresql://postgres:postgres@db:5432/worldwideview?schema=public}"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
depends_on:
db:
condition: service_healthy
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "worldwideview",
"version": "2.1.11",
"version": "2.1.12",
"private": true,
"type": "module",
"packageManager": "[email protected]",
+5
View File
@@ -0,0 +1,5 @@
import { NextResponse } from "next/server";
export async function GET() {
return NextResponse.json({ status: "ok", timestamp: new Date().toISOString() });
}
+4 -2
View File
@@ -1,6 +1,6 @@
"use client";
import { useEffect, useRef } from "react";
import { useEffect, useRef, useState } from "react";
import { Header } from "./Header";
import { LayerPanel } from "@/components/panels/LayerPanel";
import { EntityInfoCard } from "@/components/panels/EntityInfoCard";
@@ -42,7 +42,8 @@ export function AppShell() {
const boot = useBootSequence();
const isMobile = useIsMobile();
const bootStartRef = useRef(Date.now());
const { needsReload, pendingUnverified, approveSelected, denyAll } = useMarketplaceSync();
const [hostReady, setHostReady] = useState(false);
const { needsReload, pendingUnverified, approveSelected, denyAll } = useMarketplaceSync(hostReady);
useEffect(() => {
const startPlatform = async () => {
@@ -51,6 +52,7 @@ export function AppShell() {
// Inject host libraries for dynamic plugin loading
await injectHostGlobals();
setHostReady(true);
// Fetch disabled built-in plugins before registration
let disabledIds = new Set<string>();
+5 -3
View File
@@ -16,7 +16,7 @@ import { isDemo } from "@/core/edition";
* - Detects built-in plugin changes that require a reload.
* - Gates unverified plugins behind user approval (batch dialog).
*/
export function useMarketplaceSync() {
export function useMarketplaceSync(hostReady: boolean) {
const initLayer = useStore((s) => s.initLayer);
const loadedIds = useRef<Set<string>>(new Set());
const initialDisabledIds = useRef<Set<string> | null>(null);
@@ -171,19 +171,21 @@ export function useMarketplaceSync() {
}, []);
const syncPlugins = useCallback(async () => {
if (!hostReady) return;
await captureInitialDisabled();
await syncMarketplacePlugins();
await checkBuiltinChanges();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [initLayer]);
}, [initLayer, hostReady]);
useEffect(() => {
if (!hostReady) return;
syncPlugins();
const handleFocus = () => { syncPlugins(); };
window.addEventListener("focus", handleFocus);
return () => window.removeEventListener("focus", handleFocus);
}, [syncPlugins]);
}, [syncPlugins, hostReady]);
return { syncPlugins, needsReload, pendingUnverified, approveSelected, denyAll };
}