From d6be9beebff4ffa37fd338dbac69f7da2cb4c1ca Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Mon, 2 Feb 2026 16:46:26 +0100 Subject: [PATCH] fix: directus --- .env | 6 +++++- docker-compose.override.yml | 21 +++++++++++++++------ lib/directus.ts | 6 +++--- package.json | 4 ++-- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.env b/.env index 419008f8..df37cc78 100644 --- a/.env +++ b/.env @@ -28,4 +28,8 @@ DIRECTUS_ADMIN_EMAIL=marc@mintel.me DIRECTUS_ADMIN_PASSWORD=Tim300493. DIRECTUS_DB_NAME=directus DIRECTUS_DB_USER=directus -DIRECTUS_DB_PASSWORD=directus +# Local Development +PROJECT_NAME=klz-cables +TRAEFIK_HOST=klz.localhost +DIRECTUS_HOST=cms.klz.localhost +GATEKEEPER_PASSWORD=klz2026 diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 0576b26a..640a7b16 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -9,18 +9,27 @@ services: NODE_ENV: development # Docker Internal Communication DIRECTUS_URL: http://directus:8055 + ports: + - "3000:3000" labels: - "traefik.enable=true" - - "traefik.http.routers.klz-app-local.rule=Host(`klz.localhost`)" - - "traefik.http.routers.klz-app-local.entrypoints=web" - - "traefik.http.routers.klz-app-local.service=klz-cables" + # Clear all production-related TLS/Middleware settings for the main routers + - "traefik.http.routers.klz-cables.entrypoints=web" + - "traefik.http.routers.klz-cables.rule=Host(`klz.localhost`)" + - "traefik.http.routers.klz-cables.tls=false" + - "traefik.http.routers.klz-cables.middlewares=" + + - "traefik.http.routers.klz-cables-web.entrypoints=web" + - "traefik.http.routers.klz-cables-web.rule=Host(`klz.localhost`)" + - "traefik.http.routers.klz-cables-web.middlewares=" directus: labels: - "traefik.enable=true" - - "traefik.http.routers.klz-directus-local.rule=Host(`cms.klz.localhost`)" - - "traefik.http.routers.klz-directus-local.entrypoints=web" - - "traefik.http.routers.klz-directus-local.service=klz-directus" + - "traefik.http.routers.klz-cables-directus.entrypoints=web" + - "traefik.http.routers.klz-cables-directus.rule=Host(`cms.klz.localhost`)" + - "traefik.http.routers.klz-cables-directus.tls=false" + - "traefik.http.routers.klz-cables-directus.middlewares=" ports: - "8055:8055" environment: diff --git a/lib/directus.ts b/lib/directus.ts index 17ab3ba7..5f8b4704 100644 --- a/lib/directus.ts +++ b/lib/directus.ts @@ -140,9 +140,9 @@ export async function checkHealth() { }; } - // 2. Schema check (does the products table exist?) + // 2. Schema check (does the contact_submissions table exist?) try { - await client.request(readItems('products', { limit: 1 })); + await client.request(readItems('contact_submissions', { limit: 1 })); } catch (e: any) { if (typeof window === 'undefined') { getServerAppServices().errors.captureException(e, { part: 'directus_health_schema' }); @@ -155,7 +155,7 @@ export async function checkHealth() { return { status: 'error', message: shouldShowDevErrors - ? `The "products" collection is missing or inaccessible. Error: ${e.message || 'Unknown'}` + ? `The "contact_submissions" collection is missing or inaccessible. Error: ${e.message || 'Unknown'}` : 'Required data structures are currently unavailable.', code: 'SCHEMA_MISSING', }; diff --git a/package.json b/package.json index 8044f541..2b6a302c 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "name": "klz-cables-nextjs", "private": true, "scripts": { - "dev": "docker network create infra 2>/dev/null || true && echo '\\nšŸš€ Development Environment Starting...\\n\\nšŸ“± App: http://klz.localhost\\nšŸ—„ļø CMS: http://cms.klz.localhost/admin\\n🚦 Traefik: http://localhost:8080\\n\\n(Press Ctrl+C to stop)\\n' && docker-compose down --remove-orphans && docker-compose up", + "dev": "docker network create infra 2>/dev/null || true && echo '\\nšŸš€ Development Environment Starting...\\n\\nšŸ“± App: http://klz.localhost\\nšŸ—„ļø CMS: http://cms.klz.localhost/admin\\n🚦 Traefik: http://localhost:8080\\n\\n(Press Ctrl+C to stop)\\n' && docker-compose down --remove-orphans && docker-compose up app directus directus-db", "dev:local": "next dev", "build": "next build", "start": "next start", @@ -73,7 +73,7 @@ "typecheck": "tsc --noEmit", "test": "vitest run --passWithNoTests", "test:og": "vitest run tests/og-image.test.ts", - "bootstrap:cms": "DIRECTUS_URL=http://localhost:8055 npx tsx --env-file=.env scripts/setup-directus-branding.ts", + "directus:bootstrap": "DIRECTUS_URL=http://localhost:8055 npx tsx --env-file=.env scripts/setup-directus-branding.ts", "pdf:datasheets": "tsx ./scripts/generate-pdf-datasheets.ts", "pdf:datasheets:legacy": "tsx ./scripts/generate-pdf-datasheets-pdf-lib.ts", "directus:push:staging": "./scripts/sync-directus.sh push staging",