Skip to content

feat: add apple-container runtime support#4970

Open
jsj wants to merge 6 commits intosupabase:developfrom
jsj:jsj/apple-containers
Open

feat: add apple-container runtime support#4970
jsj wants to merge 6 commits intosupabase:developfrom
jsj:jsj/apple-containers

Conversation

@jsj
Copy link
Contributor

@jsj jsj commented Mar 18, 2026

Summary

  • Adds Apple Containers as an alternative to Docker Desktop for local development (--runtime apple-container or [local].runtime = "apple-container" in config.toml)
  • Implements a strategy-pattern runtime abstraction layer in internal/utils/runtime.go that dispatches container operations to either Docker SDK or Apple's container CLI
  • Handles Apple container differences: no built-in DNS (uses IP resolution), no Docker log driver (JSONL forwarder processes for analytics), no native health-checks (label-encoded checks run via container exec), volume mount path conflicts (PGDATA subdirectory)
  • Reorders Kong startup after upstream services so IP addresses can be resolved on Apple containers (harmless for Docker where DNS aliases work regardless)
  • Adds KongId to listServicesToRestart for database reset (Kong caches upstream addresses that become stale when the DB container is recreated)
  • Adds Host header injection in Kong for Realtime routes (Apple containers use IPs, Realtime requires tenant ID as Host)
  • Adds runtime summary section to supabase status pretty output showing containers, networks, volumes
  • Updates docs for start, status, stop commands

New files

File Purpose
internal/utils/apple_container.go Apple container CLI wrapper (run, exec, logs, inspect, volumes, networks)
internal/utils/runtime.go Unified runtime abstraction with dispatcher functions
internal/utils/apple_analytics.go Per-container log forwarder for Vector analytics
cmd/apple_log_forwarder.go Hidden CLI command for the forwarder subprocess

Test plan

  • All existing tests pass (only pre-existing flaky test in legacy/branch/create fails due to Docker daemon dependency)
  • New tests for: runtime host resolution, Kong config building, stale container reconciliation, Vector config rendering, Studio env building, database host resolution, analytics forwarder lifecycle, edge runtime working directory
  • Manual: supabase start --runtime apple-container on macOS with Apple Containers installed
  • Manual: supabase stop cleans up Apple container resources
  • Manual: supabase db reset with Apple container runtime
  • Manual: supabase status shows runtime summary
  • Verify Docker mode is unaffected by Kong startup reorder and KongId restart addition

@jsj jsj requested a review from a team as a code owner March 18, 2026 00:24
@jsj jsj force-pushed the jsj/apple-containers branch from b2fcaa5 to c364377 Compare March 18, 2026 00:28
@coveralls
Copy link

coveralls commented Mar 18, 2026

Pull Request Test Coverage Report for Build 23416634417

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 831 of 1658 (50.12%) changed or added relevant lines in 15 files are covered.
  • 554 unchanged lines in 19 files lost coverage.
  • Overall coverage decreased (-0.7%) to 61.146%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/root.go 1 3 33.33%
internal/utils/flags/config_path.go 4 6 66.67%
cmd/apple_log_forwarder.go 8 11 72.73%
internal/db/start/start.go 19 23 82.61%
internal/utils/config.go 17 22 77.27%
internal/stop/stop.go 11 20 55.0%
internal/status/status.go 59 69 85.51%
internal/db/reset/reset.go 40 63 63.49%
internal/utils/apple_analytics.go 82 178 46.07%
internal/start/start.go 272 383 71.02%
Files with Coverage Reduction New Missed Lines %
internal/start/start.go 1 64.5%
internal/stop/stop.go 5 67.44%
internal/testing/apitest/docker.go 5 90.22%
internal/utils/git.go 5 57.14%
internal/migration/apply/apply.go 8 48.89%
internal/migration/down/down.go 9 70.83%
internal/utils/tea.go 10 44.35%
internal/db/push/push.go 17 68.57%
internal/db/start/start.go 18 82.18%
cmd/root.go 20 11.17%
Totals Coverage Status
Change from base Build 23201604318: -0.7%
Covered Lines: 9729
Relevant Lines: 15911

💛 - Coveralls

jsj and others added 6 commits March 22, 2026 21:17
Add Apple Containers as an alternative runtime for Supabase CLI-managed services.

Docker remains the default runtime, while apple-container can be selected anywhere the CLI manages the service lifecycle.

The primary use case today is local development, but the runtime abstraction is not limited to that environment.
Enable the analytics stack when services run on the apple-container runtime.

This adds an Apple-specific log ingestion path for Vector by forwarding container logs to host-side JSONL files and configuring Vector to read those files instead of Docker's log source.

Docker behavior remains unchanged.
Add explanatory comments addressing likely review questions:
- Why strategy-via-conditionals instead of an interface
- Kong startup order change (IP resolution needs running containers)
- Analytics log forwarding architecture (no Docker log driver)
- PGDATA override for Apple container volume mounts
- KongId added to listServicesToRestart (behavioral change)
- Host header in kong.yml for Realtime tenant routing
- Stale container reconciliation rationale
- Apple volume delete lacks force flag

Also add saveResetTestState helper to reduce verbose save/restore
boilerplate in reset_test.go.
- Add mockable variables for stopAppleAnalyticsForwarders, listProjectVolumes, dockerRemoveAll
- Test that StopAppleAnalyticsForwarders is called on Apple runtime
- Test that Docker volume suggestions are shown on Docker runtime
- Test that Apple container volume suggestions are shown on Apple runtime
- Test correct ordering: forwarders stopped before containers

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@jsj jsj force-pushed the jsj/apple-containers branch from 0d219ec to 9714850 Compare March 23, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants