Skip to content

Commit 9f14f33

Browse files
committed
Merge branch 'develop' of github.com:supabase/postgres into INDATA-459
* 'develop' of github.com:supabase/postgres: feat: bump PostgREST to 14.5 (#2057) feat: bump oriole to latest (#2028) fix: bump AMI version (#2059)
2 parents c719e05 + 43d538e commit 9f14f33

10 files changed

Lines changed: 257 additions & 94 deletions

File tree

Dockerfile-orioledb-17

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,6 @@ RUN sed -i 's/ timescaledb,//g;' "/etc/postgresql/postgresql.conf" && \
157157
RUN sed -i 's/\(shared_preload_libraries.*\)'\''\(.*\)$/\1, orioledb'\''\2/' "/etc/postgresql/postgresql.conf" && \
158158
echo "default_table_access_method = 'orioledb'" >> "/etc/postgresql/postgresql.conf"
159159

160-
# OrioleDB rewind configuration
161-
# Enables time-based rewind capability for up to 20 minutes (1200 seconds)
162-
# Buffer size: 1280 buffers * 8KB = 10MB for transaction retention
163-
RUN echo "orioledb.enable_rewind = true" >> "/etc/postgresql/postgresql.conf" && \
164-
echo "orioledb.rewind_max_time = 1200" >> "/etc/postgresql/postgresql.conf" && \
165-
echo "orioledb.rewind_max_transactions = 100000" >> "/etc/postgresql/postgresql.conf" && \
166-
echo "orioledb.rewind_buffers = 1280" >> "/etc/postgresql/postgresql.conf"
167-
168160
# Include schema migrations
169161
COPY migrations/db /docker-entrypoint-initdb.d/
170162
COPY ansible/files/pgbouncer_config/pgbouncer_auth_schema.sql /docker-entrypoint-initdb.d/init-scripts/00-schema.sql

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ This is the same PostgreSQL build that powers [Supabase](https://supabase.io), b
294294
| Goodie | Version | Description |
295295
| ------------- | :-------------: | ------------- |
296296
| [PgBouncer](https://www.pgbouncer.org/) | [1.19.0](http://www.pgbouncer.org/changelog.html#pgbouncer-119x) | Set up Connection Pooling. |
297-
| [PostgREST](https://postgrest.org/en/stable/) | [v14.4](https://github.com/PostgREST/postgrest/releases/tag/v14.4) | Instantly transform your database into an RESTful API. |
297+
| [PostgREST](https://postgrest.org/en/stable/) | [v14.5](https://github.com/PostgREST/postgrest/releases/tag/v14.5) | Instantly transform your database into an RESTful API. |
298298
| [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. | -->
299299

300300

ansible/tasks/stage2-setup-postgres.yml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -52,38 +52,6 @@
5252
path: '/etc/postgresql/postgresql.conf'
5353
state: 'present'
5454

55-
- name: Enable OrioleDB rewind feature
56-
ansible.builtin.lineinfile:
57-
path: /etc/postgresql/postgresql.conf
58-
line: "orioledb.enable_rewind = true"
59-
state: present
60-
when: is_psql_oriole and stage2_nix
61-
become: yes
62-
63-
- name: Set OrioleDB rewind max time (20 minutes)
64-
ansible.builtin.lineinfile:
65-
path: /etc/postgresql/postgresql.conf
66-
line: "orioledb.rewind_max_time = 1200"
67-
state: present
68-
when: is_psql_oriole and stage2_nix
69-
become: yes
70-
71-
- name: Set OrioleDB rewind max transactions
72-
ansible.builtin.lineinfile:
73-
path: /etc/postgresql/postgresql.conf
74-
line: "orioledb.rewind_max_transactions = 100000"
75-
state: present
76-
when: is_psql_oriole and stage2_nix
77-
become: yes
78-
79-
- name: Set OrioleDB rewind buffers (1280 buffers = 10MB)
80-
ansible.builtin.lineinfile:
81-
path: /etc/postgresql/postgresql.conf
82-
line: "orioledb.rewind_buffers = 1280"
83-
state: present
84-
when: is_psql_oriole and stage2_nix
85-
become: yes
86-
8755
- name: Add ORIOLEDB_ENABLED environment variable
8856
ansible.builtin.lineinfile:
8957
line: 'ORIOLEDB_ENABLED=true'

ansible/vars.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ pgbouncer_release_checksum: sha256:6e566ae92fe3ef7f6a1b9e26d6049f7d7ca39c40e29e7
2121
# The checksum can be found under "Assets", in the GitHub release page for each version.
2222
# The binaries used are: ubuntu-aarch64 and linux-static.
2323
# https://github.com/PostgREST/postgrest/releases
24-
postgrest_release: 14.4
25-
postgrest_arm_release_checksum: sha256:5223ef63716590ea4aa7bd9f0fbec43903dad090612f4e753a8eafcba295c0a9
26-
postgrest_x86_release_checksum: sha256:3fc6e82c34a98a97df5ffafd86fbd7b9e21e03ef2d733d43e7ee6d0ce113568f
24+
postgrest_release: 14.5
25+
postgrest_arm_release_checksum: sha256:70c07ff875710538903c9b6b6de00e126250e335da25b0ff7d1b13bb4c94bf41
26+
postgrest_x86_release_checksum: sha256:ab5cc7e974d4940447991804588cfb8b3f7b2c57b691f0905df04d51ede69470
2727

2828
gotrue_release: 2.186.0
2929
gotrue_release_checksum: sha1:94cd063227e01dcc71811aa63ecdd996d0c0419c

nix/config.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ in
5656
};
5757
orioledb = {
5858
"17" = {
59-
version = "17_15";
60-
hash = "sha256-1v3FGIN0UW+E4ilLwbsV3nXvef3n9O8bVmgyjRFEJsU=";
59+
version = "17_16";
60+
hash = "sha256-Xm9IUsvmlcayNQH8TCvHoIV23xkt/WQV0Oy4CiJkywc=";
6161
};
6262
};
6363
};

nix/ext/orioledb.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ stdenv.mkDerivation rec {
1515
src = fetchFromGitHub {
1616
owner = "orioledb";
1717
repo = "orioledb";
18-
rev = "beta13";
19-
sha256 = "sha256-80RQHOgkEC7Hq3+N1VhsuKEUL+SNT/WfDN5vmXpaQG4=";
18+
rev = "982e11ae62c9e00c0d74f9f8de31d99ff383fd02";
19+
sha256 = "sha256-Vz3vfmTGRW+O9aXZxqixHC2CpqZJf/1UCQWoENbAak4=";
2020
};
21-
version = "beta13";
21+
version = "982e11ae62c9e00c0d74f9f8de31d99ff383fd02";
2222
buildInputs = [
2323
curl
2424
libkrb5
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
2727
openssl
2828
];
2929
buildPhase = ''
30-
make USE_PGXS=1 ORIOLEDB_PATCHSET_VERSION=15
30+
make USE_PGXS=1 ORIOLEDB_PATCHSET_VERSION=16
3131
'';
3232
installPhase = ''
3333
runHook preInstall

nix/ext/tests/lib.nix

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,6 @@ let
120120
# OrioleDB: append orioledb to shared_preload_libraries
121121
sed -i "s/\(shared_preload_libraries.*\)'\(.*\)$/\1, orioledb'\2/" $out/postgresql.conf
122122
echo "default_table_access_method = 'orioledb'" >> $out/postgresql.conf
123-
echo "orioledb.enable_rewind = true" >> $out/postgresql.conf
124-
echo "orioledb.rewind_max_time = 1200" >> $out/postgresql.conf
125-
echo "orioledb.rewind_max_transactions = 100000" >> $out/postgresql.conf
126-
echo "orioledb.rewind_buffers = 1280" >> $out/postgresql.conf
127123
''
128124
else
129125
""
@@ -417,6 +413,7 @@ let
417413
makeOrioledbSpecialisation =
418414
{
419415
postgresPort ? defaultPort,
416+
extraConfig ? "",
420417
}:
421418
let
422419
orioledbPkg = self.packages.${system}."psql_orioledb-17/bin";
@@ -446,35 +443,42 @@ let
446443

447444
# Runs as postgres: initdb with OrioleDB-specific args, config deployment, validation
448445
initScript = pkgs.pkgsLinux.writeShellScript "postgresql-orioledb-init" ''
449-
set -euo pipefail
450-
DATA_DIR="${newDataDir}"
451-
452-
if [ ! -f "$DATA_DIR/PG_VERSION" ]; then
453-
echo "Initializing OrioleDB database at $DATA_DIR"
454-
${orioledbPkg}/bin/initdb \
455-
--allow-group-access --data-checksums \
456-
--locale-provider=icu --encoding=UTF-8 --icu-locale=en_US.UTF-8 \
457-
-U supabase_admin -D "$DATA_DIR"
458-
fi
459-
460-
# Deploy processed config files with @dataDir@ substituted
461-
for f in postgresql.conf pg_hba.conf pg_ident.conf supautils.conf read-replica.conf; do
462-
sed "s|@dataDir@|$DATA_DIR|g" ${processedConfig}/$f > "$DATA_DIR/$f"
463-
done
464-
465-
# Copy conf.d directory
466-
rm -rf "$DATA_DIR/conf.d"
467-
cp -r ${processedConfig}/conf.d "$DATA_DIR/conf.d"
468-
chmod -R u+w "$DATA_DIR/conf.d"
469-
470-
# Copy extension-custom-scripts directory
471-
rm -rf "$DATA_DIR/extension-custom-scripts"
472-
cp -r ${processedConfig}/extension-custom-scripts "$DATA_DIR/extension-custom-scripts"
473-
chmod -R u+w "$DATA_DIR/extension-custom-scripts"
474-
475-
# Validate config
476-
echo "Validating PostgreSQL configuration..."
477-
${orioledbPkg}/bin/postgres -C shared_preload_libraries -D "$DATA_DIR"
446+
set -euo pipefail
447+
DATA_DIR="${newDataDir}"
448+
449+
if [ ! -f "$DATA_DIR/PG_VERSION" ]; then
450+
echo "Initializing OrioleDB database at $DATA_DIR"
451+
${orioledbPkg}/bin/initdb \
452+
--allow-group-access --data-checksums \
453+
--locale-provider=icu --encoding=UTF-8 --icu-locale=en_US.UTF-8 \
454+
-U supabase_admin -D "$DATA_DIR"
455+
fi
456+
457+
# Deploy processed config files with @dataDir@ substituted
458+
for f in postgresql.conf pg_hba.conf pg_ident.conf supautils.conf read-replica.conf; do
459+
sed "s|@dataDir@|$DATA_DIR|g" ${processedConfig}/$f > "$DATA_DIR/$f"
460+
done
461+
462+
# Append any extra configuration
463+
if [ -n '${extraConfig}' ]; then
464+
cat >> "$DATA_DIR/postgresql.conf" << 'EXTRA_CONFIG_EOF'
465+
${extraConfig}
466+
EXTRA_CONFIG_EOF
467+
fi
468+
469+
# Copy conf.d directory
470+
rm -rf "$DATA_DIR/conf.d"
471+
cp -r ${processedConfig}/conf.d "$DATA_DIR/conf.d"
472+
chmod -R u+w "$DATA_DIR/conf.d"
473+
474+
# Copy extension-custom-scripts directory
475+
rm -rf "$DATA_DIR/extension-custom-scripts"
476+
cp -r ${processedConfig}/extension-custom-scripts "$DATA_DIR/extension-custom-scripts"
477+
chmod -R u+w "$DATA_DIR/extension-custom-scripts"
478+
479+
# Validate config
480+
echo "Validating PostgreSQL configuration..."
481+
${orioledbPkg}/bin/postgres -C shared_preload_libraries -D "$DATA_DIR"
478482
'';
479483

480484
# Full db init: CREATE EXTENSION orioledb first, then init-scripts + migrations
@@ -549,6 +553,7 @@ let
549553
};
550554

551555
# Override postgresql: new package, new data dir, new ExecStartPre for orioledb initdb
556+
# Restart settings match production: ansible/files/postgresql_config/postgresql.service
552557
systemd.services.postgresql = {
553558
after = [ "postgresql-migrate.service" ];
554559
requires = [ "postgresql-migrate.service" ];
@@ -558,6 +563,8 @@ let
558563
initScript
559564
];
560565
ExecStart = lib.mkForce "${orioledbPkg}/bin/postgres -D ${newDataDir}";
566+
Restart = "always";
567+
RestartSec = "5";
561568
};
562569
environment = {
563570
GRN_PLUGINS_DIR = lib.mkForce "${groongaPackage}/lib/groonga/plugins";

0 commit comments

Comments
 (0)