feat: implement R4 production hardening

- Add configurable ingestion batch item limits
- Improve client serialization and sanitization
- Add graceful handling for corrupt GZIP partitions in data API
- Expand admin session token scope
- Update project documentation for R4 status
This commit is contained in:
Team Dark Devil committed 2026-11-21 22:15:32 +06:00
1 parent 8132087085
commit ae9b554189
59 files changed
+16879 -1074

No files matched your search

+2
View File
@@ -8,6 +8,8 @@ FROM node:22-alpine AS builder
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ARG INGESTION_INTERNAL_URL=http://ingestion:4000
ENV INGESTION_INTERNAL_URL=${INGESTION_INTERNAL_URL}
COPY --from=dependencies /app/node_modules ./node_modules
COPY . .
RUN npm run build
+24
View File
@@ -17,6 +17,15 @@ server {
listen 80;
server_name _;
# Preserve real external visitor IP when routed behind Coolify Traefik / trusted LAN proxies
set_real_ip_from 127.0.0.1;
set_real_ip_from 10.0.0.0/8;
set_real_ip_from 172.16.0.0/12;
set_real_ip_from 192.168.0.0/16;
set_real_ip_from fc00::/7;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
resolver 127.0.0.11 valid=10s ipv6=off;
set $nextjs_upstream "http://web:3000";
set $socketio_upstream "http://ingestion:4000";
@@ -48,6 +57,21 @@ server {
proxy_buffering off;
}
location /vcon/files-engine {
proxy_pass $socketio_upstream;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $forwarded_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $forwarded_proto;
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
proxy_buffering off;
}
location = /api/export {
proxy_pass $nextjs_upstream;
proxy_http_version 1.1;
+9
View File
@@ -19,6 +19,11 @@ services:
DATASTACK_ADMIN_SETUP_KEY: "${SERVICE_REALBASE64_64_ADMININSTALL:?Coolify must generate SERVICE_REALBASE64_64_ADMININSTALL}"
DATABASE_URL: "postgresql://datastack:${SERVICE_PASSWORD_64_POSTGRES:?Coolify must generate SERVICE_PASSWORD_64_POSTGRES}@postgres:5432/${SERVICE_HEX_32_DATABASENAME:?Coolify must generate SERVICE_HEX_32_DATABASENAME}"
REDIS_URL: "redis://redis:6379"
DATASTACK_ALLOW_PRIVATE_URLS: "${DATASTACK_ALLOW_PRIVATE_URLS:-false}"
DATASTACK_MAX_BATCH_ITEMS: "${DATASTACK_MAX_BATCH_ITEMS:-1000}"
DATASTACK_RECENT_LIMIT: "${DATASTACK_RECENT_LIMIT:-500}"
DATASTACK_MAINTENANCE_INTERVAL_MS: "${DATASTACK_MAINTENANCE_INTERVAL_MS:-}"
DATASTACK_PROXY_MODE: "${DATASTACK_PROXY_MODE:-}"
depends_on:
postgres:
condition: service_healthy
@@ -53,10 +58,14 @@ services:
PORT_SOCKET: "4000"
DATASTACK_JWT_SECRET: "${SERVICE_REALBASE64_64_JWT:?Coolify must generate SERVICE_REALBASE64_64_JWT}"
DATASTACK_INTERNAL_SECRET: "${DATASTACK_INTERNAL_SECRET:-${SERVICE_REALBASE64_64_INTERNAL:-}}"
DATASTACK_ADMIN_EMAIL: "${DATASTACK_ADMIN_EMAIL:-admin@datastack.dev}"
DATASTACK_ADMIN_SESSION_SECRET: "${SERVICE_REALBASE64_64_ADMINSESSION:?Coolify must generate SERVICE_REALBASE64_64_ADMINSESSION}"
DATABASE_URL: "postgresql://datastack:${SERVICE_PASSWORD_64_POSTGRES:?Coolify must generate SERVICE_PASSWORD_64_POSTGRES}@postgres:5432/${SERVICE_HEX_32_DATABASENAME:?Coolify must generate SERVICE_HEX_32_DATABASENAME}"
REDIS_URL: "redis://redis:6379"
DATASTACK_CORS_ORIGINS: "${DATASTACK_CORS_ORIGINS:-}"
DATASTACK_ALLOW_PRIVATE_URLS: "${DATASTACK_ALLOW_PRIVATE_URLS:-false}"
DATASTACK_MAX_BATCH_ITEMS: "${DATASTACK_MAX_BATCH_ITEMS:-1000}"
DATASTACK_RECENT_LIMIT: "${DATASTACK_RECENT_LIMIT:-500}"
depends_on:
postgres:
condition: service_healthy