supabase

command
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 29 Imported by: 0

README

Supabase example

One-execute Supabase stack using go-contain: programmatic Compose with profiles, resource limits, embedded config, and real-time events.

Requirements

  • Go 1.21+
  • Docker and Docker Compose

Run (from repo root)

go run ./examples/supabase/                    # minimal stack, no resource limits
go run ./examples/supabase/ -profile full     # full stack
go run ./examples/supabase/ -resource-limits  # minimal with memory/CPU limits on db, kong, studio
go run ./examples/supabase/ -profile full -resource-limits
go run ./examples/supabase/ -volumes-path /path/to/volumes

Flags

Flag Description
-profile minimal (default) or full. Minimal = db, analytics, kong, studio, auth, rest. Full adds vector, realtime, storage, imgproxy, meta, functions, supavisor.
-resource-limits Apply memory/CPU limits to db (2GiB, 2 CPU), kong and studio (512MiB, 1 CPU each).
-volumes-path Directory for volume files. Default: ./volumes or SUPABASE_VOLUMES_PATH.

Environment variables (optional): SUPABASE_PROFILE, SUPABASE_RESOURCE_LIMITS=1, SUPABASE_VOLUMES_PATH.

What it does

  1. Bootstrap: Writes embedded config (Kong, DB SQL, Vector, pooler, edge function) under the volumes path. No network fetch; all files are in the binary.
  2. Up: Starts the stack with the chosen profile. DB has a 120s health start period for init.
  3. Events: Streams compose events as JSON (cyan) to stdout alongside container logs.
  4. Ctrl+C: Sends SIGKILL to containers, then runs down (remove orphans, volumes).

Clean run

To reset DB and config and start fresh:

rm -rf volumes #  if ran previously
go run ./examples/supabase/ -profile minimal

go-contain features used

  • Profilessc.WithProfiles("minimal") / "full" and up.WithProfiles(...) for run modes.
  • Conditional resource limitstools.WhenTrue(enableResourceLimits, sc.WithDeploy(deploy.WithResourceLimits(...))) on db, kong, studio.
  • Health and deployhealth.WithStartPeriod, resource.WithMemoryBytes, resource.WithNanoCPUs.
  • Compose APIUp, Logs, Events, Kill, Down with profile and option setters.
  • Validationproject.Validate() before up.

Documentation

Overview

Package main: write embedded Supabase volume files to disk for the example. All required config files are embedded so the example runs offline with no GitHub fetch.

Package main: Supabase stack configuration and per-service environment maps.

Package main: Supabase service container definitions (vector, db, analytics, auth, rest, realtime, storage, imgproxy, meta, functions, kong, studio, supavisor).

Supabase bootstrap example: one-execute install of the Supabase stack using go-contain. Required volume files are auto-downloaded from the Supabase repo when missing. Streams compose events (start/stop/health) alongside logs; Ctrl+C kills containers and brings the stack down.

Flags:

-profile: minimal (default) or full. Full adds vector, realtime, storage, imgproxy, meta, functions, supavisor.
-resource-limits: apply memory/CPU limits to db, kong, and studio.
-volumes-path: directory for volume files (default: ./volumes or SUPABASE_VOLUMES_PATH).

Package main: compose project assembly and service dependencies. Core services use sc.WithProfiles("minimal"); optional services use sc.WithProfiles("full"). Up/Down/Logs must pass at least one profile (e.g. up.WithProfiles("minimal") or "minimal","full" for full stack). Resource limits are applied when enableResourceLimits is true.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL