diff --git a/deployment/config/nginx/production.conf b/deployment/config/nginx/production.conf index 771641ab6..b40f3e11e 100644 --- a/deployment/config/nginx/production.conf +++ b/deployment/config/nginx/production.conf @@ -345,9 +345,9 @@ http { } # Prometheus - Metrics scraping + # --web.external-url=/prometheus/ means it expects the prefix in requests location /prometheus/ { set $upstream_prometheus prometheus; - rewrite ^/prometheus/(.*)$ /$1 break; proxy_pass http://$upstream_prometheus:9090; proxy_http_version 1.1; proxy_set_header Host $host; diff --git a/deployment/docker-compose.stack.yml b/deployment/docker-compose.stack.yml index dd6042e55..83f44ef71 100644 --- a/deployment/docker-compose.stack.yml +++ b/deployment/docker-compose.stack.yml @@ -749,8 +749,8 @@ services: # DBAL Frontend - Daemon overview + query console dbal-frontend: build: - context: .. - dockerfile: frontends/dbal/Dockerfile + context: ../frontends/dbal + dockerfile: Dockerfile args: DBAL_DAEMON_URL: http://dbal:8080 container_name: metabuilder-dbal-frontend diff --git a/frontends/dbal/Dockerfile b/frontends/dbal/Dockerfile index defbe7b51..008c297ca 100644 --- a/frontends/dbal/Dockerfile +++ b/frontends/dbal/Dockerfile @@ -1,50 +1,35 @@ -# Multi-stage build: node_modules from base image, source built fresh -# Context: monorepo root (..) -# Requires: docker build -f deployment/base-images/Dockerfile.node-deps \ -# -t metabuilder/base-node-deps:latest . +FROM node:24-alpine AS base -# --- Build stage --- -ARG BASE_REGISTRY=metabuilder -FROM ${BASE_REGISTRY}/base-node-deps:latest AS builder +FROM base AS deps +RUN apk add --no-cache libc6-compat +WORKDIR /app +COPY package.json ./ +RUN npm install --legacy-peer-deps + +FROM base AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . ARG DBAL_DAEMON_URL=http://dbal:8080 ENV DBAL_DAEMON_URL=$DBAL_DAEMON_URL -# ── Shared packages (resolved by transpilePackages) ───────────────────────── -# Only the workspace deps that dbal-ui actually imports. -# -# redux/api-clients → hooks-async → redux-slices (transitive chain) -COPY redux/api-clients/ ./redux/api-clients/ -COPY redux/hooks-async/ ./redux/hooks-async/ -COPY redux/slices/ ./redux/slices/ -COPY redux/core-hooks/ ./redux/core-hooks/ +RUN mkdir -p public && npm run build -# ── DBAL frontend (the app itself) ────────────────────────────────────────── -COPY frontends/dbal/ ./frontends/dbal/ - -# Build workspace library packages -RUN for ws in redux/slices redux/hooks-async redux/api-clients redux/core-hooks; do \ - npm run build -w "$ws" --if-present 2>&1 || echo "WARN: $ws build failed (non-critical)"; \ -done - -# Build the app -RUN cd frontends/dbal && npx next build - -# --- Runtime stage --- -FROM node:24-alpine +FROM base AS runner WORKDIR /app - -COPY --from=builder /app/frontends/dbal/.next/standalone ./ -COPY --from=builder /app/frontends/dbal/.next/static ./frontends/dbal/.next/static - ENV NODE_ENV=production -ENV PORT=3000 -ENV HOSTNAME="0.0.0.0" - +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs +COPY --from=builder /app/public ./public +RUN mkdir .next && chown nextjs:nodejs .next +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static +USER nextjs EXPOSE 3000 +ENV PORT=3000 HOSTNAME="0.0.0.0" HEALTHCHECK --interval=15s --timeout=5s --start-period=30s --retries=3 \ CMD wget --quiet --tries=1 --spider http://127.0.0.1:3000/dbal || exit 1 -WORKDIR /app/frontends/dbal CMD ["node", "server.js"] diff --git a/frontends/dbal/next.config.ts b/frontends/dbal/next.config.ts index 52ab32a20..9a1e917b1 100644 --- a/frontends/dbal/next.config.ts +++ b/frontends/dbal/next.config.ts @@ -4,12 +4,6 @@ const nextConfig: NextConfig = { reactStrictMode: true, output: 'standalone', basePath: '/dbal', - transpilePackages: [ - '@metabuilder/api-clients', - '@metabuilder/core-hooks', - '@metabuilder/hooks-async', - '@metabuilder/redux-slices', - ], } export default nextConfig diff --git a/frontends/dbal/package.json b/frontends/dbal/package.json index 0ca6d515c..3c0fa41b8 100644 --- a/frontends/dbal/package.json +++ b/frontends/dbal/package.json @@ -14,13 +14,9 @@ "test:e2e:ui": "playwright test --ui" }, "dependencies": { - "@metabuilder/api-clients": "*", - "@metabuilder/core-hooks": "*", "next": "^16.1.6", "react": "^19.2.4", - "react-dom": "^19.2.4", - "react-redux": "^9.2.0", - "redux": "^5.0.1" + "react-dom": "^19.2.4" }, "overrides": { "react": "^19.2.4", diff --git a/frontends/dbal/src/DaemonPage.tsx b/frontends/dbal/src/DaemonPage.tsx index dd2a339d4..1151ae21d 100644 --- a/frontends/dbal/src/DaemonPage.tsx +++ b/frontends/dbal/src/DaemonPage.tsx @@ -44,10 +44,10 @@ export function DBALDaemonPage() { A hardened, sandboxed C++ daemon serves all database operations via REST API. It validates every request, enforces ACLs, and executes SQL through safe adapters.
Try refreshing the page in a few moments.