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 ----
|
# ---- HTTPS ----
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl http2;
|
||||||
listen [::]:443 ssl;
|
listen [::]:443 ssl http2;
|
||||||
http2 on;
|
|
||||||
server_name testing.crm.aduanasoft.com;
|
server_name testing.crm.aduanasoft.com;
|
||||||
|
|
||||||
ssl_certificate /etc/letsencrypt/live/testing.crm.aduanasoft.com/fullchain.pem;
|
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
|
# Subida de documentos (máx. 25 MB en la app) + margen
|
||||||
client_max_body_size 30m;
|
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 on;
|
||||||
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
||||||
gzip_min_length 1024;
|
gzip_min_length 1024;
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ ENV INTERNAL_API_URL=${INTERNAL_API_URL}
|
|||||||
# Copiar el resto del código
|
# Copiar el resto del código
|
||||||
COPY . .
|
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
|
# Construir el proyecto
|
||||||
RUN pnpm run build
|
RUN pnpm run build
|
||||||
|
|
||||||
@@ -49,11 +52,8 @@ FROM node:22-alpine AS runtime
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# wget de busybox ya viene en alpine; el apk es best-effort (redes restringidas sin CDN de Alpine)
|
# Runtime SIN dependencias de red (redes restringidas): busybox ya trae wget y
|
||||||
RUN apk add --no-cache wget || true
|
# se arranca con node directo (sin pnpm), así el runtime no toca apk/npm.
|
||||||
|
|
||||||
RUN npm config set strict-ssl false && \
|
|
||||||
npm install -g pnpm
|
|
||||||
|
|
||||||
# Crear usuario no-root para seguridad antes de copiar con --chown
|
# Crear usuario no-root para seguridad antes de copiar con --chown
|
||||||
RUN addgroup -g 1001 -S nodejs
|
RUN addgroup -g 1001 -S nodejs
|
||||||
@@ -86,5 +86,5 @@ ENV INTERNAL_API_URL=http://backend:8000/api/
|
|||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
||||||
# Ejecutar aplicación con Node.js
|
# Ejecutar aplicación con Node.js (adapter-node, sin pnpm)
|
||||||
CMD ["pnpm", "start"]
|
CMD ["node", "build/index.js"]
|
||||||
|
|||||||
Reference in New Issue
Block a user