Skip to content

Commit 97330e8

Browse files
authored
Merge branch 'develop' into sam/oriole17-flake-check
2 parents 0a96d38 + 82b96e0 commit 97330e8

File tree

7 files changed

+160
-9
lines changed

7 files changed

+160
-9
lines changed

.github/workflows/dockerhub-release-matrix.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- release/*
88
paths:
99
- ".github/workflows/dockerhub-release-matrix.yml"
10+
- "ansible/vars.yml"
1011
workflow_dispatch:
1112

1213
jobs:

ansible/files/envoy_config/lds.supabase.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,25 @@ resources:
8282
name: ':path'
8383
string_match:
8484
contains: apikey=supabase_admin_key
85+
origin_protection_key_missing:
86+
permissions:
87+
- any: true
88+
principals:
89+
- not_id:
90+
header:
91+
name: sb-opk
92+
present_match: true
93+
origin_protection_key_not_valid:
94+
permissions:
95+
- any: true
96+
principals:
97+
- not_id:
98+
or_ids:
99+
ids:
100+
- header:
101+
name: sb-opk
102+
string_match:
103+
exact: supabase_origin_protection_key
85104
- name: envoy.filters.http.lua
86105
typed_config:
87106
'@type': >-

ansible/files/postgresql_config/supautils.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ supautils.privileged_extensions = 'address_standardizer, address_standardizer_da
88
supautils.privileged_extensions_custom_scripts_path = '/etc/postgresql-custom/extension-custom-scripts'
99
supautils.privileged_extensions_superuser = 'supabase_admin'
1010
supautils.privileged_role = 'postgres'
11-
supautils.privileged_role_allowed_configs = 'auto_explain.log_min_duration, auto_explain.log_nested_statements, log_lock_waits, log_min_messages, log_temp_files, pg_net.batch_size, pg_net.ttl, pgaudit.log, pgaudit.log_catalog, pgaudit.log_client, pgaudit.log_level, pgaudit.log_relation, pgaudit.log_rows, pgaudit.log_statement, pgaudit.log_statement_once, pgaudit.role, pgrst.*, plan_filter.*, safeupdate.enabled, session_replication_role, track_io_timing'
11+
supautils.privileged_role_allowed_configs = 'auto_explain.log_min_duration, auto_explain.log_nested_statements, log_lock_waits, log_min_duration_statement, log_min_messages, log_statement, log_temp_files, pg_net.batch_size, pg_net.ttl, pgaudit.log, pgaudit.log_catalog, pgaudit.log_client, pgaudit.log_level, pgaudit.log_relation, pgaudit.log_rows, pgaudit.log_statement, pgaudit.log_statement_once, pgaudit.role, pgrst.*, pg_stat_statements.*, plan_filter.*, safeupdate.enabled, session_replication_role, track_io_timing, wal_compression'
1212
supautils.reserved_memberships = 'pg_read_server_files, pg_write_server_files, pg_execute_server_program, supabase_admin, supabase_auth_admin, supabase_storage_admin, supabase_read_only_user, supabase_realtime_admin, supabase_replication_admin, dashboard_user, pgbouncer, authenticator'
1313
supautils.reserved_roles = 'supabase_admin, supabase_auth_admin, supabase_storage_admin, supabase_read_only_user, supabase_realtime_admin, supabase_replication_admin, dashboard_user, pgbouncer, service_role*, authenticator*, authenticated*, anon*'

ansible/files/postgresql_extension_custom_scripts/pgmq/after-create.sql

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,137 @@ declare
66
begin
77

88
set local search_path = '';
9+
10+
/*
11+
Override the pgmq.drop_queue to check if relevant tables are owned
12+
by the pgmq extension before attempting to run
13+
`alter extension pgmq drop table ...`
14+
this is necessary becasue, to enable nightly logical backups to include user queues
15+
we automatically detach them from pgmq.
16+
17+
this update is backwards compatible with version 1.4.4 but should be removed once we're on
18+
physical backups everywhere
19+
*/
20+
-- Detach and delete the official function
21+
alter extension pgmq drop function pgmq.drop_queue;
22+
drop function pgmq.drop_queue;
23+
24+
-- Create and reattach the patched function
25+
CREATE FUNCTION pgmq.drop_queue(queue_name TEXT)
26+
RETURNS BOOLEAN AS $func$
27+
DECLARE
28+
qtable TEXT := pgmq.format_table_name(queue_name, 'q');
29+
qtable_seq TEXT := qtable || '_msg_id_seq';
30+
fq_qtable TEXT := 'pgmq.' || qtable;
31+
atable TEXT := pgmq.format_table_name(queue_name, 'a');
32+
fq_atable TEXT := 'pgmq.' || atable;
33+
partitioned BOOLEAN;
34+
BEGIN
35+
EXECUTE FORMAT(
36+
$QUERY$
37+
SELECT is_partitioned FROM pgmq.meta WHERE queue_name = %L
38+
$QUERY$,
39+
queue_name
40+
) INTO partitioned;
41+
42+
-- NEW CONDITIONAL CHECK
43+
if exists (
44+
select 1
45+
from pg_class c
46+
join pg_depend d on c.oid = d.objid
47+
join pg_extension e on d.refobjid = e.oid
48+
where c.relname = qtable and e.extname = 'pgmq'
49+
) then
50+
51+
EXECUTE FORMAT(
52+
$QUERY$
53+
ALTER EXTENSION pgmq DROP TABLE pgmq.%I
54+
$QUERY$,
55+
qtable
56+
);
57+
58+
end if;
59+
60+
-- NEW CONDITIONAL CHECK
61+
if exists (
62+
select 1
63+
from pg_class c
64+
join pg_depend d on c.oid = d.objid
65+
join pg_extension e on d.refobjid = e.oid
66+
where c.relname = qtable_seq and e.extname = 'pgmq'
67+
) then
68+
EXECUTE FORMAT(
69+
$QUERY$
70+
ALTER EXTENSION pgmq DROP SEQUENCE pgmq.%I
71+
$QUERY$,
72+
qtable_seq
73+
);
74+
75+
end if;
76+
77+
-- NEW CONDITIONAL CHECK
78+
if exists (
79+
select 1
80+
from pg_class c
81+
join pg_depend d on c.oid = d.objid
82+
join pg_extension e on d.refobjid = e.oid
83+
where c.relname = atable and e.extname = 'pgmq'
84+
) then
85+
86+
EXECUTE FORMAT(
87+
$QUERY$
88+
ALTER EXTENSION pgmq DROP TABLE pgmq.%I
89+
$QUERY$,
90+
atable
91+
);
92+
93+
end if;
94+
95+
-- NO CHANGES PAST THIS POINT
96+
97+
EXECUTE FORMAT(
98+
$QUERY$
99+
DROP TABLE IF EXISTS pgmq.%I
100+
$QUERY$,
101+
qtable
102+
);
103+
104+
EXECUTE FORMAT(
105+
$QUERY$
106+
DROP TABLE IF EXISTS pgmq.%I
107+
$QUERY$,
108+
atable
109+
);
110+
111+
IF EXISTS (
112+
SELECT 1
113+
FROM information_schema.tables
114+
WHERE table_name = 'meta' and table_schema = 'pgmq'
115+
) THEN
116+
EXECUTE FORMAT(
117+
$QUERY$
118+
DELETE FROM pgmq.meta WHERE queue_name = %L
119+
$QUERY$,
120+
queue_name
121+
);
122+
END IF;
123+
124+
IF partitioned THEN
125+
EXECUTE FORMAT(
126+
$QUERY$
127+
DELETE FROM %I.part_config where parent_table in (%L, %L)
128+
$QUERY$,
129+
pgmq._get_pg_partman_schema(), fq_qtable, fq_atable
130+
);
131+
END IF;
132+
133+
RETURN TRUE;
134+
END;
135+
$func$ LANGUAGE plpgsql;
136+
137+
alter extension pgmq add function pgmq.drop_queue;
138+
139+
9140
update pg_extension set extowner = 'postgres'::regrole where extname = 'pgmq';
10141

11142
for r in (select * from pg_depend where refobjid = extoid) loop

ansible/vars.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ postgrest_release: "12.2.3"
2222
postgrest_arm_release_checksum: sha1:fbfd6613d711ce1afa25c42d5df8f1b017f396f9
2323
postgrest_x86_release_checksum: sha1:61c513f91a8931be4062587b9d4a18b42acf5c05
2424

25-
gotrue_release: 2.167.0
26-
gotrue_release_checksum: sha1:087553ffd442a050e716f3aae5f12ae716f44ae5
25+
gotrue_release: 2.168.0
26+
gotrue_release_checksum: sha1:c303e004f59a58f7cbefda6fa669fc77deabe8e6
2727

2828
aws_cli_release: "2.2.7"
2929

@@ -137,7 +137,7 @@ groonga_release_checksum: sha256:1c2d1a6981c1ad3f02a11aff202b15ba30cb1c6147f1fa9
137137
pgroonga_release: "3.0.7"
138138
pgroonga_release_checksum: sha256:885ff3878cc30e9030e5fc56d561bc8b66df3ede1562c9d802bc0ea04fe5c203
139139

140-
wrappers_release: "0.4.3"
140+
wrappers_release: "0.4.4"
141141

142142
hypopg_release: "1.4.1"
143143
hypopg_release_checksum: sha256:9afe6357fd389d8d33fad81703038ce520b09275ec00153c6c89282bcdedd6bc

nix/ext/pg_repack.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ stdenv.mkDerivation (finalAttrs: {
1818
src = fetchFromGitHub {
1919
owner = "reorg";
2020
repo = "pg_repack";
21-
rev = "85b64c6d4f599b2988343c4e7121acab505c9006";
22-
hash = "sha256-lAuLI+vupusvn3uTzQ9OaLqkEfUVMCAwU9R70tTbb8Y=";
21+
rev = "ver_${finalAttrs.version}";
22+
hash = "sha256-wfjiLkx+S3zVrAynisX1GdazueVJ3EOwQEPcgUQt7eA=";
2323
};
2424

2525
installPhase = ''

nix/ext/wrappers/default.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ let
1717
in
1818
buildPgrxExtension_0_12_6 rec {
1919
pname = "supabase-wrappers";
20-
version = "0.4.3";
20+
version = "0.4.4";
2121
# update the following array when the wrappers version is updated
2222
# required to ensure that extensions update scripts from previous versions are generated
23-
previousVersions = ["0.4.2" "0.4.1" "0.4.0" "0.3.1" "0.3.0" "0.2.0" "0.1.19" "0.1.18" "0.1.17" "0.1.16" "0.1.15" "0.1.14" "0.1.12" "0.1.11" "0.1.10" "0.1.9" "0.1.8" "0.1.7" "0.1.6" "0.1.5" "0.1.4" "0.1.1" "0.1.0"];
23+
previousVersions = ["0.4.3" "0.4.2" "0.4.1" "0.4.0" "0.3.1" "0.3.0" "0.2.0" "0.1.19" "0.1.18" "0.1.17" "0.1.16" "0.1.15" "0.1.14" "0.1.12" "0.1.11" "0.1.10" "0.1.9" "0.1.8" "0.1.7" "0.1.6" "0.1.5" "0.1.4" "0.1.1" "0.1.0"];
2424
inherit postgresql;
2525
src = fetchFromGitHub {
2626
owner = "supabase";
2727
repo = "wrappers";
2828
rev = "v${version}";
29-
hash = "sha256-CkoNMoh40zbQL4V49ZNYgv3JjoNWjODtTpHn+L8DdZA=";
29+
hash = "sha256-QoGFJpq8PuvMM8SS+VZd7MlNl56uFivRjs1tCtwX+oE=";
3030
};
3131

3232
nativeBuildInputs = [ pkg-config cargo git ];

0 commit comments

Comments
 (0)