- Updated scripts/check-og-images.ts to log response body on failure. - Refined Traefik public router rule in docker-compose.yml for better path matching. - Fixed TRAEFIK_HOST_RULE assignment in deploy.yml (removed literal single quotes).
153 lines
7.1 KiB
YAML
153 lines
7.1 KiB
YAML
services:
|
|
klz-app:
|
|
image: registry.infra.mintel.me/mintel/klz-cables.com:${IMAGE_TAG:-latest}
|
|
restart: always
|
|
networks:
|
|
- default
|
|
- infra
|
|
env_file:
|
|
- ${ENV_FILE:-.env}
|
|
labels:
|
|
- "traefik.enable=true"
|
|
# HTTP ⇒ HTTPS redirect
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-web.rule=${TRAEFIK_HOST_RULE:-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"
|
|
# HTTPS router (Standard)
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}.rule=${TRAEFIK_HOST_RULE:-Host(`klz-cables.com`)}"
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}.entrypoints=websecure"
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}.tls.certresolver=le"
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}.tls=true"
|
|
- "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}"
|
|
|
|
# Public Router (Whitelist for OG Images, Sitemaps, Health)
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.rule=(${TRAEFIK_HOST_RULE:-Host(`klz-cables.com`)}) && (PathPrefix(`/health`, `/sitemap.xml`, `/robots.txt`, `/manifest.webmanifest`, `/api/og`) || PathRegexp(`^/.*opengraph-image$`))"
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.entrypoints=websecure"
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.tls.certresolver=le"
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-public.tls=true"
|
|
- "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=1000"
|
|
|
|
- "traefik.http.services.${PROJECT_NAME:-klz-cables}.loadbalancer.server.port=3000"
|
|
- "traefik.http.services.${PROJECT_NAME:-klz-cables}.loadbalancer.server.scheme=http"
|
|
- "traefik.docker.network=infra"
|
|
|
|
# Middleware Definitions
|
|
- "traefik.http.middlewares.${PROJECT_NAME:-klz-cables}-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"
|
|
|
|
# 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"
|
|
|
|
# Middleware Definitions
|
|
- "traefik.http.middlewares.${PROJECT_NAME:-klz-cables}-ratelimit.ratelimit.average=100"
|
|
- "traefik.http.middlewares.${PROJECT_NAME:-klz-cables}-ratelimit.ratelimit.burst=50"
|
|
healthcheck:
|
|
test: [ "CMD", "curl", "-f", "http://127.0.0.1:3000/" ]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
|
|
gatekeeper:
|
|
profiles: [ "gatekeeper" ]
|
|
image: registry.infra.mintel.me/mintel/gatekeeper:v1.7.12
|
|
restart: always
|
|
networks:
|
|
infra:
|
|
aliases:
|
|
- ${PROJECT_NAME:-klz-cables}-gatekeeper
|
|
env_file:
|
|
- ${ENV_FILE:-.env}
|
|
environment:
|
|
PORT: 3000
|
|
PROJECT_NAME: ${PROJECT_NAME:-KLZ Cables}
|
|
PROJECT_COLOR: "#82ed20"
|
|
COOKIE_DOMAIN: ${COOKIE_DOMAIN}
|
|
AUTH_COOKIE_NAME: ${AUTH_COOKIE_NAME:-klz_gatekeeper_session}
|
|
GATEKEEPER_PASSWORD: ${GATEKEEPER_PASSWORD}
|
|
NEXT_PUBLIC_BASE_URL: ${GATEKEEPER_ORIGIN}
|
|
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=websecure"
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-gatekeeper.tls.certresolver=le"
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-gatekeeper.tls=true"
|
|
- "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.docker.network=infra"
|
|
|
|
directus:
|
|
image: directus/directus:11
|
|
restart: always
|
|
networks:
|
|
default:
|
|
infra:
|
|
aliases:
|
|
- ${PROJECT_NAME:-klz-cables}-directus
|
|
env_file:
|
|
- ${ENV_FILE:-.env}
|
|
environment:
|
|
KEY: ${DIRECTUS_KEY}
|
|
SECRET: ${DIRECTUS_SECRET}
|
|
ADMIN_EMAIL: ${DIRECTUS_ADMIN_EMAIL}
|
|
ADMIN_PASSWORD: ${DIRECTUS_ADMIN_PASSWORD}
|
|
DB_CLIENT: 'pg'
|
|
DB_HOST: 'directus-db'
|
|
DB_PORT: '5432'
|
|
DB_DATABASE: ${DIRECTUS_DB_NAME:-directus}
|
|
DB_USER: ${DIRECTUS_DB_USER:-directus}
|
|
DB_PASSWORD: ${DIRECTUS_DB_PASSWORD:-directus}
|
|
WEBSOCKETS_ENABLED: 'true'
|
|
PUBLIC_URL: ${DIRECTUS_URL:-https://cms.klz-cables.com}
|
|
# Error Tracking
|
|
SENTRY_DSN: ${SENTRY_DSN}
|
|
SENTRY_ENVIRONMENT: ${TARGET:-development}
|
|
LOGGER_LEVEL: ${LOG_LEVEL:-info}
|
|
volumes:
|
|
- ./directus/uploads:/directus/uploads
|
|
- ./directus/extensions:/directus/extensions
|
|
- ./directus/schema:/directus/schema
|
|
- ./directus/migrations:/directus/migrations
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-directus.rule=Host(`${DIRECTUS_HOST}`)"
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-directus.entrypoints=websecure"
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-directus.tls.certresolver=le"
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-directus.tls=true"
|
|
- "traefik.http.routers.${PROJECT_NAME:-klz-cables}-directus.middlewares=${PROJECT_NAME:-klz-cables}-forward,compress"
|
|
- "traefik.http.services.${PROJECT_NAME:-klz-cables}-directus.loadbalancer.server.port=8055"
|
|
- "traefik.docker.network=infra"
|
|
|
|
directus-db:
|
|
image: postgres:15-alpine
|
|
restart: always
|
|
networks:
|
|
- default
|
|
env_file:
|
|
- ${ENV_FILE:-.env}
|
|
environment:
|
|
POSTGRES_DB: ${DIRECTUS_DB_NAME:-directus}
|
|
POSTGRES_USER: ${DIRECTUS_DB_USER:-directus}
|
|
POSTGRES_PASSWORD: ${DIRECTUS_DB_PASSWORD:-directus}
|
|
volumes:
|
|
- directus-db-data:/var/lib/postgresql/data
|
|
|
|
networks:
|
|
default:
|
|
name: ${PROJECT_NAME:-klz-cables}-internal
|
|
infra:
|
|
external: true
|
|
|
|
volumes:
|
|
directus-db-data:
|