Skip to content

Commit 32c047e

Browse files
authored
Merge branch 'develop' into PSQL-773
2 parents 365fa48 + 7f6e525 commit 32c047e

20 files changed

+345
-71
lines changed

.github/workflows/ami-release-nix.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
GIT_SHA=${{github.sha}}
9797
nix run github:supabase/postgres/${GIT_SHA}#packer -- init amazon-arm64-nix.pkr.hcl
9898
# why is postgresql_major defined here instead of where the _three_ other postgresql_* variables are defined?
99-
nix run github:supabase/postgres/${GIT_SHA}#packer -- build -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${EXECUTION_ID}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" -var "ansible_arguments=-e postgresql_major=${POSTGRES_MAJOR_VERSION}" amazon-arm64-nix.pkr.hcl
99+
nix run github:supabase/postgres/${GIT_SHA}#packer -- build -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${EXECUTION_ID}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" -var "ansible_arguments=-e postgresql_major=${POSTGRES_MAJOR_VERSION}" -var "region=us-east-1" -var 'ami_regions=["us-east-1"]' amazon-arm64-nix.pkr.hcl
100100
101101
- name: Build AMI stage 2
102102
env:
@@ -105,7 +105,7 @@ jobs:
105105
GIT_SHA=${{github.sha}}
106106
nix run github:supabase/postgres/${GIT_SHA}#packer -- init stage2-nix-psql.pkr.hcl
107107
POSTGRES_MAJOR_VERSION=${{ env.POSTGRES_MAJOR_VERSION }}
108-
nix run github:supabase/postgres/${GIT_SHA}#packer -- build -var "git_sha=${GIT_SHA}" -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${EXECUTION_ID}" -var "postgres_major_version=${POSTGRES_MAJOR_VERSION}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" stage2-nix-psql.pkr.hcl
108+
nix run github:supabase/postgres/${GIT_SHA}#packer -- build -var "git_sha=${GIT_SHA}" -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${EXECUTION_ID}" -var "postgres_major_version=${POSTGRES_MAJOR_VERSION}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" -var "region=us-east-1" -var 'ami_regions=["us-east-1"]' stage2-nix-psql.pkr.hcl
109109
110110
- name: Grab release version
111111
id: process_release_version
@@ -184,9 +184,9 @@ jobs:
184184
- name: Cleanup resources after build
185185
if: ${{ always() }}
186186
run: |
187-
aws ec2 describe-instances --filters "Name=tag:packerExecutionId,Values=${EXECUTION_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -r aws ec2 terminate-instances --instance-ids
187+
aws ec2 --region us-east-1 describe-instances --filters "Name=tag:packerExecutionId,Values=${EXECUTION_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -r aws ec2 terminate-instances --region us-east-1 --instance-ids
188188
189189
- name: Cleanup resources on build cancellation
190190
if: ${{ cancelled() }}
191191
run: |
192-
aws ec2 describe-instances --filters "Name=tag:packerExecutionId,Values=${EXECUTION_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -r aws ec2 terminate-instances --instance-ids
192+
aws ec2 --region us-east-1 describe-instances --filters "Name=tag:packerExecutionId,Values=${EXECUTION_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -r aws ec2 terminate-instances --region us-east-1 --instance-ids

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
outputs:
2121
matrix_config: ${{ steps.set-matrix.outputs.matrix_config }}
2222
steps:
23-
- uses: ./.github/actions/nix-install-ephemeral
2423
- name: Checkout Repo
2524
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
25+
- uses: ./.github/actions/nix-install-ephemeral
2626
- name: Generate build matrix
2727
id: set-matrix
2828
run: |

.github/workflows/qemu-image-build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ jobs:
4848
- name: Checkout Repo
4949
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
5050

51-
- uses: ./.github/actions/nix-install-ephemeral
52-
5351
- name: Run checks if triggered manually
5452
if: ${{ github.event_name == 'workflow_dispatch' }}
5553
run: |

ansible/files/envoy_config/lds.supabase.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ resources:
394394
'@type': >-
395395
type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
396396
common_tls_context:
397+
alpn_protocols: [ "h2,http/1.1" ]
397398
tls_certificates:
398399
- certificate_chain:
399400
filename: /etc/envoy/fullChain.pem

ansible/files/envoy_config/lds.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ resources:
438438
'@type': >-
439439
type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
440440
common_tls_context:
441+
alpn_protocols: [ "h2,http/1.1" ]
441442
tls_certificates:
442443
- certificate_chain:
443444
filename: /etc/envoy/fullChain.pem

ansible/files/postgresql_config/supautils.conf.j2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ supautils.privileged_role = 'postgres'
1313
supautils.privileged_role_allowed_configs = 'auto_explain.*, log_lock_waits, log_min_duration_statement, log_min_messages, log_parameter_max_length, log_replication_commands, log_statement, log_temp_files, pg_net.batch_size, pg_net.ttl, pg_stat_statements.*, 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, wal_compression'
1414
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, supabase_etl_admin, dashboard_user, pgbouncer, authenticator'
1515
supautils.reserved_roles = 'supabase_admin, supabase_auth_admin, supabase_storage_admin, supabase_read_only_user, supabase_realtime_admin, supabase_replication_admin, supabase_etl_admin, dashboard_user, pgbouncer, service_role*, authenticator*, authenticated*, anon*'
16-
supautils.disable_program = 'true'

ansible/vars.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ postgres_major:
1010

1111
# Full version strings for each major version
1212
postgres_release:
13-
postgresorioledb-17: "17.5.1.065-orioledb"
14-
postgres17: "17.6.1.044"
15-
postgres15: "15.14.1.044"
13+
postgresorioledb-17: "17.5.1.070-orioledb"
14+
postgres17: "17.6.1.049"
15+
postgres15: "15.14.1.049"
1616

1717
# Non Postgres Extensions
1818
pgbouncer_release: 1.19.0
@@ -54,7 +54,7 @@ postgres_exporter_release_checksum:
5454
amd64: sha256:cb89fc5bf4485fb554e0d640d9684fae143a4b2d5fa443009bd29c59f9129e84
5555

5656
adminapi_release: "0.93.0"
57-
adminmgr_release: "0.32.1"
57+
adminmgr_release: "0.32.3"
5858
supabase_admin_agent_release: 1.4.38
5959
supabase_admin_agent_splay: 30s
6060

nix/ext/pg_plan_filter.nix

Lines changed: 72 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,87 @@
11
{
2+
pkgs,
23
lib,
34
stdenv,
45
fetchFromGitHub,
56
postgresql,
7+
makeWrapper,
68
}:
79

8-
stdenv.mkDerivation rec {
9-
pname = "pg_plan_filter";
10-
version = "5081a7b5cb890876e67d8e7486b6a64c38c9a492";
10+
let
11+
pname = "plan_filter";
12+
build =
13+
version: rev: hash:
14+
stdenv.mkDerivation rec {
15+
inherit pname version;
1116

12-
buildInputs = [ postgresql ];
17+
buildInputs = [ postgresql ];
1318

14-
src = fetchFromGitHub {
15-
owner = "pgexperts";
16-
repo = pname;
17-
rev = "${version}";
18-
hash = "sha256-YNeIfmccT/DtOrwDmpYFCuV2/P6k3Zj23VWBDkOh6sw=";
19-
};
19+
src = fetchFromGitHub {
20+
owner = "pgexperts";
21+
repo = pname;
22+
inherit rev hash;
23+
};
24+
25+
installPhase = ''
26+
runHook preInstall
27+
28+
mkdir -p $out/share/postgresql/extension
29+
30+
# Install versioned library
31+
install -Dm755 ${pname}${postgresql.dlSuffix} $out/lib/${pname}-${version}${postgresql.dlSuffix}
32+
33+
if [[ "${version}" == "${latestVersion}" ]]; then
34+
cp *.sql $out/share/postgresql/extension/
35+
fi
36+
37+
runHook postInstall
38+
'';
2039

21-
installPhase = ''
22-
mkdir -p $out/{lib,share/postgresql/extension}
40+
meta = with lib; {
41+
description = "Filter PostgreSQL statements by execution plans";
42+
homepage = "https://github.com/pgexperts/${pname}";
43+
platforms = postgresql.meta.platforms;
44+
license = licenses.postgresql;
45+
};
46+
};
47+
allVersions = (builtins.fromJSON (builtins.readFile ./versions.json)).pg_plan_filter;
48+
supportedVersions = lib.filterAttrs (
49+
_: value: builtins.elem (lib.versions.major postgresql.version) value.postgresql
50+
) allVersions;
51+
versions = lib.naturalSort (lib.attrNames supportedVersions);
52+
latestVersion = lib.last versions;
53+
numberOfVersions = builtins.length versions;
54+
packages = builtins.attrValues (
55+
lib.mapAttrs (name: value: build name value.rev value.hash) supportedVersions
56+
);
57+
in
58+
pkgs.buildEnv {
59+
name = pname;
60+
paths = packages;
61+
nativeBuildInputs = [ makeWrapper ];
62+
pathsToLink = [
63+
"/lib"
64+
"/share/postgresql/extension"
65+
];
66+
postBuild = ''
67+
ln -sfn ${pname}-${latestVersion}${postgresql.dlSuffix} $out/lib/${pname}${postgresql.dlSuffix}
2368
24-
cp *${postgresql.dlSuffix} $out/lib
25-
cp *.sql $out/share/postgresql/extension
69+
# checks
70+
(set -x
71+
test "$(ls -A $out/lib/${pname}*${postgresql.dlSuffix} | wc -l)" = "${
72+
toString (numberOfVersions + 1)
73+
}"
74+
)
2675
'';
2776

28-
meta = with lib; {
29-
description = "Filter PostgreSQL statements by execution plans";
30-
homepage = "https://github.com/pgexperts/${pname}";
31-
platforms = postgresql.meta.platforms;
32-
license = licenses.postgresql;
77+
passthru = {
78+
inherit versions numberOfVersions;
79+
pname = "${pname}-all";
80+
defaultSettings = {
81+
shared_preload_libraries = [ "plan_filter" ];
82+
};
83+
pgRegressTestName = "pg_plan_filter";
84+
version =
85+
"multi-" + lib.concatStringsSep "-" (map (v: lib.replaceStrings [ "." ] [ "-" ] v) versions);
3386
};
3487
}

nix/ext/supautils.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77

88
stdenv.mkDerivation rec {
99
pname = "supautils";
10-
version = "3.0.2";
10+
version = "3.0.1";
1111

1212
buildInputs = [ postgresql ];
1313

1414
src = fetchFromGitHub {
1515
owner = "supabase";
1616
repo = pname;
1717
rev = "refs/tags/v${version}";
18-
hash = "sha256-WTLZShBFVgb18vVi15TSZvtJrNUFgQa6mBkavvRSoUE=";
18+
hash = "sha256-j0iASDzmcZRLbHaS9ZNRWwzii7mcC+8wYHM0/mOLkbs=";
1919
};
2020

2121
installPhase = ''

nix/ext/tests/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ builtins.listToAttrs (
224224
"pgaudit"
225225
"pg_tle"
226226
"vector"
227+
"wal2json"
227228
"wrappers"
228229
]
229230
)

0 commit comments

Comments
 (0)