chore(deploy): heap de Node en build + runtime sin red + nginx buffers/http2
Cambios de infra ya aplicados en testing: NODE_OPTIONS max-old-space-size para evitar OOM en vite build; runtime del frontend sin apk/npm (busybox/node directo); nginx con proxy_buffers grandes (evita 502 por header del JWT) y http2. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,9 +29,8 @@ server {
|
||||
|
||||
# ---- HTTPS ----
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
http2 on;
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
server_name testing.crm.aduanasoft.com;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/testing.crm.aduanasoft.com/fullchain.pem;
|
||||
@@ -50,6 +49,13 @@ server {
|
||||
# Subida de documentos (máx. 25 MB en la app) + margen
|
||||
client_max_body_size 30m;
|
||||
|
||||
# Buffers grandes para headers de respuesta: /auth/sso setea el JWT (fragmentado
|
||||
# si supera ~4KB) + refresh/id_token/tenant como cookies → el header excede el
|
||||
# buffer default de nginx (evita "upstream sent too big header" → 502).
|
||||
proxy_buffer_size 32k;
|
||||
proxy_buffers 16 32k;
|
||||
proxy_busy_buffers_size 64k;
|
||||
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
||||
gzip_min_length 1024;
|
||||
|
||||
@@ -38,6 +38,9 @@ ENV INTERNAL_API_URL=${INTERNAL_API_URL}
|
||||
# Copiar el resto del código
|
||||
COPY . .
|
||||
|
||||
# Subir el límite de heap de Node para el build (VM chico → evita OOM en vite build)
|
||||
ENV NODE_OPTIONS="--max-old-space-size=3072"
|
||||
|
||||
# Construir el proyecto
|
||||
RUN pnpm run build
|
||||
|
||||
@@ -49,11 +52,8 @@ FROM node:22-alpine AS runtime
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# wget de busybox ya viene en alpine; el apk es best-effort (redes restringidas sin CDN de Alpine)
|
||||
RUN apk add --no-cache wget || true
|
||||
|
||||
RUN npm config set strict-ssl false && \
|
||||
npm install -g pnpm
|
||||
# Runtime SIN dependencias de red (redes restringidas): busybox ya trae wget y
|
||||
# se arranca con node directo (sin pnpm), así el runtime no toca apk/npm.
|
||||
|
||||
# Crear usuario no-root para seguridad antes de copiar con --chown
|
||||
RUN addgroup -g 1001 -S nodejs
|
||||
@@ -86,5 +86,5 @@ ENV INTERNAL_API_URL=http://backend:8000/api/
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
# Ejecutar aplicación con Node.js
|
||||
CMD ["pnpm", "start"]
|
||||
# Ejecutar aplicación con Node.js (adapter-node, sin pnpm)
|
||||
CMD ["node", "build/index.js"]
|
||||
|
||||
Reference in New Issue
Block a user