Repository navigation
Reduce BEAM runtime overhead through shared flake profiles - #302
Merged
Merged
Conversation
jgoux
marked this pull request as ready for review
September 7, 2026 09:27
avallete
approved these changes
Sep 7, 2026
This was referenced Sep 7, 2026
pull Bot
pushed a commit
to oogalieboogalie/cli
that referenced
this pull request
Sep 7, 2026
## Summary Rewrites `@supabase/stack` around one managed-only runtime shared by strict native and container execution modes. The package owns durable configuration and secrets, sticky ports, artifact preparation, lifecycle arbitration, per-service eager or lazy activation, service migrations, ingress, retained and live logs, and exact resource cleanup. A stopped stack has no resident supervisor or runtime resources: status and retained logs come from durable state, while a later start creates a fresh owner and performs clean recovery. PostgreSQL 17 is the only eager service by default; other enabled services activate through stack ingress, and callers can configure eager activation. Dependency-ready workloads start concurrently. Docker-compatible engines, including Podman, share the same container path. Enabled lazy services prepare their artifacts in the background after startup by default. `preparation: "on-demand"` retains full lazy downloading, while explicit `prepare()` remains available in either mode. Foreground activation prepares its dependency closure concurrently and shares in-flight downloads with background preparation. All selected workload downloads can run concurrently. Native archives are streamed to disk while hashing, verified before extraction, and decompressed without retaining whole archives in memory. Runtime cleanup cancels unfinished transfers and retains completed cache entries. Status exposes artifact preparation separately from service readiness, and explicit preparation reports progress through `onProgress`. Edge Functions are served through the stack-owned Edge Runtime for package consumers. The package runs independently of the CLI and accepts normalized `StackConfig` values without reading `config.toml`. All CLI integration, including `supabase functions serve` and lifecycle commands under `experimental start`, belongs to M5 in separate PRs. Existing CLI Functions behavior is preserved. The deleted `next` CLI was a disposable proving ground and is not part of this PR. Service preparation now lives in the published runtime artifacts: PostgreSQL owns first boot and bundled migrations, service helpers own migration and Pooler tenant provisioning, and Node services expose public launchers shared with their images. The stack supplies instance settings and sequences those commands. Default images use the configured slim-services tags or digests, including the artifacts from [slim-services #299](supabase/slim-services#299) and the BEAM versions republished after [slim-services #302](supabase/slim-services#302). Native downloads are checked against the checksum published with the same release. BEAM launchers own the shared runtime defaults in native and container modes; Vector configuration and Edge Functions bootstrap remain stack-owned. Unix control sockets bind inside owner-private directories. Container mount paths preserve CSV special characters, and default state paths use the user home directory when `HOME` is absent. Obsolete process-compose integration and superseded runtime helpers are removed. Supersedes supabase#6385
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reduce local BEAM service overhead through the runtime profiles consumed by the root Nix flake, so portable artifacts and derived images share the defaults. Realtime, Pooler, and Analytics default to standalone distribution while preserving explicit named-distribution and scheduler overrides. Realtime disables its default Postgres cluster discovery; Pooler reduces its metadata database pool from 25 connections to two. Existing single-scheduler, no-busy-wait, and Analytics pool settings remain in place.
This adapts Filipe Cabaço’s changes in #296 to main. Its Dockerfile path fixes are obsolete after the flake migration, and its unconditional distribution export would overwrite callers’ settings. The existing caller-preserving release patch stays in place; the default comes from
runtime.env. Analytics also drops the explicit short-name argument from its image entrypoint.Native smoke probes exercise the packaged release launcher with default and overridden distribution/scheduler settings. Container startup, preparation, and health smokes run with one CPU and a 384 MiB budget for Realtime/Pooler or 768 MiB for Analytics. These are smoke budgets, not hard-coded runtime limits. Cluster deployments must explicitly enable distribution and the service’s discovery configuration; Realtime can use
RELEASE_DISTRIBUTION=namewithCLUSTER_STRATEGIES=POSTGRES.Validation: repository checks, shell syntax, ShellCheck, and the release-environment regression fixture pass. All six release validations pass at commit
42a789b: 18 platform jobs covering each service’s floor and latest version across Linux amd64, Linux arm64, and macOS arm64. Linux jobs validate both derived images and raw host artifacts. Runs usedvalidation_only=true, preserving published releases. The release inventory found no unpublished stable backlog for these services. No release floor or version pins change.Supersedes #296
Latest Linux image smoke RSS observations:
These smoke measurements verify the configured budgets. Incremental memory savings have not been isolated in a benchmark, and the service RSS measurements exclude Postgres backend memory saved by smaller connection pools.