Skip to content

Commit 7cd16dc

Browse files
authored
feat: update orioledb base image and s3 config script (#818)
1 parent 4303d8f commit 7cd16dc

File tree

4 files changed

+51
-30
lines changed

4 files changed

+51
-30
lines changed

ansible/files/postgresql_config/supautils.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# full list: address_standardizer, address_standardizer_data_us, adminpack, amcheck, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, file_fdw, fuzzystrmatch, hstore, http, hypopg, insert_username, intagg, intarray, isn, lo, ltree, moddatetime, old_snapshot, pageinspect, pg_buffercache, pg_cron, pg_freespacemap, pg_graphql, pg_hashids, pg_jsonschema, pg_net, pg_prewarm, pg_stat_monitor, pg_stat_statements, pg_surgery, pg_tle, pg_trgm, pg_visibility, pg_walinspect, pgaudit, pgcrypto, pgjwt, pgroonga, pgroonga_database, pgrouting, pgrowlocks, pgsodium, pgstattuple, pgtap, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supabase_vault, supautils, tablefunc, tcn, timescaledb, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp, vector, wrappers, xml2
22
# omitted because may be unsafe: adminpack, amcheck, file_fdw, lo, old_snapshot, pageinspect, pg_buffercache, pg_freespacemap, pg_prewarm, pg_surgery, pg_visibility, pgstattuple
33
# omitted because deprecated: intagg, xml2
4-
supautils.privileged_extensions = 'address_standardizer, address_standardizer_data_us, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, fuzzystrmatch, hstore, http, hypopg, insert_username, intarray, isn, ltree, moddatetime, pg_cron, pg_graphql, pg_hashids, pg_jsonschema, pg_net, pg_stat_monitor, pg_stat_statements, pg_tle, pg_trgm, pg_walinspect, pgaudit, pgcrypto, pgjwt, pgroonga, pgroonga_database, pgrouting, pgrowlocks, pgsodium, pgtap, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supabase_vault, supautils, tablefunc, tcn, timescaledb, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp, vector, wrappers'
4+
supautils.privileged_extensions = 'address_standardizer, address_standardizer_data_us, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, fuzzystrmatch, hstore, http, hypopg, insert_username, intarray, isn, ltree, moddatetime, pg_cron, pg_graphql, pg_hashids, pg_jsonschema, pg_net, pg_stat_monitor, pg_stat_statements, pg_tle, pg_trgm, pg_walinspect, pgaudit, pgcrypto, pgjwt, pgroonga, pgroonga_database, pgrouting, pgrowlocks, pgsodium, pgtap, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supabase_vault, supautils, tablefunc, tcn, timescaledb, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp, vector, wrappers, orioledb'
55
supautils.privileged_extensions_custom_scripts_path = '/etc/postgresql-custom/extension-custom-scripts'
66
supautils.privileged_extensions_superuser = 'supabase_admin'
77
supautils.privileged_role = 'postgres'

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.0.143"
1+
postgres-version = "15.1.0.144"

docker/orioledb/Dockerfile

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ ARG wal_g_release=2.0.1
4141
####################
4242
# Install postgres
4343
####################
44-
FROM orioledb/orioledb:beta3-s3-pg${postgresql_major}-ubuntu as base
44+
FROM orioledb/orioledb:latest-pg${postgresql_major}-ubuntu as base
4545
# Redeclare args for use in subsequent stages
4646
ARG TARGETARCH
4747
ARG postgresql_major
@@ -77,10 +77,10 @@ ARG CACHE_EPOCH
7777
FROM builder as rust-toolchain
7878
ENV PATH=/root/.cargo/bin:$PATH
7979
RUN apt-get update && apt-get install -y --no-install-recommends curl pkg-config && \
80-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --default-toolchain stable && \
81-
rustup --version && \
82-
rustc --version && \
83-
cargo --version
80+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --default-toolchain stable && \
81+
rustup --version && \
82+
rustc --version && \
83+
cargo --version
8484

8585
RUN cargo install cargo-pgrx --version 0.10.2 --locked
8686
RUN cargo pgrx init --pg${postgresql_major} $(which pg_config)
@@ -321,27 +321,11 @@ RUN tar -xvf /tmp/timescaledb.tar.gz -C /tmp && \
321321
# Build from source
322322
WORKDIR /tmp/timescaledb-${timescaledb_release}/build
323323
RUN cmake -DAPACHE_ONLY=1 ..
324-
# error: too few arguments to function ‘table_multi_insert’
324+
# error: too few arguments to function ‘table_tuple_update’
325+
# error: too few arguments to function ‘table_tuple_delete’
325326
RUN sed -i \
326-
-e "358s|^| bool *insert_indexes = NULL;|g" \
327-
-e "364s|);|, insert_indexes);|g" \
328-
-e "930s|^| bool *insert_indexes = NULL;|g" \
329-
-e "1115s|);|, insert_indexes);|g" \
330-
-e "1134s|);|, insert_indexes);|g" \
331-
../src/copy.c
332-
# error: static declaration of ‘replace_nestloop_params’ follows non-static declaration
333-
RUN sed -i \
334-
-e "48s|static ||g" \
335-
-e "943s|static ||g" \
336-
../src/import/planner.c
337-
# error: too few arguments to function ‘table_tuple_insert’
338-
RUN sed -i \
339-
-e "1672s|*/|*/ bool *insert_indexes = NULL;|g" \
340-
-e "1673s|);|, insert_indexes);|g" \
341-
-e "1971s|*/|*/ bool *insert_indexes = NULL;|g" \
342-
-e "1981s|);|, insert_indexes);|g" \
343-
-e "2559s|}|} bool *insert_indexes = NULL;|g" \
344-
-e "2567s|);|, insert_indexes);|g" \
327+
-e "1981s|);|, NULL);|g" \
328+
-e "2567s|);|, NULL);|g" \
345329
../src/nodes/hypertable_modify.c
346330
RUN --mount=type=cache,target=/ccache,from=public.ecr.aws/supabase/postgres:ccache \
347331
make -j$(nproc)
@@ -562,7 +546,7 @@ FROM rust-toolchain as pg_graphql-source
562546
ARG pg_graphql_release
563547
ARG pg_graphql_release_checksum
564548
ADD --checksum=${pg_graphql_release_checksum} \
565-
"https://github.com/supabase/pg_graphql/archive/refs/tags/v${pg_graphql_release}.tar.gz" \
549+
"https://github.com/supabase/pg_graphql/archive/refs/tags/v${pg_graphql_release}.tar.gz" \
566550
/tmp/pg_graphql.tar.gz
567551
RUN tar -xvf /tmp/pg_graphql.tar.gz -C /tmp && \
568552
rm -rf /tmp/pg_graphql.tar.gz
@@ -642,7 +626,7 @@ FROM rust-toolchain as pg_jsonschema-source
642626
ARG pg_jsonschema_release
643627
ARG pg_jsonschema_release_checksum
644628
ADD --checksum=${pg_jsonschema_release_checksum} \
645-
"https://github.com/supabase/pg_jsonschema/archive/refs/tags/v${pg_jsonschema_release}.tar.gz" \
629+
"https://github.com/supabase/pg_jsonschema/archive/refs/tags/v${pg_jsonschema_release}.tar.gz" \
646630
/tmp/pg_jsonschema.tar.gz
647631
RUN tar -xvf /tmp/pg_jsonschema.tar.gz -C /tmp && \
648632
rm -rf /tmp/pg_jsonschema.tar.gz
@@ -768,7 +752,7 @@ FROM rust-toolchain as wrappers-source
768752
ARG wrappers_release
769753
ARG wrappers_release_checksum
770754
ADD --checksum=${wrappers_release_checksum} \
771-
"https://github.com/supabase/wrappers/archive/refs/tags/v${wrappers_release}.tar.gz" \
755+
"https://github.com/supabase/wrappers/archive/refs/tags/v${wrappers_release}.tar.gz" \
772756
/tmp/wrappers.tar.gz
773757
RUN tar -xvf /tmp/wrappers.tar.gz -C /tmp && \
774758
rm -rf /tmp/wrappers.tar.gz
@@ -1023,6 +1007,7 @@ COPY ansible/files/walg_helper_scripts/wal_change_ownership.sh /root/wal_change_
10231007
RUN sed -i \
10241008
-e "s|#unix_socket_directories = '/tmp'|unix_socket_directories = '/var/run/postgresql'|g" \
10251009
-e "s|#session_preload_libraries = ''|session_preload_libraries = 'supautils'|g" \
1010+
-e "s|shared_preload_libraries = '\(.*\)'|shared_preload_libraries = '\1, orioledb'|" \
10261011
-e "s|#include = '/etc/postgresql-custom/supautils.conf'|include = '/etc/postgresql-custom/supautils.conf'|g" \
10271012
-e "s|#include = '/etc/postgresql-custom/wal-g.conf'|include = '/etc/postgresql-custom/wal-g.conf'|g" /etc/postgresql/postgresql.conf && \
10281013
echo "cron.database_name = 'postgres'" >> /etc/postgresql/postgresql.conf && \
@@ -1044,6 +1029,10 @@ RUN sed -i \
10441029
-e "s|PGHOST= PGHOSTADDR=|PGHOST=\$POSTGRES_HOST|g" \
10451030
/usr/local/bin/docker-entrypoint.sh
10461031

1032+
# TODO: support s3 credentials once upstream is tested
1033+
# COPY docker/orioledb/entrypoint.sh /
1034+
# ENTRYPOINT ["/entrypoint.sh"]
1035+
10471036
HEALTHCHECK --interval=2s --timeout=2s --retries=10 CMD pg_isready -U postgres -h localhost
10481037
STOPSIGNAL SIGINT
10491038
EXPOSE 5432

docker/orioledb/entrypoint.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
set -eou pipefail
3+
4+
PG_CONF=/etc/postgresql/postgresql.conf
5+
6+
function configure_orioledb {
7+
echo "Configuring OrioleDB..."
8+
9+
sed -i \
10+
-e "s|#max_worker_processes = .*|max_worker_processes = 50 # should fit orioledb.s3_num_workers as long as other workers|" \
11+
-e "s|#log_min_messages = .*|log_min_messages = debug1 # will log all S3 requests|" \
12+
-e "s|#archive_mode = off\(.*\)|archive_mode = on\1|" \
13+
"$PG_CONF"
14+
15+
echo "
16+
archive_library = 'orioledb'
17+
orioledb.main_buffers = 1GB
18+
orioledb.undo_buffers = 256MB
19+
orioledb.s3_num_workers = 20 # should be enough for comfortable work
20+
orioledb.s3_mode = true
21+
orioledb.s3_host = '$S3_HOST' # replace with your bucket URL, accelerated buckets are recommended
22+
orioledb.s3_region = '$S3_REGION' # replace with your S3 region
23+
orioledb.s3_accesskey = '$S3_ACCESS_KEY' # replace with your S3 key
24+
orioledb.s3_secretkey = '$S3_SECRET_KEY' # replace with your S3 secret key
25+
" >> "$PG_CONF"
26+
}
27+
28+
if ! grep -q orioledb "$PG_CONF"; then
29+
configure_orioledb
30+
fi
31+
32+
docker-entrypoint.sh "$@"

0 commit comments

Comments
 (0)