From 9623ca4b0d9539115eab4bc0c6264a4378ebb316 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Thu, 9 Apr 2026 12:30:38 +0200 Subject: [PATCH] chore: deploy v2.3.6 (sync deps to 1.9.17, root v2.3.6, middleware fix) --- .env.bak | 111 +++++++++++++++++++++++++++++ app/api/pages/[slug]/pdf/route.tsx | 64 ----------------- docker-compose.dev.yml | 1 + package.json | 18 ++--- 4 files changed, 121 insertions(+), 73 deletions(-) create mode 100644 .env.bak delete mode 100644 app/api/pages/[slug]/pdf/route.tsx diff --git a/.env.bak b/.env.bak new file mode 100644 index 00000000..ab85e436 --- /dev/null +++ b/.env.bak @@ -0,0 +1,111 @@ +# ============================================================================ +# KLZ Cables - Environment Configuration +# ============================================================================ +# Copy this file to .env for local development +# For production, use .env.production as a template +# ============================================================================ + +# ──────────────────────────────────────────────────────────────────────────── +# Application Configuration +# ──────────────────────────────────────────────────────────────────────────── +NODE_ENV=development +NEXT_PUBLIC_BASE_URL=http://localhost:3000 +# TARGET is used to differentiate between environments (testing, staging, production) +# NEXT_PUBLIC_TARGET makes this information available to the frontend +TARGET=development +NEXT_PUBLIC_FEEDBACK_ENABLED=false +NEXT_PUBLIC_RECORD_MODE_ENABLED=true + +# ──────────────────────────────────────────────────────────────────────────── +# Analytics (Umami) +# ──────────────────────────────────────────────────────────────────────────── +# Optional: Leave empty to disable analytics +UMAMI_WEBSITE_ID= +UMAMI_API_ENDPOINT=https://analytics.infra.mintel.me + +# ──────────────────────────────────────────────────────────────────────────── +# Error Tracking (GlitchTip/Sentry) +# ──────────────────────────────────────────────────────────────────────────── +# Optional: Leave empty to disable error tracking +SENTRY_DSN= + +# ──────────────────────────────────────────────────────────────────────────── +# Email Configuration (SMTP) +# ──────────────────────────────────────────────────────────────────────────── +# Required for contact form functionality +MAIL_HOST=smtp.eu.mailgun.org +MAIL_PORT=587 +MAIL_USERNAME= +MAIL_PASSWORD= +MAIL_FROM=KLZ Cables +MAIL_RECIPIENTS=info@klz-cables.com + +# ──────────────────────────────────────────────────────────────────────────── +# Logging +# ──────────────────────────────────────────────────────────────────────────── +LOG_LEVEL=info +GATEKEEPER_PASSWORD=klz2026 +SENTRY_DSN= +# SENTRY_ENVIRONMENT is set automatically by CI + +# ──────────────────────────────────────────────────────────────────────────── +# AI Agent (Payload CMS Agent via OpenRouter) +# ──────────────────────────────────────────────────────────────────────────── +# Required for the Payload CMS AI Chat Agent +MISTRAL_API_KEY= + +# ──────────────────────────────────────────────────────────────────────────── +# Payload Infrastructure (Dockerized) +# ──────────────────────────────────────────────────────────────────────────── +# The POSTGRES_URI and PAYLOAD_SECRET are automatically constructed and injected +# by docker-compose.yml using these base DB credentials, so you don't need to +# manually write the connection strings here. +PAYLOAD_DB_NAME=payload +PAYLOAD_DB_USER=payload +PAYLOAD_DB_PASSWORD=120in09oenaoinsd9iaidon + +# ──────────────────────────────────────────────────────────────────────────── +# Deployment Configuration (CI/CD only) +# ──────────────────────────────────────────────────────────────────────────── +# These are typically set by the CI/CD workflow +IMAGE_TAG=latest +TRAEFIK_HOST=klz-cables.com +ENV_FILE=.env +# IMGPROXY_URL: The backend URL of the imgproxy instance (e.g. img.infra.mintel.me) +# Next.js will proxy requests from /_img to this URL. +IMGPROXY_URL=https://img.infra.mintel.me + +# ──────────────────────────────────────────────────────────────────────────── +# Varnish Configuration +# ──────────────────────────────────────────────────────────────────────────── +VARNISH_CACHE_SIZE=256M + +# ============================================================================ +# IMPORTANT NOTES +# ============================================================================ +# +# BUILD-TIME vs RUNTIME Variables: +# ───────────────────────────────── +# • NEXT_PUBLIC_* variables are baked into the client bundle at BUILD time +# They must be provided as --build-arg when building the Docker image +# +# • All other variables are used at RUNTIME only +# They are loaded from the .env file by docker-compose +# +# Docker Deployment: +# ────────────────── +# 1. Build-time: Only NEXT_PUBLIC_* vars are needed (via --build-arg) +# 2. Runtime: All vars are loaded from .env file on the server +# 3. Branch Deployments: +# - main branch uses .env.prod +# - staging branch uses .env.staging +# - CI/CD supports STAGING_ prefix for all secrets to override defaults +# - TRAEFIK_HOST is automatically derived from NEXT_PUBLIC_BASE_URL +# +# Security: +# ───────── +# • NEVER commit .env files with real credentials to git +# • Use Gitea/GitHub secrets for CI/CD workflows +# • Store production .env file securely on the server only +# +# ============================================================================ diff --git a/app/api/pages/[slug]/pdf/route.tsx b/app/api/pages/[slug]/pdf/route.tsx deleted file mode 100644 index e6380351..00000000 --- a/app/api/pages/[slug]/pdf/route.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { NextRequest, NextResponse } from 'next/server'; -import { getPayload } from 'payload'; -import configPromise from '@payload-config'; -import { renderToStream } from '@react-pdf/renderer'; -import React from 'react'; -import { PDFPage } from '@/lib/pdf-page'; - -export async function GET(req: NextRequest, { params }: { params: Promise<{ slug: string }> }) { - try { - const { slug } = await params; - - // Get Payload App - const payload = await getPayload({ config: configPromise }); - - // Fetch the page - const pages = await payload.find({ - collection: 'pages', - where: { - slug: { equals: slug }, - _status: { equals: 'published' }, - }, - limit: 1, - }); - - if (pages.totalDocs === 0) { - return new NextResponse('Page not found', { status: 404 }); - } - - const page = pages.docs[0]; - - // Determine locale from searchParams or default to 'de' - const searchParams = req.nextUrl.searchParams; - const locale = (searchParams.get('locale') as 'en' | 'de') || 'de'; - - // Render the React-PDF document into a stream - const stream = await renderToStream(); - - // Pipe the Node.js Readable stream into a valid fetch/Web Response stream - const body = new ReadableStream({ - start(controller) { - stream.on('data', (chunk) => controller.enqueue(chunk)); - stream.on('end', () => controller.close()); - stream.on('error', (err) => controller.error(err)); - }, - cancel() { - (stream as any).destroy?.(); - }, - }); - - const filename = `${slug}.pdf`; - - return new NextResponse(body, { - status: 200, - headers: { - 'Content-Type': 'application/pdf', - 'Content-Disposition': `attachment; filename="${filename}"`, - // Cache control if needed, skip for now. - }, - }); - } catch (error) { - console.error('Error generating PDF:', error); - return new NextResponse('Internal Server Error', { status: 500 }); - } -} diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 2134214e..675a87c6 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -112,6 +112,7 @@ services: - klz_qdrant_data:/qdrant/storage networks: - default + ports: - "16333:6333" klz-kabelfachmann: diff --git a/package.json b/package.json index beacd3c4..fafeea58 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,11 @@ "dependencies": { "@ai-sdk/google": "^3.0.31", "@ai-sdk/openai": "^3.0.36", - "@mintel/mail": "^1.9.0", - "@mintel/next-config": "^1.9.0", - "@mintel/next-feedback": "^1.9.0", - "@mintel/next-utils": "^1.9.0", - "@mintel/payload-ai": "^1.9.15", + "@mintel/mail": "^1.9.17", + "@mintel/next-config": "^1.9.17", + "@mintel/next-feedback": "^1.9.17", + "@mintel/next-utils": "^1.9.17", + "@mintel/payload-ai": "^1.9.17", "@payloadcms/db-postgres": "^3.77.0", "@payloadcms/email-nodemailer": "^3.77.0", "@payloadcms/next": "^3.77.0", @@ -65,8 +65,8 @@ "@commitlint/config-conventional": "^20.4.0", "@cspell/dict-de-de": "^4.1.2", "@lhci/cli": "^0.15.1", - "@mintel/eslint-config": "^1.9.0", - "@mintel/tsconfig": "^1.9.0", + "@mintel/eslint-config": "^1.9.17", + "@mintel/tsconfig": "^1.9.17", "@next/bundle-analyzer": "^16.1.6", "@tailwindcss/cli": "^4.1.18", "@tailwindcss/postcss": "^4.1.18", @@ -160,7 +160,7 @@ "prepare": "husky", "preinstall": "npx only-allow pnpm" }, - "version": "2.2.12", + "version": "2.3.6", "pnpm": { "onlyBuiltDependencies": [ "@parcel/watcher", @@ -174,7 +174,7 @@ "minimatch": ">=10.2.2" }, "patchedDependencies": { - "@mintel/payload-ai@1.9.15": "patches/@mintel__payload-ai@1.9.15.patch" + "@mintel/payload-ai@1.9.17": "patches/@mintel__payload-ai@1.9.15.patch" } }, "browserslist": [