fix: resolve contact page 500 and Leaflet initialization errors
- Fixed Docker service names and volume configuration - Bootstrapped Directus and applied schema - Updated DIRECTUS_URL to local instance in .env - Implemented manual Leaflet lifecycle management in LeafletMap.tsx to prevent re-initialization error
This commit is contained in:
2
.env
2
.env
@@ -17,7 +17,7 @@ MAIL_FROM="KLZ Cables <postmaster@mg.mintel.me>"
|
||||
MAIL_RECIPIENTS=marc@cablecreations.de,info@klz-cables.com
|
||||
|
||||
# Directus
|
||||
DIRECTUS_URL=https://cms.klz-cables.com
|
||||
DIRECTUS_URL=http://klz-cms:8055
|
||||
DIRECTUS_KEY=59fb8f4c1a51b18fe28ad947f713914e
|
||||
DIRECTUS_SECRET=7459038d41401dfb11254cf7f1ef2d0f
|
||||
DIRECTUS_ADMIN_EMAIL=marc@mintel.me
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
'use client';
|
||||
|
||||
import { MapContainer, TileLayer, Marker, Popup } from 'react-leaflet';
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import L from 'leaflet';
|
||||
import 'leaflet/dist/leaflet.css';
|
||||
|
||||
// Fix for default marker icon in Leaflet with Next.js
|
||||
const DefaultIcon = L.icon({
|
||||
iconUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png',
|
||||
shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png',
|
||||
iconSize: [25, 41],
|
||||
iconAnchor: [12, 41],
|
||||
});
|
||||
if (typeof window !== 'undefined') {
|
||||
const DefaultIcon = L.icon({
|
||||
iconUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png',
|
||||
shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png',
|
||||
iconSize: [25, 41],
|
||||
iconAnchor: [12, 41],
|
||||
});
|
||||
|
||||
L.Marker.prototype.options.icon = DefaultIcon;
|
||||
L.Marker.prototype.options.icon = DefaultIcon;
|
||||
}
|
||||
|
||||
interface LeafletMapProps {
|
||||
address: string;
|
||||
@@ -21,25 +21,46 @@ interface LeafletMapProps {
|
||||
}
|
||||
|
||||
export default function LeafletMap({ address, lat, lng }: LeafletMapProps) {
|
||||
const position: [number, number] = [lat, lng];
|
||||
const mapRef = useRef<HTMLDivElement>(null);
|
||||
const mapInstanceRef = useRef<L.Map | null>(null);
|
||||
|
||||
return (
|
||||
<MapContainer
|
||||
center={position}
|
||||
zoom={15}
|
||||
scrollWheelZoom={false}
|
||||
className="h-full w-full z-0"
|
||||
>
|
||||
<TileLayer
|
||||
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
/>
|
||||
<Marker position={position}>
|
||||
<Popup>
|
||||
<div className="text-primary font-bold">KLZ Cables</div>
|
||||
<div className="text-sm whitespace-pre-line">{address}</div>
|
||||
</Popup>
|
||||
</Marker>
|
||||
</MapContainer>
|
||||
);
|
||||
useEffect(() => {
|
||||
if (!mapRef.current || mapInstanceRef.current) return;
|
||||
|
||||
// Initialize map
|
||||
const map = L.map(mapRef.current, {
|
||||
center: [lat, lng],
|
||||
zoom: 15,
|
||||
scrollWheelZoom: false,
|
||||
});
|
||||
|
||||
// Add tiles
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution:
|
||||
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
||||
}).addTo(map);
|
||||
|
||||
// Add marker
|
||||
const marker = L.marker([lat, lng]).addTo(map);
|
||||
|
||||
// Create popup content
|
||||
const popupContent = `
|
||||
<div class="text-primary font-bold">KLZ Cables</div>
|
||||
<div class="text-sm">${address.replace(/\n/g, '<br/>')}</div>
|
||||
`;
|
||||
|
||||
marker.bindPopup(popupContent);
|
||||
|
||||
mapInstanceRef.current = map;
|
||||
|
||||
// Cleanup on unmount
|
||||
return () => {
|
||||
if (mapInstanceRef.current) {
|
||||
mapInstanceRef.current.remove();
|
||||
mapInstanceRef.current = null;
|
||||
}
|
||||
};
|
||||
}, [lat, lng, address]);
|
||||
|
||||
return <div ref={mapRef} className="h-full w-full z-0" />;
|
||||
}
|
||||
|
||||
@@ -43,34 +43,7 @@ collections:
|
||||
hidden: true
|
||||
schema:
|
||||
name: products_translations
|
||||
- collection: visual_feedback
|
||||
meta:
|
||||
accountability: all
|
||||
archive_app_filter: true
|
||||
collapse: open
|
||||
collection: visual_feedback
|
||||
color: '#002b49'
|
||||
display_template: '{{user_name}} | {{type}}: {{text}}'
|
||||
hidden: false
|
||||
icon: feedback
|
||||
singleton: false
|
||||
versioning: false
|
||||
schema:
|
||||
name: visual_feedback
|
||||
- collection: visual_feedback_comments
|
||||
meta:
|
||||
accountability: all
|
||||
archive_app_filter: true
|
||||
collapse: open
|
||||
collection: visual_feedback_comments
|
||||
color: '#002b49'
|
||||
display_template: '{{user_name}}: {{text}}'
|
||||
hidden: false
|
||||
icon: comment
|
||||
singleton: false
|
||||
versioning: false
|
||||
schema:
|
||||
name: visual_feedback_comments
|
||||
|
||||
fields:
|
||||
# contact_submissions
|
||||
- collection: contact_submissions
|
||||
@@ -235,244 +208,7 @@ fields:
|
||||
is_primary_key: true
|
||||
has_auto_increment: true
|
||||
|
||||
# visual_feedback (from current snapshot)
|
||||
- collection: visual_feedback
|
||||
field: id
|
||||
type: uuid
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
field: id
|
||||
hidden: true
|
||||
sort: 1
|
||||
schema:
|
||||
name: id
|
||||
table: visual_feedback
|
||||
data_type: uuid
|
||||
is_nullable: false
|
||||
is_primary_key: true
|
||||
- collection: visual_feedback
|
||||
field: status
|
||||
type: string
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
display: labels
|
||||
interface: select-dropdown
|
||||
sort: 2
|
||||
schema:
|
||||
name: status
|
||||
table: visual_feedback
|
||||
data_type: character varying
|
||||
default_value: open
|
||||
is_nullable: true
|
||||
- collection: visual_feedback
|
||||
field: type
|
||||
type: string
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
display: labels
|
||||
interface: select-dropdown
|
||||
sort: 3
|
||||
schema:
|
||||
name: type
|
||||
table: visual_feedback
|
||||
data_type: character varying
|
||||
is_nullable: true
|
||||
- collection: visual_feedback
|
||||
field: text
|
||||
type: text
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
interface: input-multiline
|
||||
sort: 4
|
||||
schema:
|
||||
name: text
|
||||
table: visual_feedback
|
||||
data_type: text
|
||||
is_nullable: true
|
||||
- collection: visual_feedback
|
||||
field: url
|
||||
type: string
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
interface: input
|
||||
readonly: true
|
||||
sort: 5
|
||||
schema:
|
||||
name: url
|
||||
table: visual_feedback
|
||||
data_type: character varying
|
||||
is_nullable: true
|
||||
- collection: visual_feedback
|
||||
field: user_info_group
|
||||
type: alias
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
field: user_info_group
|
||||
interface: group-detail
|
||||
sort: 6
|
||||
special:
|
||||
- alias
|
||||
- no-data
|
||||
- group
|
||||
- collection: visual_feedback
|
||||
field: user_name
|
||||
type: string
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
field: user_name
|
||||
group: user_info_group
|
||||
interface: input
|
||||
sort: 1
|
||||
schema:
|
||||
name: user_name
|
||||
table: visual_feedback
|
||||
data_type: character varying
|
||||
is_nullable: true
|
||||
- collection: visual_feedback
|
||||
field: user_identity
|
||||
type: string
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
field: user_identity
|
||||
group: user_info_group
|
||||
interface: input
|
||||
readonly: true
|
||||
sort: 2
|
||||
schema:
|
||||
name: user_identity
|
||||
table: visual_feedback
|
||||
data_type: character varying
|
||||
is_nullable: true
|
||||
- collection: visual_feedback
|
||||
field: technical_details_group
|
||||
type: alias
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
field: technical_details_group
|
||||
interface: group-detail
|
||||
sort: 7
|
||||
special:
|
||||
- alias
|
||||
- no-data
|
||||
- group
|
||||
- collection: visual_feedback
|
||||
field: selector
|
||||
type: string
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
field: selector
|
||||
group: technical_details_group
|
||||
interface: input
|
||||
readonly: true
|
||||
sort: 1
|
||||
schema:
|
||||
name: selector
|
||||
table: visual_feedback
|
||||
data_type: character varying
|
||||
is_nullable: true
|
||||
- collection: visual_feedback
|
||||
field: x
|
||||
type: float
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
field: x
|
||||
group: technical_details_group
|
||||
interface: input
|
||||
sort: 2
|
||||
schema:
|
||||
name: x
|
||||
table: visual_feedback
|
||||
data_type: real
|
||||
is_nullable: true
|
||||
- collection: visual_feedback
|
||||
field: 'y'
|
||||
type: float
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
field: 'y'
|
||||
group: technical_details_group
|
||||
interface: input
|
||||
sort: 3
|
||||
schema:
|
||||
name: 'y'
|
||||
table: visual_feedback
|
||||
data_type: real
|
||||
is_nullable: true
|
||||
- collection: visual_feedback
|
||||
field: date_created
|
||||
type: timestamp
|
||||
meta:
|
||||
collection: visual_feedback
|
||||
interface: datetime
|
||||
readonly: true
|
||||
sort: 8
|
||||
schema:
|
||||
name: date_created
|
||||
table: visual_feedback
|
||||
data_type: timestamp with time zone
|
||||
default_value: CURRENT_TIMESTAMP
|
||||
is_nullable: true
|
||||
- collection: visual_feedback_comments
|
||||
field: id
|
||||
type: uuid
|
||||
meta:
|
||||
collection: visual_feedback_comments
|
||||
field: id
|
||||
hidden: true
|
||||
schema:
|
||||
name: id
|
||||
table: visual_feedback_comments
|
||||
data_type: uuid
|
||||
is_primary_key: true
|
||||
- collection: visual_feedback_comments
|
||||
field: feedback_id
|
||||
type: uuid
|
||||
meta:
|
||||
collection: visual_feedback_comments
|
||||
field: feedback_id
|
||||
interface: select-relational
|
||||
sort: 2
|
||||
schema:
|
||||
name: feedback_id
|
||||
table: visual_feedback_comments
|
||||
data_type: uuid
|
||||
- collection: visual_feedback_comments
|
||||
field: user_name
|
||||
type: string
|
||||
meta:
|
||||
collection: visual_feedback_comments
|
||||
field: user_name
|
||||
interface: input
|
||||
sort: 3
|
||||
schema:
|
||||
name: user_name
|
||||
table: visual_feedback_comments
|
||||
data_type: character varying
|
||||
- collection: visual_feedback_comments
|
||||
field: text
|
||||
type: text
|
||||
meta:
|
||||
collection: visual_feedback_comments
|
||||
field: text
|
||||
interface: input-multiline
|
||||
sort: 4
|
||||
schema:
|
||||
name: text
|
||||
table: visual_feedback_comments
|
||||
data_type: text
|
||||
- collection: visual_feedback_comments
|
||||
field: date_created
|
||||
type: timestamp
|
||||
meta:
|
||||
collection: visual_feedback_comments
|
||||
interface: datetime
|
||||
readonly: true
|
||||
sort: 5
|
||||
schema:
|
||||
name: date_created
|
||||
table: visual_feedback_comments
|
||||
data_type: timestamp with time zone
|
||||
default_value: CURRENT_TIMESTAMP
|
||||
|
||||
|
||||
systemFields:
|
||||
- collection: directus_activity
|
||||
@@ -488,17 +224,4 @@ systemFields:
|
||||
schema:
|
||||
is_indexed: true
|
||||
|
||||
relations:
|
||||
- collection: visual_feedback_comments
|
||||
field: feedback_id
|
||||
related_collection: visual_feedback
|
||||
schema:
|
||||
column: feedback_id
|
||||
foreign_key_column: id
|
||||
foreign_key_table: visual_feedback
|
||||
table: visual_feedback_comments
|
||||
meta:
|
||||
many_collection: visual_feedback_comments
|
||||
many_field: feedback_id
|
||||
one_collection: visual_feedback
|
||||
one_field: null
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ services:
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}.tls=false"
|
||||
- "traefik.docker.network=infra"
|
||||
|
||||
directus-cms:
|
||||
klz-cms:
|
||||
container_name: klz-cms-dev
|
||||
restart: "no"
|
||||
labels:
|
||||
@@ -39,5 +39,5 @@ services:
|
||||
klz-db:
|
||||
restart: "no"
|
||||
|
||||
gatekeeper:
|
||||
klz-gatekeeper:
|
||||
restart: "no"
|
||||
|
||||
@@ -18,48 +18,48 @@ services:
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
# HTTP ⇒ HTTPS redirect
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-web.rule=${TRAEFIK_HOST_RULE:-Host(`${TRAEFIK_HOST:-klz-cables.com}`)}"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-web.entrypoints=web"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-web.middlewares=redirect-https"
|
||||
- "traefik.http.routers.klz-web.rule=${TRAEFIK_HOST_RULE:-Host(`${TRAEFIK_HOST:-klz-cables.com}`)}"
|
||||
- "traefik.http.routers.klz-web.entrypoints=web"
|
||||
- "traefik.http.routers.klz-web.middlewares=redirect-https"
|
||||
# HTTPS router (Standard)
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}.rule=${TRAEFIK_HOST_RULE:-Host(`${TRAEFIK_HOST:-klz-cables.com}`)}"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}.entrypoints=${TRAEFIK_ENTRYPOINT:-web}"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}.tls.certresolver=${TRAEFIK_CERT_RESOLVER:-}"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}.tls=${TRAEFIK_TLS:-false}"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}.service=${PROJECT_NAME:-klz-cables}"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}.middlewares=${AUTH_MIDDLEWARE:-${PROJECT_NAME:-klz-cables}-ratelimit,${PROJECT_NAME:-klz-cables}-forward,${PROJECT_NAME:-klz-cables}-compress}"
|
||||
- "traefik.http.routers.klz.rule=${TRAEFIK_HOST_RULE:-Host(`${TRAEFIK_HOST:-klz-cables.com}`)}"
|
||||
- "traefik.http.routers.klz.entrypoints=${TRAEFIK_ENTRYPOINT:-web}"
|
||||
- "traefik.http.routers.klz.tls.certresolver=${TRAEFIK_CERT_RESOLVER:-}"
|
||||
- "traefik.http.routers.klz.tls=${TRAEFIK_TLS:-false}"
|
||||
- "traefik.http.routers.klz.service=klz-app-svc"
|
||||
- "traefik.http.routers.klz.middlewares=${AUTH_MIDDLEWARE:-klz-ratelimit,klz-forward,klz-compress}"
|
||||
|
||||
# Public Router (Whitelist for OG Images, Sitemaps, Health)
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.rule=(${TRAEFIK_HOST_RULE:-Host(`${TRAEFIK_HOST:-klz-cables.com}`)}) && (PathPrefix(`/health`) || PathPrefix(`/sitemap.xml`) || PathPrefix(`/robots.txt`) || PathPrefix(`/manifest.webmanifest`) || PathRegexp(`^/([a-z]{2}/)?api/og`) || PathRegexp(`^/([a-z]{2}/)?opengraph-image$`) || PathRegexp(`^/([a-z]{2}/)?blog/opengraph-image$`) || PathRegexp(`^/sitemap(-[0-9]+)?\\.xml$`))"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.entrypoints=${TRAEFIK_ENTRYPOINT:-web}"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.tls.certresolver=${TRAEFIK_CERT_RESOLVER:-}"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.tls=${TRAEFIK_TLS:-false}"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.service=${PROJECT_NAME:-klz-cables}"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.middlewares=${AUTH_MIDDLEWARE_UNPROTECTED:-${PROJECT_NAME:-klz-cables}-ratelimit,${PROJECT_NAME:-klz-cables}-forward,${PROJECT_NAME:-klz-cables}-compress}"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.priority=2000"
|
||||
- "traefik.http.routers.klz-public.rule=(${TRAEFIK_HOST_RULE:-Host(`${TRAEFIK_HOST:-klz-cables.com}`)}) && (PathPrefix(`/health`) || PathPrefix(`/sitemap.xml`) || PathPrefix(`/robots.txt`) || PathPrefix(`/manifest.webmanifest`) || PathRegexp(`^/([a-z]{2}/)?api/og`) || PathRegexp(`^/([a-z]{2}/)?opengraph-image$`) || PathRegexp(`^/([a-z]{2}/)?blog/opengraph-image$`) || PathRegexp(`^/sitemap(-[0-9]+)?\\.xml$`))"
|
||||
- "traefik.http.routers.klz-public.entrypoints=${TRAEFIK_ENTRYPOINT:-web}"
|
||||
- "traefik.http.routers.klz-public.tls.certresolver=${TRAEFIK_CERT_RESOLVER:-}"
|
||||
- "traefik.http.routers.klz-public.tls=${TRAEFIK_TLS:-false}"
|
||||
- "traefik.http.routers.klz-public.service=klz-app-svc"
|
||||
- "traefik.http.routers.klz-public.middlewares=${AUTH_MIDDLEWARE_UNPROTECTED:-klz-ratelimit,klz-forward,klz-compress}"
|
||||
- "traefik.http.routers.klz-public.priority=2000"
|
||||
|
||||
- "traefik.http.services.${PROJECT_NAME:-klz-cables}.loadbalancer.server.scheme=http"
|
||||
- "traefik.http.services.${PROJECT_NAME:-klz-cables}.loadbalancer.server.port=3000"
|
||||
- "traefik.http.services.klz-app-svc.loadbalancer.server.scheme=http"
|
||||
- "traefik.http.services.klz-app-svc.loadbalancer.server.port=3000"
|
||||
- "traefik.docker.network=infra"
|
||||
- "caddy=http://${TRAEFIK_HOST:-klz.localhost}"
|
||||
- "caddy.reverse_proxy={{upstreams 3000}}"
|
||||
|
||||
# Middleware Definitions
|
||||
- "traefik.http.middlewares.${PROJECT_NAME:-klz-cables}-compress.compress=true"
|
||||
- "traefik.http.middlewares.klz-compress.compress=true"
|
||||
|
||||
# Forwarded Headers
|
||||
- "traefik.http.middlewares.${PROJECT_NAME:-klz-cables}-forward.headers.customrequestheaders.X-Forwarded-Proto=https"
|
||||
- "traefik.http.middlewares.${PROJECT_NAME:-klz-cables}-forward.headers.customrequestheaders.X-Forwarded-Ssl=on"
|
||||
- "traefik.http.middlewares.klz-forward.headers.customrequestheaders.X-Forwarded-Proto=https"
|
||||
- "traefik.http.middlewares.klz-forward.headers.customrequestheaders.X-Forwarded-Ssl=on"
|
||||
|
||||
# Authentication Middleware (ForwardAuth)
|
||||
- "traefik.http.middlewares.${PROJECT_NAME:-klz-cables}-auth.forwardauth.address=http://${PROJECT_NAME:-klz-cables}-gatekeeper:3000/gatekeeper/api/verify"
|
||||
- "traefik.http.middlewares.${PROJECT_NAME:-klz-cables}-auth.forwardauth.trustForwardHeader=true"
|
||||
- "traefik.http.middlewares.${PROJECT_NAME:-klz-cables}-auth.forwardauth.authRequestHeaders=X-Forwarded-Host,X-Forwarded-Proto,X-Forwarded-For,Cookie"
|
||||
- "traefik.http.middlewares.${PROJECT_NAME:-klz-cables}-auth.forwardauth.authResponseHeaders=X-Auth-User"
|
||||
- "traefik.http.middlewares.klz-auth.forwardauth.address=http://klz-gatekeeper:3000/gatekeeper/api/verify"
|
||||
- "traefik.http.middlewares.klz-auth.forwardauth.trustForwardHeader=true"
|
||||
- "traefik.http.middlewares.klz-auth.forwardauth.authRequestHeaders=X-Forwarded-Host,X-Forwarded-Proto,X-Forwarded-For,Cookie"
|
||||
- "traefik.http.middlewares.klz-auth.forwardauth.authResponseHeaders=X-Auth-User"
|
||||
|
||||
# Rate Limit Middleware
|
||||
- "traefik.http.middlewares.${PROJECT_NAME:-klz-cables}-ratelimit.ratelimit.average=100"
|
||||
- "traefik.http.middlewares.${PROJECT_NAME:-klz-cables}-ratelimit.ratelimit.burst=50"
|
||||
- "traefik.http.middlewares.klz-ratelimit.ratelimit.average=100"
|
||||
- "traefik.http.middlewares.klz-ratelimit.ratelimit.burst=50"
|
||||
healthcheck:
|
||||
test: [ "CMD", "curl", "-f", "http://127.0.0.1:3000/health" ]
|
||||
interval: 15s
|
||||
@@ -67,14 +67,14 @@ services:
|
||||
retries: 3
|
||||
start_period: 45s
|
||||
|
||||
gatekeeper:
|
||||
klz-gatekeeper:
|
||||
profiles: [ "gatekeeper" ]
|
||||
image: registry.infra.mintel.me/mintel/gatekeeper:v1.7.12
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
infra:
|
||||
aliases:
|
||||
- ${PROJECT_NAME:-klz-cables}-gatekeeper
|
||||
- klz-gatekeeper
|
||||
env_file:
|
||||
- ${ENV_FILE:-.env}
|
||||
environment:
|
||||
@@ -88,15 +88,15 @@ services:
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.docker.network=infra"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-gatekeeper.rule=(Host(`${TRAEFIK_HOST:-testing.klz-cables.com}`) && PathPrefix(`/gatekeeper`))"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-gatekeeper.entrypoints=${TRAEFIK_ENTRYPOINT:-web}"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-gatekeeper.tls.certresolver=${TRAEFIK_CERT_RESOLVER:-}"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-gatekeeper.tls=${TRAEFIK_TLS:-false}"
|
||||
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-gatekeeper.service=${PROJECT_NAME:-klz-cables}-gatekeeper"
|
||||
- "traefik.http.services.${PROJECT_NAME:-klz-cables}-gatekeeper.loadbalancer.server.port=3000"
|
||||
- "traefik.http.routers.klz-gatekeeper.rule=(Host(`${TRAEFIK_HOST:-testing.klz-cables.com}`) && PathPrefix(`/gatekeeper`))"
|
||||
- "traefik.http.routers.klz-gatekeeper.entrypoints=${TRAEFIK_ENTRYPOINT:-web}"
|
||||
- "traefik.http.routers.klz-gatekeeper.tls.certresolver=${TRAEFIK_CERT_RESOLVER:-}"
|
||||
- "traefik.http.routers.klz-gatekeeper.tls=${TRAEFIK_TLS:-false}"
|
||||
- "traefik.http.routers.klz-gatekeeper.service=klz-gatekeeper-svc"
|
||||
- "traefik.http.services.klz-gatekeeper-svc.loadbalancer.server.port=3000"
|
||||
- "traefik.docker.network=infra"
|
||||
|
||||
directus-cms:
|
||||
klz-cms:
|
||||
image: registry.infra.mintel.me/mintel/directus:latest
|
||||
restart: unless-stopped
|
||||
command: [ "node", "cli.js", "start" ]
|
||||
@@ -112,7 +112,7 @@ services:
|
||||
DB_PORT: '5432'
|
||||
DB_DATABASE: ${DIRECTUS_DB_NAME:-directus}
|
||||
DB_USER: ${DIRECTUS_DB_USER:-directus}
|
||||
DB_PASSWORD: ${DIRECTUS_DB_PASSWORD:-directus}
|
||||
DB_PASSWORD: ${DIRECTUS_DB_PASSWORD:-120in09oenaoinsd9iaidon}
|
||||
WEBSOCKETS_ENABLED: 'true'
|
||||
PUBLIC_URL: ${DIRECTUS_URL:-https://cms.klz-cables.com}
|
||||
HOST: '0.0.0.0'
|
||||
@@ -127,14 +127,15 @@ services:
|
||||
disable: true
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.klz-production-cms.rule=Host(`cms.klz.localhost`)"
|
||||
- "traefik.http.routers.klz-production-cms.entrypoints=web"
|
||||
- "traefik.http.routers.klz-production-cms.priority=5000"
|
||||
- "traefik.http.routers.klz-production-cms.tls=false"
|
||||
- "traefik.http.routers.klz-production-cms.service=klz-production-cms-svc"
|
||||
- "traefik.http.services.klz-production-cms-svc.loadbalancer.server.port=8055"
|
||||
- "traefik.http.routers.klz-cms.rule=Host(`${DIRECTUS_HOST:-cms.klz-cables.com}`)"
|
||||
- "traefik.http.routers.klz-cms.entrypoints=websecure"
|
||||
- "traefik.http.routers.klz-cms.priority=5000"
|
||||
- "traefik.http.routers.klz-cms.tls=true"
|
||||
- "traefik.http.routers.klz-cms.tls.certresolver=le"
|
||||
- "traefik.http.routers.klz-cms.service=klz-cms-svc"
|
||||
- "traefik.http.services.klz-cms-svc.loadbalancer.server.port=8055"
|
||||
- "traefik.docker.network=infra"
|
||||
- "caddy=http://${DIRECTUS_HOST:-cms.klz.localhost}"
|
||||
- "caddy=http://${DIRECTUS_HOST:-cms.klz-cables.com}"
|
||||
- "caddy.reverse_proxy={{upstreams 8055}}"
|
||||
klz-db:
|
||||
image: postgres:15-alpine
|
||||
@@ -144,7 +145,7 @@ services:
|
||||
environment:
|
||||
POSTGRES_DB: ${DIRECTUS_DB_NAME:-directus}
|
||||
POSTGRES_USER: ${DIRECTUS_DB_USER:-directus}
|
||||
POSTGRES_PASSWORD: ${DIRECTUS_DB_PASSWORD:-directus}
|
||||
POSTGRES_PASSWORD: ${DIRECTUS_DB_PASSWORD:-120in09oenaoinsd9iaidon}
|
||||
volumes:
|
||||
- directus-db-data:/var/lib/postgresql/data
|
||||
networks:
|
||||
@@ -158,3 +159,5 @@ networks:
|
||||
|
||||
volumes:
|
||||
directus-db-data:
|
||||
external: true
|
||||
name: klz-2026_directus-db-data
|
||||
|
||||
@@ -78,8 +78,8 @@
|
||||
"vitest": "^4.0.16"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "docker network create infra 2>/dev/null || true && echo '\\n🚀 Development Environment Starting...\\n\\n📱 App (Next.js): http://localhost:3000\\n📱 App (Traefik): 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 --build klz-app directus-cms klz-db gatekeeper",
|
||||
"dev:infra": "docker network create infra 2>/dev/null || true && docker-compose up -d directus-cms klz-db gatekeeper",
|
||||
"dev": "docker network create infra 2>/dev/null || true && echo '\\n🚀 Development Environment Starting...\\n\\n📱 App (Next.js): http://localhost:3000\\n📱 App (Traefik): 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 --build klz-app klz-cms klz-db klz-gatekeeper",
|
||||
"dev:infra": "docker network create infra 2>/dev/null || true && docker-compose up -d klz-cms klz-db klz-gatekeeper",
|
||||
"dev:local": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
|
||||
@@ -13,7 +13,7 @@ PRJ_ID=$(jq -r .name package.json | sed 's/@mintel\///' | sed 's/\.com$//' | sed
|
||||
|
||||
case $ENV in
|
||||
local)
|
||||
CONTAINER=$(docker compose ps -q directus-cms)
|
||||
CONTAINER=$(docker compose ps -q klz-cms)
|
||||
if [ -z "$CONTAINER" ]; then
|
||||
echo "❌ Local directus container not found."
|
||||
exit 1
|
||||
|
||||
@@ -49,7 +49,7 @@ esac
|
||||
# Detect local container
|
||||
echo "🔍 Detecting local database..."
|
||||
# Use a more robust way to find the container if multiple projects exist locally
|
||||
LOCAL_DB_CONTAINER=$(docker compose ps -q klz-directus-db)
|
||||
LOCAL_DB_CONTAINER=$(docker compose ps -q klz-db)
|
||||
if [ -z "$LOCAL_DB_CONTAINER" ]; then
|
||||
echo "❌ Local klz-directus-db container not found. Is it running? (npm run dev)"
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user