Spaces:
Paused
Paused
Commit History
-
refactor: remove cloudflare-worker.js and related configurations
010e97a -
refactor: replace UptimeRobot with Cloudflare Workers for service keep-alive mechanism
5d2b465 -
fix: rewrite Space-host redirects to relative paths + pass x-forwarded-protoβ
Next.js middleware generates redirects using the public SPACE_HOST (e.g. https://somratpro-huggingpost.hf.space/auth). The HF Spaces reverse proxy intercepts absolute redirects to its own hostname, resolves them server-side, and returns 200 β causing blank white page at /app/ instead of navigating. - health-server rewriteLocation: also rewrite absolute URLs whose hostname matches SPACE_HOST to /app-prefixed relative paths (same logic as 127.0.0.1) so the browser (not HF proxy) handles the navigation and URL bar updates - Dockerfile: patch nginx to pass X-Forwarded-Proto from upstream header ($http_x_forwarded_proto) instead of hardcoding $scheme=http so Next.js builds correct https:// redirect URLs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>57b8b04 -
fix: patch google font β local at runtime to survive cached Stage 1β
Stage 1 Docker image may be cached from before the font patch was added. Apply the patch in start.sh at container start (idempotent grep check) so the cached image is fixed without requiring a full Stage 1 rebuild. - Dockerfile Stage 2: COPY vendor fonts + patch script to /opt/vendor/ - start.sh: patch layout.tsx files before next build if still on google font Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>fd4cae0
-
feat: vendor Plus Jakarta Sans fonts and patch layouts to resolve build-time network constraints, update health-server proxy logic, and correct UptimeRobot interval units.
6c0455b -
perf: move pnpm install before next.config.js patches to preserve cacheβ
Any change to the patch RUN command previously busted the pnpm install cache layer, forcing a full reinstall (~3-4 min) on every push. Moving install first means patch changes only invalidate the patch + build layers. Also consolidates the two patch RUN commands into one to reduce layer count. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>2ecb798 -
fix: redirect bare paths to /app/ and disable image optimizationβ
Post-login 404: Postiz navigates to /launches (no basePath prefix) after auth; health-server now redirects any unrecognized path to /app<path> instead of 404-ing. _next/image 400s: disable Next.js image optimization (unoptimized:true in next.config.js) so <Image> renders plain <img src="/app/auth/avatars/..."> tags that route through nginx correctly, bypassing the optimizer's internal fetch which failed because static files live at the basePath-prefixed path. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>0234a7a -
fix: redirect /app root to /app/auth/ instead of white-screeningβ
nginx:5000 returns HTTP 200 with empty body for GET / β it never reaches Next.js for the bare root path. health-server now intercepts GET /app and GET /app/ before proxying and issues a 302 β /app/auth/; Next.js middleware then redirects authenticated users to /launches/ transparently. Also removes the temporary /debug-proxy endpoint and console.warn that were added for diagnosis, and annotates the Dockerfile nginx patch for clarity. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>c4c4e4c
-
Fix ERR_TOO_MANY_REDIRECTS: add trailingSlash:true + config-hash rebuild guardβ
Root cause: nginx proxy_pass adds trailing slash (β /app/), Next.js with basePath="/app" and trailingSlash:false (default) redirects /app/ β /app, which loops forever through the same nginx path. Fix 1 (Dockerfile): add `trailingSlash: true` to next.config.js patch so /app/ becomes the canonical form β nginx always sends it, Next.js serves directly with no redirect. Fix 2 (start.sh): hash next.config.js at startup and compare against .next/.config-hash written after each frontend build. If the hash differs (new image with patched config) the frontend is rebuilt even when .next is restored from the HF Dataset backup. Without this, the old .next built with trailingSlash:false would be reused after the next restore. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>c63d0d1 -
fix: patch nginx to re-add /app prefix when proxying to Next.jsβ
health-server strips /app from /app/* requests before forwarding to nginx:5000. Next.js is built with basePath="/app" and only handles paths at /app/*. Without this patch: nginx sends /auth/login β Next.js 404. With this patch: nginx sends /app/auth/login β Next.js serves the page. Patch changes proxy_pass http://{host}:4200/ β http://{host}:4200/app/ in the upstream nginx.conf at runtime (covers both localhost and 127.0.0.1). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>0394ebe -
fix: move next build to container startup β HF builder cgroup too smallβ
next build for Postiz needs ~4 GB RSS. The HF Space builder has a ~4 GB cgroup limit, making it impossible to complete in docker build regardless of heap tuning, single-thread flags, or multi-stage tricks (exit 137). Solution: don't run next build in the Dockerfile at all. Run it in start.sh at container startup where the runtime has 16 GB RAM. Bonuses over the docker-build approach: - NEXT_PUBLIC_BACKEND_URL is baked with the real SPACE_HOST URL (correct) instead of localhost (broken) because we now know it at build time - First boot ~5-8 min; all subsequent boots restore .next from HF Dataset backup and skip the build entirely Changes: - Dockerfile: remove all frontend build steps; back to clean 2-stage; HEALTHCHECK start-period raised to 600s for first-boot window - start.sh: build frontend at startup if .next/BUILD_ID absent; 8 GB heap (runtime has 16 GB); shows progress in logs - postiz-sync.py: include .next (minus webpack cache) in backup tarball; restore on boot soβ¦866a8e6 -
fix: fresh clone + filtered pnpm install in frontend stage to cut peak RSSβ
Root cause: COPY --from=stage1 /build /build in Stage 2 imports ~2 GB of node_modules (3817 packages). OS page-caches the unpacked tree; webpack then traverses the full module graph on top β combined RSS exceeds builder cgroup limit β OOMKilled (exit 137) even with a separate build stage. Fix: Stage 2 does a fresh git clone and installs only the frontend package's dependency tree (pnpm --filter "./apps/frontend..."). This skips NestJS, Prisma, bcrypt, Bull, and other server-only packages, producing a much smaller node_modules β lower OS page-cache pressure β next build fits in RAM. Also adds swcMinify: false to force Terser (pure JS, V8-heap-bounded) over the native SWC binary, which adds RSS outside the V8 heap limit. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>a1ea643 -
fix: split frontend into isolated build stage to eliminate residual RSSβ
Three NestJS builds leave ~1-2 GB residual RSS in the same container even after each exits; next build alone needs ~3-4 GB. Combined they exceed the HF builder cgroup limit (exit 137 OOMKilled). Stage 1 (postiz-builder): clone + patch + install + backend/workers/cron Stage 2 (postiz-frontend): COPY from Stage 1, build Next.js in clean process Stage 3 (runtime): COPY server build from Stage 1, overlay .next from Stage 2 Stage 1's processes are dead before Stage 2 starts β OS reclaims all RSS. next build gets a clean address space with no competition. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>a83da60 -
fix: restore 3072 MB heap for frontend β single-thread needs ~1.9 GBβ
cpus:1 eliminates parallel webpack workers (the root OOM cause). But 2048 MB was too tight for a single V8 heap; the GC died at ~1855 MB. With only one worker process, 3072 MB is safe β the builder sees one 3 GB Node process instead of NΓ3 GB parallel workers that triggered the original OOMKilled. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>b517c30 -
fix: limit Next.js webpack workers to prevent OOMKilled on HF builderβ
Next.js 14 spawns N-1 webpack worker threads by default; each holds a full module graph in memory. On the HF Space builder, parallel threads push RSS past the builder limit (exit 137 OOMKilled) even with sourcemaps disabled. Fix: patch experimental.cpus=1 + workerThreads=false into next.config.js so webpack compiles single-threaded. Also add NEXT_PRIVATE_SKIP_SIZE_MINIMIZATION env var and lower frontend heap from 3072β2048 MB (single-thread doesn't need as much V8 heap headroom). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>7fec572 -
Fix OOM build (exit 137) by disabling sourcemap generationβ
Postiz upstream enables both Next.js productionBrowserSourceMaps and Sentry's webpack sourcemap plugin. Together they push peak build memory past HF Space builder limits (16 GB cap), causing OOMKilled at exit 137. Patch apps/frontend/next.config.js during build: - productionBrowserSourceMaps: true β false - Sentry sourcemaps.disable: false β true Also lower per-app heap from 4 GB to 3 GB and build the four Postiz apps sequentially (backend β workers β cron β frontend) instead of in parallel β concurrent Next.js + Nest builds each spawn worker pools and stack peak RSS. README updated for /app routing (Postiz UI mounted at /app/*, dashboard owns /, OAuth callback URLs need the /app prefix). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>8de0b02 -
initialize project
b4d7c1c