Skip to content

supabase/postgres

Repository files navigation

Postgres + goodies

Unmodified Postgres with some useful plugins. Our goal with this repo is not to modify Postgres, but to provide some of the most common extensions with a one-click install.

Primary Features

Extensions

Extension Version Description
Postgres contrib modules - Because everyone should enable pg_stat_statements.
PostGIS 3.3.2 Postgres' most popular extension - support for geographic objects.
pgRouting v3.4.1 Extension of PostGIS - provides geospatial routing functionalities.
pgTAP v1.2.0 Unit Testing for Postgres.
pg_cron v1.6.2 Run CRON jobs inside Postgres.
pgAudit 1.7.0 Generate highly compliant audit logs.
pgjwt commit Generate JSON Web Tokens (JWT) in Postgres.
pgsql-http 1.5.0 HTTP client for Postgres.
plpgsql_check 2.2.3 Linter tool for PL/pgSQL.
pg-safeupdate 1.4 Protect your data from accidental updates or deletes.
wal2json commit JSON output plugin for logical replication decoding.
PL/Java 1.6.4 Write in Java functions in Postgres.
plv8 commit Write in Javascript functions in Postgres.
pg_plan_filter commit Only allow statements that fulfill set criteria to be executed.
pg_net v0.6.1 Expose the SQL interface for async networking.
pg_repack ver_1.5.0 Tool to remove bloat from tables and indexes
rum 1.3.13 An alternative to the GIN index.
pg_hashids commit Generate unique identifiers from numbers.
pgsodium 3.1.0 Modern encryption API using libsodium.
pg_stat_monitor 1.0.1 Query Performance Monitoring Tool for PostgreSQL
pgvector v0.4.0 Open-source vector similarity search for Postgres

Can't find your favorite extension? Suggest for it to be added into future releases here!

Enhanced Security

This is only available for our AWS EC2/ DO Droplet images

Aside from having ufw,fail2ban, and unattended-upgrades installed, we also have the following enhancements in place:

Enhancement Description
fail2ban filter for PostgreSQL access Monitors for brute force attempts over at port 5432.
fail2ban filter for PgBouncer access Monitors for brute force attempts over at port 6543.

Additional Goodies

This is only available for our AWS EC2/ DO Droplet images

Goodie Version Description
PgBouncer 1.16.1 Set up Connection Pooling.
PostgREST v10.1.1 Instantly transform your database into an RESTful API.
WAL-G v2.0.1 Tool for physical database backup and recovery.

Install

See all installation instructions in the repo wiki.

Docker Digital Ocean AWS

Marketplace Images

Postgres & Extensions PgBouncer PostgREST WAL-G
Supabase Postgres ✔️ ✔️
Supabase Postgres: PgBouncer Bundle ✔️ ✔️ ✔️
Supabase Postgres: PostgREST Bundle ✔️ ✔️ ✔️
Supabase Postgres: Complete Bundle ✔️ ✔️ ✔️ ✔️

Availability

AWS ARM AWS x86 Digital Ocean x86
Supabase Postgres Coming Soon Coming Soon Coming Soon
Supabase Postgres: PgBouncer Bundle Coming Soon Coming Soon Coming Soon
Supabase Postgres: PostgREST Bundle Coming Soon Coming Soon Coming Soon
Supabase Postgres: Complete Bundle Coming Soon Coming Soon Coming Soon

Quick Build

$ time packer build -timestamp-ui \
  --var "aws_access_key=<insert aws access key>" \
  --var "aws_secret_key=<insert aws secret key>" \
  --var "ami_regions=<insert desired regions>" \
  amazon-arm.json

Motivation

  • Make it fast and simple to get started with Postgres.
  • Show off a few of Postgres' most exciting features.
  • This is the same build we offer at Supabase.

Roadmap

License

The PostgreSQL License. We realize that licensing is tricky since we are bundling all the various plugins. If we have infringed on any license, let us know and we will make the necessary changes (or remove that extension from this repo).

Sponsors

We are building the features of Firebase using enterprise-grade, open source products. We support existing communities wherever possible, and if the products don’t exist we build them and open source them ourselves.

New Sponsor

Experimental Nix Packaging of resources

There is a /nix folder in this repo, plus a flake.nix and flake.lock that facilitate using the Nix package management system to package supabase/postgres, and all of our extensions and wrappers. A user will need nix installed on their machine. As of 4/1/2024 the package set only builds on target machines (x86_64-linux and aarch64-linux), however work is under way to also support building and using directly on aarch64-darwin (macOs). As of 4/1/2024, versions of packages and extensions are synced from /ansible/vars.yml via a utility that can be run by executing nix run .#sync-exts-versions (you must have nix installed and be on the supported x86_64-linux and aarch64-linux for this command to work). The short term goal is to sync these versions as they are updated by our infrastructure and postgres teams, then to see the nix packaged versions build successfully in parallel over time, along with tests of the nix packaged versions passing.

The supabase/postgres repo will continue to source it's dependencies from ansible for the short term, while we stabilize this nix build.

Forthcoming PR's will include: integrating the nix work into our ansible/packer builds, building natively on aarch64-darwin (macOs), more testing