feat(infra) : branche le SDK Sentry (back + front) vers GlitchTip + CA racine MALIO
Auto Tag Develop / tag (push) Successful in 14s

Error tracking centralise : remontee des erreurs back (Symfony) et front (Nuxt)
vers l'instance GlitchTip auto-hebergee. DSN vides par defaut => SDK inerte.

Backend :
- sentry/sentry-symfony ^5.10, bundle enregistre prod-only
- config/packages/sentry.yaml : handler Monolog niveau ERROR+, ignore 4xx/AccessDenied,
  pas d'APM, release = %app.version%
- .env : bloc SENTRY_DSN documente (vide => inerte)

Frontend :
- @sentry/nuxt ^10.61, module charge uniquement si NUXT_PUBLIC_SENTRY_DSN defini
- runtimeConfig.public.sentry + source maps (hidden) + options d'upload
- sentry.client.config.ts : init cote client gardee par if (dsn)

Deploiement :
- Dockerfile : ARG Sentry au build front (prefixe inline du RUN, token non persiste)
  + CA racine interne MALIO (update-ca-certificates) pour le handshake HTTPS GlitchTip back
- build-docker.yml : --build-arg depuis les secrets Gitea
- .env.prod.example : SENTRY_DSN (back, runtime)
This commit is contained in:
Matthieu
2026-06-29 17:43:35 +02:00
parent d1da48ea74
commit 6ee332757c
14 changed files with 1454 additions and 25 deletions
+23 -2
View File
@@ -30,21 +30,42 @@ COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ ./
# Error tracking → GlitchTip (build-time). Vides par defaut => module Sentry inerte
# et aucun upload de source maps. Fournis par la CI via --build-arg (secrets Gitea).
# Passes en prefixe inline du RUN (pas en ENV) pour ne pas persister le token dans
# une couche d'image.
ARG NUXT_PUBLIC_SENTRY_DSN=""
ARG SENTRY_URL=""
ARG SENTRY_ORG=""
ARG SENTRY_PROJECT=""
ARG SENTRY_AUTH_TOKEN=""
ENV CI=1 \
NUXT_TELEMETRY_DISABLED=1 \
NUXT_PUBLIC_API_BASE=/api \
NUXT_PUBLIC_APP_BASE=/
RUN npm run generate
RUN NUXT_PUBLIC_SENTRY_DSN="$NUXT_PUBLIC_SENTRY_DSN" \
SENTRY_URL="$SENTRY_URL" \
SENTRY_ORG="$SENTRY_ORG" \
SENTRY_PROJECT="$SENTRY_PROJECT" \
SENTRY_AUTH_TOKEN="$SENTRY_AUTH_TOKEN" \
npm run generate
# --- Stage 3: Production image ---
FROM php:8.4-fpm AS production
RUN apt-get update && apt-get install -y \
libicu-dev libpq-dev libpng-dev libzip-dev libxml2-dev \
nginx supervisor \
nginx supervisor ca-certificates \
&& docker-php-ext-install -j$(nproc) intl pdo_pgsql zip gd opcache \
&& rm -rf /var/lib/apt/lists/*
# CA racine interne MALIO (auto-signee) — permet au SDK Sentry/HttpClient de
# joindre les services HTTPS internes (ex. GlitchTip sur logs.malio-dev.fr).
COPY infra/prod/malio-dev-root-ca.crt /usr/local/share/ca-certificates/malio-dev-root-ca.crt
RUN update-ca-certificates
# PHP production config
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"