Skip to content

Commit a18fa2d

Browse files
authored
fix: rebuild orioledb base image (#836)
* fix: rebuild orioledb base image * chore: bump orioledb release version * feat: support disabling s3 backend
1 parent a3938dc commit a18fa2d

File tree

3 files changed

+26
-20
lines changed

3 files changed

+26
-20
lines changed

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.147"
1+
postgres-version = "15.1.0.148"

docker/orioledb/Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,13 +1007,16 @@ COPY ansible/files/walg_helper_scripts/wal_change_ownership.sh /root/wal_change_
10071007
RUN sed -i \
10081008
-e "s|#unix_socket_directories = '/tmp'|unix_socket_directories = '/var/run/postgresql'|g" \
10091009
-e "s|#session_preload_libraries = ''|session_preload_libraries = 'supautils'|g" \
1010-
-e "s|shared_preload_libraries = '\(.*\)'|shared_preload_libraries = '\1, orioledb'|" \
1010+
-e "s|shared_preload_libraries = '\(.*\)'|shared_preload_libraries = '\1, orioledb'|g" \
1011+
-e "s|#max_wal_size = 1GB|max_wal_size = 8GB|g" \
10111012
-e "s|#include = '/etc/postgresql-custom/supautils.conf'|include = '/etc/postgresql-custom/supautils.conf'|g" \
10121013
-e "s|#include = '/etc/postgresql-custom/wal-g.conf'|include = '/etc/postgresql-custom/wal-g.conf'|g" /etc/postgresql/postgresql.conf && \
10131014
echo "cron.database_name = 'postgres'" >> /etc/postgresql/postgresql.conf && \
10141015
echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \
10151016
echo "pgsodium.getkey_script= '/usr/lib/postgresql/${postgresql_major}/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
10161017
echo 'auto_explain.log_min_duration = 10s' >> /etc/postgresql/postgresql.conf && \
1018+
echo "orioledb.main_buffers = 1GB" >> /etc/postgresql/postgresql.conf && \
1019+
echo "orioledb.undo_buffers = 256MB" >> /etc/postgresql/postgresql.conf && \
10171020
useradd --create-home --shell /bin/bash wal-g -G postgres && \
10181021
mkdir -p /etc/postgresql-custom && \
10191022
chown postgres:postgres /etc/postgresql-custom
@@ -1027,11 +1030,10 @@ COPY ansible/files/stat_extension.sql /docker-entrypoint-initdb.d/migrations/00-
10271030
RUN sed -i \
10281031
-e "s|su-exec|gosu|g" \
10291032
-e "s|PGHOST= PGHOSTADDR=|PGHOST=\$POSTGRES_HOST|g" \
1030-
/usr/local/bin/docker-entrypoint.sh
1033+
/usr/local/bin/docker-entrypoint.sh && \
1034+
mv /usr/local/bin/docker-entrypoint.sh /usr/local/bin/orioledb-entrypoint.sh
10311035

1032-
# TODO: support s3 credentials once upstream is tested
1033-
# COPY docker/orioledb/entrypoint.sh /
1034-
# ENTRYPOINT ["/entrypoint.sh"]
1036+
COPY docker/orioledb/entrypoint.sh /usr/local/bin/docker-entrypoint.sh
10351037

10361038
HEALTHCHECK --interval=2s --timeout=2s --retries=10 CMD pg_isready -U postgres -h localhost
10371039
STOPSIGNAL SIGINT

docker/orioledb/entrypoint.sh

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,34 @@ set -eou pipefail
33

44
PG_CONF=/etc/postgresql/postgresql.conf
55

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"
6+
if [ "${S3_ENABLED:-}" == "true" ]; then
7+
echo "Enabling OrioleDB S3 Backend..."
148

159
echo "
10+
archive_mode = on
1611
archive_library = 'orioledb'
17-
orioledb.main_buffers = 1GB
18-
orioledb.undo_buffers = 256MB
12+
max_worker_processes = 50 # should fit orioledb.s3_num_workers as long as other workers
1913
orioledb.s3_num_workers = 20 # should be enough for comfortable work
2014
orioledb.s3_mode = true
2115
orioledb.s3_host = '$S3_HOST' # replace with your bucket URL, accelerated buckets are recommended
2216
orioledb.s3_region = '$S3_REGION' # replace with your S3 region
2317
orioledb.s3_accesskey = '$S3_ACCESS_KEY' # replace with your S3 key
2418
orioledb.s3_secretkey = '$S3_SECRET_KEY' # replace with your S3 secret key
2519
" >> "$PG_CONF"
26-
}
20+
else
21+
echo "Disabling OrioleDB S3 Backend..."
2722

28-
if ! grep -q orioledb "$PG_CONF"; then
29-
configure_orioledb
23+
sed -i \
24+
-e "/^archive_mode = on/d" \
25+
-e "/^archive_library = 'orioledb'/d" \
26+
-e "/^max_worker_processes = 50/d" \
27+
-e "/^orioledb.s3_num_workers = /d" \
28+
-e "/^orioledb.s3_mode = /d" \
29+
-e "/^orioledb.s3_host = /d" \
30+
-e "/^orioledb.s3_region = /d" \
31+
-e "/^orioledb.s3_accesskey = /d" \
32+
-e "/^orioledb.s3_secretkey = /d" \
33+
"$PG_CONF"
3034
fi
3135

32-
docker-entrypoint.sh "$@"
36+
orioledb-entrypoint.sh "$@"

0 commit comments

Comments
 (0)