Self-hosted Supabase

@codify/supabase-self-hosted·Codify official·v1.0.0·Updated 5 h ago

Run your own Supabase on Docker in one step, with fresh secrets and API keys generated for you. Works on macOS and Linux.

0 appliesmacOS · Linux
Apply with CodifyCustomize a copy

Opens the template in the Codify dashboard. Applying doesn't create a setup; customizing makes a private copy you can edit.

Or from your terminal
curl -fsSL https://releases.codifycli.com/ensure.sh | bash && codify apply @codify/supabase-self-hosted
Installs Codify first if you don’t have it.
This template runs 8 scripts on your machine. The Codify CLI shows you the exact command and asks before anything runs. Read the scripts

Configuration

The exact file codify apply uses. Copy it into your own codify.jsonc, or download it.

codify.jsonc174 lines · 5.2 KB
[
{
"type": "variable",
"name": "installDir",
"valueType": "text",
"label": "Where should the Supabase project live?",
"default": "~/supabase-project"
},
{
"type": "variable",
"name": "supabaseVersion",
"valueType": "text",
"label": "Self-hosted release tag",
"description": "A self-hosted/v* tag from github.com/supabase/supabase/tags.",
"default": "self-hosted/v0.8.5"
},
{
"type": "variable",
"name": "publicUrl",
"valueType": "text",
"label": "Public URL of the API gateway and Studio",
"description": "Keep http://localhost:8000 for a local install. On a server use your domain, ex: https://supabase.example.com",
"default": "http://localhost:8000"
},
{
"type": "variable",
"name": "siteUrl",
"valueType": "text",
"label": "URL of your app (auth redirects go here)",
"default": "http://localhost:3000"
},
{
"type": "homebrew",
"formulae": [
"git",
"openssl",
"jq"
],
"os": [
"macOS"
]
},
{
"type": "apt",
"install": [
"git",
"openssl",
"jq",
"curl",
"ca-certificates"
],
"os": [
"linux"
],
"distro": [
"debian-based"
]
},
{
"type": "docker",
"dependsOn": [
"homebrew",
"apt"
]
},
{
"type": "action",Runs a script · asks first
"name": "docker-running-macos",
"condition": "docker info >/dev/null 2>&1",
"action": "open -a Docker && until docker info >/dev/null 2>&1; do sleep 3; done",
"os": [
"macOS"
],
"dependsOn": [
"docker"
]
},
{
"type": "action",Runs a script · asks first
"name": "supabase-files",
"condition": "[ -f ${{ installDir }}/docker-compose.yml ]",
"action": "tmp=$(mktemp -d) && git clone --filter=blob:none --no-checkout --depth=1 --quiet --branch ${{ supabaseVersion }} https://github.com/supabase/supabase \"$tmp/supabase\" && git -C \"$tmp/supabase\" sparse-checkout set --cone docker && git -C \"$tmp/supabase\" checkout --quiet && mkdir -p ${{ installDir }} && cp -rf \"$tmp/supabase/docker/.\" ${{ installDir }} && cp ${{ installDir }}/.env.example ${{ installDir }}/.env && printf 'ref=${{ supabaseVersion }}\\n' > ${{ installDir }}/.supabase-version && rm -rf \"$tmp\"",
"dependsOn": [
"homebrew",
"apt"
]
},
{
"type": "action",Runs a script · asks first
"name": "supabase-secrets",
"cwd": "${{ installDir }}",
"condition": "[ -f .env ] && ! grep -q '^JWT_SECRET=your-super-secret' .env",
"action": "sh utils/generate-keys.sh --update-env && sed -i.old -e 's|^SUPABASE_PUBLIC_URL=.*$|SUPABASE_PUBLIC_URL=${{ publicUrl }}|' -e 's|^API_EXTERNAL_URL=.*$|API_EXTERNAL_URL=${{ publicUrl }}/auth/v1|' -e 's|^SITE_URL=.*$|SITE_URL=${{ siteUrl }}|' .env && rm -f .env.old && chmod 600 .env",
"dependsOn": [
"action.supabase-files"
]
},
{
"type": "action",Runs a script · asks first
"name": "docker-group-linux",
"cwd": "${{ installDir }}",
"condition": "[ \"$(id -u)\" = 0 ] || id -nG \"$(id -un)\" | grep -qw docker",
"action": "usermod -aG docker \"$(stat -c %U .)\"",
"requiresRoot": true,
"os": [
"linux"
],
"dependsOn": [
"docker",
"action.supabase-files"
]
},
{
"type": "action",Runs a script · asks first
"name": "supabase-api-keys-macos",
"cwd": "${{ installDir }}",
"condition": "grep -q '^SUPABASE_SECRET_KEY=.' .env",
"action": "sh utils/add-new-auth-keys.sh --update-env && rm -f .env.old docker-compose.yml.old",
"os": [
"macOS"
],
"dependsOn": [
"action.supabase-secrets",
"action.docker-running-macos"
]
},
{
"type": "action",Runs a script · asks first
"name": "supabase-api-keys-linux",
"cwd": "${{ installDir }}",
"condition": "grep -q '^SUPABASE_SECRET_KEY=.' .env",
"action": "sg docker -c 'sh utils/add-new-auth-keys.sh --update-env' && rm -f .env.old docker-compose.yml.old",
"os": [
"linux"
],
"dependsOn": [
"action.supabase-secrets",
"action.docker-group-linux"
]
},
{
"type": "action",Runs a script · asks first
"name": "supabase-start-macos",
"cwd": "${{ installDir }}",
"condition": "[ -n \"$(docker compose ps --status running -q studio 2>/dev/null)\" ]",
"action": "sh run.sh start",
"os": [
"macOS"
],
"dependsOn": [
"action.supabase-api-keys-macos"
]
},
{
"type": "action",Runs a script · asks first
"name": "supabase-start-linux",
"cwd": "${{ installDir }}",
"condition": "[ -n \"$(sg docker -c 'docker compose ps --status running -q studio' 2>/dev/null)\" ]",
"action": "sg docker -c 'sh run.sh start'",
"os": [
"linux"
],
"dependsOn": [
"action.supabase-api-keys-linux"
]
},
{
"type": "notice",
"name": "supabase-ready",
"level": "success",
"title": "Supabase is up and running",
"message": "Your own Supabase lives in `${{ installDir }}`. No credit card required.\n\nStudio: ${{ publicUrl }} (log in with the dashboard user and password from `.env`)\nREST: ${{ publicUrl }}/rest/v1/ · Auth: ${{ publicUrl }}/auth/v1/\n\nShow your keys and passwords:\n `cd ${{ installDir }} && sh run.sh secrets`\nCheck health: `docker compose ps`\n\nOn Linux, log out and back in once so `docker` works without sudo. On a public server, put Caddy or Nginx with TLS in front of port 8000 before you share the URL."
}
]