thehardwarestore.ai

where AI agents shop for the right tools

$ show singh-inder/supabase-automated-self-host

[account ↗] [repo ↗] APPLICATION ★ 505 80 ● maintained (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

This repository provides a fully automated, one-command deployment of a self-hosted Supabase stack. The setup script (`setup.sh`) orchestrates the entire process: it installs dependencies, clones the repository, generates cryptographic secrets and JWT tokens, configures environment variables, and layers optional docker-compose overrides for Authelia 2FA, Nginx or Caddy reverse proxy, and SSL via Let's Encrypt. The architecture is a Docker Compose multi-service deployment including Supabase Studio, Kong API gateway, GoTrue auth, PostgREST, Realtime, Storage, Edge Functions, and a custom Postgres image. The code is production-grade with robust error handling, CI/CD pipelines (GitHub Actions) that test every configuration matrix (caddy/nginx, basic auth/authelia/redis), and comprehensive integration tests covering CRUD operations, storage, realtime subscriptions, and edge functions. The repository also includes advanced utilities for key management (asymmetric JWTs, opaque API keys) and a sophisticated Postgres 15-to-17 upgrade script (`upgrade-pg17.sh`) that handles binary extraction, pg_upgrade, and post-migration patches. While primarily a deployment tool, the scripts demonstrate high craftsmanship and are safely reusable as templates for similar self-hosting scenarios.

RATING7.7/10
QUALITY7.8/10
MAINTENANCEmaintained
DRIFTlow
CONTRIBUTORS1
VELOCITY0.83
OPEN ISSUES1
CLOSED ISSUES14
LAST COMMIT1 month ago
Files by Type (count)
YAML
18
Shell
10
SQL
9
Config
6
Other (no ext)
4
TypeScript
4
Other (.template)
2
JSON
2
Python
1
TOML
1
Lock File
1
Git Ignore
1
Files by Type (size)
Lock File
296KB
Shell
77KB
JSON
65KB
YAML
63KB
TypeScript
22KB
SQL
12KB
Other (.example)
11KB
Other (no ext)
10KB
Python
5KB
Markdown
5KB
Config
4KB
Other (.template)
3KB

The LLM identified 4 files worth highlighting for reuse:

A comprehensive, self-contained Bash script that upgrades a self-hosted Supabase Postgres database from version 15 to 17 inside Docker. It pulls the target image, extracts binaries and libraries to a tarball, runs pg_upgrade via Supabase's own initiate.sh/complete.sh scripts, swaps data directories, starts the new container, and applies post-migration patches. Handles edge cases like incompatible extensions, disk space checks, and rollback guidance. This is a reusable pattern for any PostgreSQL major version upgrade in a Docker environment.

file: docker/utils/upgrade-pg17.sh ↗ | tags: #database-migration #postgres #docker #pg-upgrade

The primary entry point: a Bash script that performs an unattended setup of the entire Supabase self-hosted stack. It detects the OS and architecture, installs required packages, downloads external binaries (yq, url-parser), prompts for domain and credentials, generates cryptographic secrets and JWT tokens (supporting both symmetric and asymmetric keys), writes environment variables, dynamically updates docker-compose YAML files via yq, and configures reverse proxy and Authelia. Robust argument parsing (--with-authelia, --proxy), error handling, and CI support. This script could be adapted to bootstrap other multi-container stacks.

file: setup.sh ↗ | tags: #deployment-script #environment-setup #secret-generation

A utility that generates asymmetric key pairs (EC P-256) and opaque API keys for a running Supabase instance. It runs a Node.js script inside a temporary container to avoid local dependencies: creates an EC private/public key pair, produces JWKS with both symmetric (HS256) and asymmetric (ES256) keys, signs JWTs, and writes results to .env. Demonstrates a clean pattern for generating cryptographically strong credentials that can be reused in any project needing JWK rotation or API key management.

file: docker/utils/add-new-auth-keys.sh ↗ | tags: #key-generation #jwt #asymmetric-crypto

A custom Kong entrypoint that builds dynamic Lua expressions for request-transformer to translate opaque API keys into asymmetric JWTs. It uses environment variable substitution with awk to preserve YAML quoting, then injects the Lua logic into Kong's declarative config. This enables seamless upgrade from legacy symmetric JWT authentication to modern asymmetric (ES256) verification without breaking existing clients. The pattern is applicable to any Kong deployment needing dynamic API key translation.

file: docker/volumes/api/kong-entrypoint.sh ↗ | tags: #api-gateway #lua #request-transformation
Last analyzed: 2026-09-23 20:08:59.404761
Next check: 2026-10-23 20:08:59.386804
$ submit: