Repository navigation
Build native releases and images through a single Nix flake - #299
Merged
Merged
Conversation
jgoux
marked this pull request as ready for review
September 5, 2026 03:17
This was referenced Sep 5, 2026
Coly010
approved these changes
Sep 7, 2026
avallete
approved these changes
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.
This migrates native service builds and image assembly to a single root Nix flake. Release jobs previously selected between host installers, copied upstream overlays, and several Nix invocation paths. They now resolve the requested source and dependency hashes into an explicit release input, build a portable runtime, and package the audited bytes with pinned archive tools and dockerTools.
The hourly poller, release floors, exact-version selection, and automatic native-package/image publication remain intact. New upstream releases do not require edits to the repository lock. Postgres and Edge Runtime retain their selected upstream release's own dependency graph; verified upstream archives and mirrored images retain their existing provenance paths.
The migration removes host Go/npm installers, duplicated Nix pins, copied overlays, Docker build runners, and slim Dockerfiles. Studio uses the standard nixpkgs pnpm fetcher and configuration hook. Runtime identity, working directories, entrypoints, volume permissions, and platform floors remain part of the validation contract.
Service artifacts also own Realtime, Analytics, Storage, and Pooler preparation, Pooler tenant provisioning, and PostgreSQL first boot. Native services and derived images use the same launchers. PostgreSQL bootstraps through a private socket and a directly owned temporary server, preserves existing volumes, and rejects incomplete initialization. Ports, credentials, and project configuration remain in the CLI stack rewrite.
Validation: repository checks, host fixture suites, shell syntax/ShellCheck, and pure flake evaluation pass. All 15 selected release validations pass across Linux amd64, Linux arm64, and macOS arm64, covering 13 services, PostgreSQL 15 and 17, and two Studio versions. Validation-only runs build, audit, archive, and smoke without replacing published assets or images. A fresh poller dry run found no unpublished backlog among 155 eligible versions.
Same-version Linux ARM64 comparisons: compressed images decreased by 4.4 MiB for PostgreSQL 17, 3.2 MiB each for Storage and PgMeta, and 8.7 MiB for Studio. Native archives for the first three increased by 1.1–3.0 MiB with bundled glibc; Studio's archive decreased by 0.5 MiB. Parallel-stack memory capacity remains unmeasured.
Successful release-validation runs
Repository checks
Service preparation validation
The eight selected releases were replaced from this branch after passing all three native targets and both Linux images. Each release has verified archive checksums, manifests, and SBOMs; CLI PR #6440 pins the published multi-architecture image digests. PostgreSQL coverage includes existing volumes, backup restoration, restart behavior, and failed initialization; host fixtures verify cancellation and process cleanup.
Supersedes #298