跳到主要内容

Supabase PostgreSQL Image

# 注意 superuser 为 supabase_admin 密码和 postgres 相同
# 建议登录为 supabase_admin 然后 alter user postgres with superuser
PASSWORD=$(uuidgen | tr -d '[[:space:]]')
docker run -d --restart=always \
-e POSTGRES_PASSWORD=$PASSWORD \
-p 5432:5432 \
-e POSTGRES_INITDB_ARGS="--encoding=UTF-8 --lc-collate=C --lc-ctype=C" \
-v /data/postgres/data:/var/lib/postgresql/data \
--name postgres supabase/postgres:15.1.1.33 \
-clisten_addresses=* \
-cshared_preload_libraries=pg_stat_statements,pg_stat_monitor,pgaudit,plpgsql,plpgsql_check,pg_cron,pg_net,timescaledb,auto_explain,pg_tle
unix_socket_directories = '/var/run/postgresql'
session_preload_libraries = 'supautils'
include = '/etc/postgresql-custom/supautils.conf'
cron.database_name = 'postgres'
pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'
pgsodium.getkey_script= '/usr/lib/postgresql/${postgresql_major}/bin/pgsodium_getkey.sh'
auto_explain.log_min_duration = 10s

Extensions

ExtensionDescription
Postgres contrib modulespg_stat_statements
PostGISGIS
pgRoutingExtension of PostGIS - provides geospatial routing functionalities.
pgTAPUnit Testing for Postgres.
pg_cronRun CRON jobs inside Postgres.
pgAuditGenerate highly compliant audit logs.
pgjwtGenerate JSON Web Tokens (JWT) in Postgres.
pgsql-httpHTTP client for Postgres.
plpgsql_checkLinter tool for PL/pgSQL.
pg-safeupdateProtect your data from accidental updates or deletes.
wal2jsonJSON output plugin for logical replication decoding.
PL/JavaPL/Java
plv8PL/Javascript
pg_plan_filterOnly allow statements that fulfill set criteria to be executed.
pg_netExpose the SQL interface for async networking.
rumAn alternative to the GIN index.
pg_hashidsGenerate unique identifiers from numbers.
pgsodiumlibsodium
pg_stat_monitorQuery Performance Monitoring
pgvectorvector similarity search
pg_repackTool to remove bloat from tables and indexes
pg_jsonschema
pg_graphql
sfcgal
timescaledb
vault
wrappersFDW dev kit by Supabase
pgroonga
hypopg
pg_tletrusted language extensions
supautils
pllsPL/LiveScript
create extension if not exists pg_hashids;
-- id_encode, id_decode
select id_encode(1234567, 'This is my salt', /*min length*/ 10, /* alphabet */ 'abcdefghijABCDxFGHIJ1234567890');

FAQ

You might want to create it and/or set "pgsodium.getkey_script" to the correct path.

pgsodium.getkey_script='/usr/lib/postgresql/${postgresql_major}/bin/pgsodium_getkey.sh'