Skip to content

Commit 080af08

Browse files
committed
Merge branch 'develop' of github.com:supabase/postgres into drag/async_commence_backup
2 parents 04be250 + 074a2ec commit 080af08

File tree

15 files changed

+137
-36
lines changed

15 files changed

+137
-36
lines changed

.github/workflows/publish-nix-pgupgrade-scripts.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ jobs:
7272
id: process_release_version
7373
run: |
7474
VERSION=$(grep 'postgres-version' common-nix.vars.pkr.hcl | sed -e 's/postgres-version = "\(.*\)"/\1/g')
75+
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
76+
VERSION=${{ inputs.postgresVersion }}
77+
fi
7578
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
7679
7780
- name: Create a tarball containing pg_upgrade scripts

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Aside from having [ufw](https://help.ubuntu.com/community/UFW),[fail2ban](https:
5151
| Goodie | Version | Description |
5252
| ------------- | :-------------: | ------------- |
5353
| [PgBouncer](https://www.pgbouncer.org/) | [1.16.1](http://www.pgbouncer.org/changelog.html#pgbouncer-116x) | Set up Connection Pooling. |
54-
| [PostgREST](https://postgrest.org/en/stable/) | [v10.1.1](https://github.com/PostgREST/postgrest/releases/tag/v10.1.1) | Instantly transform your database into an RESTful API. |
54+
| [PostgREST](https://postgrest.org/en/stable/) | [v12.2.3](https://github.com/PostgREST/postgrest/releases/tag/v12.2.3) | Instantly transform your database into an RESTful API. |
5555
| [WAL-G](https://github.com/wal-g/wal-g#wal-g) | [v2.0.1](https://github.com/wal-g/wal-g/releases/tag/v2.0.1) | Tool for physical database backup and recovery. |
5656

5757
## Install

ansible/files/admin_api_scripts/pg_upgrade_scripts/common.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ begin
356356
end
357357
, case when rec.grantee = 'postgres'::regrole then 'supabase_admin'
358358
when rec.grantee = 'supabase_admin'::regrole then 'postgres'
359-
else rec.grantee::regrole
359+
when rec.grantee = 0 then 'public'
360+
else rec.grantee::regrole::text
360361
end
361362
));
362363
end if;
@@ -382,7 +383,7 @@ begin
382383
when obj->>'objtype' = 'T' then 'types'
383384
when obj->>'objtype' = 'n' then 'schemas'
384385
end
385-
, rec.grantee::regrole
386+
, case when rec.grantee = 0 then 'public' else rec.grantee::regrole::text end
386387
, case when rec.is_grantable then 'with grant option' else '' end
387388
));
388389
end if;
@@ -529,7 +530,14 @@ $$;
529530
alter database postgres connection limit -1;
530531
531532
-- #incident-2024-09-12-project-upgrades-are-temporarily-disabled
532-
grant pg_read_all_data, pg_signal_backend to postgres;
533+
do $$
534+
begin
535+
if exists (select from pg_authid where rolname = 'pg_read_all_data') then
536+
execute('grant pg_read_all_data to postgres');
537+
end if;
538+
end
539+
$$;
540+
grant pg_signal_backend to postgres;
533541
534542
set session authorization supabase_admin;
535543
drop role supabase_tmp;

ansible/vars.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ postgrest_release: "12.2.3"
1717
postgrest_arm_release_checksum: sha1:fbfd6613d711ce1afa25c42d5df8f1b017f396f9
1818
postgrest_x86_release_checksum: sha1:61c513f91a8931be4062587b9d4a18b42acf5c05
1919

20-
gotrue_release: 2.161.0
21-
gotrue_release_checksum: sha1:8e45f3511fee8f99a0b1567c73673991a0a5986c
20+
gotrue_release: 2.162.0
21+
gotrue_release_checksum: sha1:855b23bd002577290c7d42d7042ac0f5316984b1
2222

2323
aws_cli_release: "2.2.7"
2424

common-nix.vars.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.8.1.000"
1+
postgres-version = "15.8.1.001"

common.vars.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.1.1.93"
1+
postgres-version = "15.1.1.94"

docker/all-in-one/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function setup_postgres {
101101
mv /etc/postgresql.schema.sql /docker-entrypoint-initdb.d/migrations/99-schema.sql
102102

103103
tar -xzvf "$INIT_PAYLOAD_PATH" -C / ./etc/postgresql-custom/pgsodium_root.key
104-
echo "include = '/etc/postgresql-custom/postgresql-platform-defaults.conf'" >>$PG_CONF
104+
sed -i "/# Automatically generated optimizations/i # Supabase Platform Defaults\ninclude = '/etc/postgresql-custom/platform-defaults.conf'\n" $PG_CONF
105105

106106
# TODO (darora): walg enablement is temporarily performed here until changes from https://github.com/supabase/postgres/pull/639 get picked up
107107
# other things will still be needed in the future (auth_delay config)

docker/all-in-one/etc/adminapi/adminapi.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ upstream_metrics_sources:
4242
value: {{ .ProjectRef }}
4343
- name: service_type
4444
value: gotrue
45+
- name: postgrest
46+
url: "http://localhost:3001/metrics"
47+
labels_to_attach:
48+
- name: supabase_project_ref
49+
value: {{ .ProjectRef }}
50+
- name: service_type
51+
value: postgrest
4552
monitoring:
4653
disk_usage:
4754
enabled: true

docker/all-in-one/etc/postgresql-custom/postgresql-platform-defaults.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# these get imported _after_ the user specified overrides
22
row_security = on
33
wal_level = logical
4-
max_wal_senders = 10
5-
max_replication_slots = 5
64
log_connections = on
75
statement_timeout = 120000
86
jit = off

flake.nix

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
# want to have an arbitrary order, since it might matter. being
3939
# explicit is better.
4040
(import ./nix/overlays/cargo-pgrx.nix)
41-
(import ./nix/overlays/gdal-small.nix)
4241
(import ./nix/overlays/psql_16-oriole.nix)
4342

4443
];
@@ -68,15 +67,10 @@
6867
};
6968
})
7069
(import ./nix/overlays/cargo-pgrx-0-11-3.nix)
71-
# (import ./nix/overlays/postgis.nix)
72-
#(import ./nix/overlays/gdal-small.nix)
73-
7470
];
7571
};
7672
postgresql_15 = pkgs.postgresql.postgresql_15;
77-
postgresql = pkgs.postgresql.postgresql_15;
7873
sfcgal = pkgs.callPackage ./nix/ext/sfcgal/sfcgal.nix { };
79-
pg_regress = pkgs.callPackage ./nix/ext/pg_regress.nix { inherit postgresql; };
8074
supabase-groonga = pkgs.callPackage ./nix/supabase-groonga.nix { };
8175
mecab-naist-jdic = pkgs.callPackage ./nix/ext/mecab-naist-jdic/default.nix { };
8276
# Our list of PostgreSQL extensions which come from upstream Nixpkgs.
@@ -284,14 +278,41 @@
284278
# be used with 'nix build'. Don't use the names listed below; check the
285279
# name in 'nix flake show' in order to make sure exactly what name you
286280
# want.
287-
basePackages = {
281+
basePackages = let
282+
# Function to get the PostgreSQL version from the attribute name
283+
getVersion = name:
284+
let
285+
match = builtins.match "psql_([0-9]+)" name;
286+
in
287+
if match == null then null else builtins.head match;
288+
289+
# Define the available PostgreSQL versions
290+
postgresVersions = {
291+
psql_15 = makePostgres "15";
292+
# Uncomment the line below to enable PostgreSQL 16
293+
# psql_16 = makePostgres "16";
294+
# psql_orioledb_16 = makeOrioleDbPostgres "16_23" postgresql_orioledb_16;
295+
};
296+
297+
# Find the active PostgreSQL version
298+
activeVersion = getVersion (builtins.head (builtins.attrNames postgresVersions));
299+
300+
# Function to create the pg_regress package
301+
makePgRegress = version:
302+
let
303+
postgresqlPackage = pkgs."postgresql_${version}";
304+
in
305+
pkgs.callPackage ./nix/ext/pg_regress.nix {
306+
postgresql = postgresqlPackage;
307+
};
308+
309+
in
310+
postgresVersions //{
288311
supabase-groonga = supabase-groonga;
289312
# PostgreSQL versions.
290313
psql_15 = makePostgres "15";
291-
#psql_16 = makePostgres "16";
292314
#psql_orioledb_16 = makeOrioleDbPostgres "16_23" postgresql_orioledb_16;
293315
sfcgal = sfcgal;
294-
pg_regress = pg_regress;
295316
pg_prove = pkgs.perlPackages.TAPParserSourceHandlerpgTAP;
296317
postgresql_15 = pkgs.postgresql_15;
297318

@@ -319,6 +340,7 @@
319340
};
320341
mecab_naist_jdic = mecab-naist-jdic;
321342
supabase_groonga = supabase-groonga;
343+
pg_regress = makePgRegress activeVersion;
322344
# Start a version of the server.
323345
start-server =
324346
let
@@ -455,6 +477,7 @@
455477
sqlTests = ./nix/tests/smoke;
456478
pg_prove = pkgs.perlPackages.TAPParserSourceHandlerpgTAP;
457479
supabase-groonga = pkgs.callPackage ./nix/supabase-groonga.nix { };
480+
pg_regress = basePackages.pg_regress;
458481
in
459482
pkgs.runCommand "postgres-${pgpkg.version}-check-harness"
460483
{

0 commit comments

Comments
 (0)