Skip to content

Commit

Permalink
Bump Spilo to 3.2-p2
Browse files Browse the repository at this point in the history
  • Loading branch information
owenthereal committed May 16, 2024
1 parent 6ab0b91 commit 3dad64f
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.spilo
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ ENV PGVERSION=${POSTGRES_BASE_VERSION} SPILO_PROVIDER=local PGUSER_SUPERUSER=pos
# Always force rebuild of this layer
ARG TIMESTAMP=1
COPY third-party/pgxman /tmp/pgxman/
RUN curl -sfL https://install.pgx.sh | sh -s -- /tmp/pgxman/pgxman_13.yaml /tmp/pgxman/pgxman_14_spilo.yaml && \
RUN curl -sfL https://install.pgx.sh | sh -s -- /tmp/pgxman/pgxman_13_spilo.yaml /tmp/pgxman/pgxman_14_spilo.yaml && \
rm -rf /tmp/pgxman
4 changes: 2 additions & 2 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ variable "SPILO_REPO" {
}

variable "SPILO_VERSION" {
default = "hydra-3.0-p1"
default = "3.2-p2"
}

variable "POSTGRES_BASE_VERSION" {
Expand Down Expand Up @@ -80,7 +80,7 @@ target "spilo" {
target "spilo_base" {
inherits = ["shared"]

context = "https://github.com/hydradatabase/spilo.git#${SPILO_VERSION}:postgres-appliance"
context = "https://github.com/zalando/spilo.git#${SPILO_VERSION}:postgres-appliance"

args = {
TIMESCALEDB = ""
Expand Down
13 changes: 10 additions & 3 deletions files/spilo/postgres-appliance/scripts/configure_spilo.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,10 @@ def get_placeholders(provider):
placeholders.setdefault('CLONE_TARGET_TIME', '')
placeholders.setdefault('CLONE_TARGET_INCLUSIVE', True)

placeholders.setdefault('LOG_GROUP_BY_DATE', False)
placeholders.setdefault('LOG_SHIP_SCHEDULE', '1 0 * * *')
placeholders.setdefault('LOG_S3_BUCKET', '')
placeholders.setdefault('LOG_S3_ENDPOINT', '')
placeholders.setdefault('LOG_TMPDIR', os.path.abspath(os.path.join(placeholders['PGROOT'], '../tmp')))
placeholders.setdefault('LOG_BUCKET_SCOPE_SUFFIX', '')

Expand Down Expand Up @@ -725,7 +727,9 @@ def get_dcs_config(config, placeholders):
config['kubernetes']['labels'] = kubernetes_labels

if not config['kubernetes'].pop('use_configmaps'):
config['kubernetes'].update({'use_endpoints': True, 'ports': [{'port': 5432, 'name': 'postgresql'}]})
config['kubernetes'].update({'use_endpoints': True,
'pod_ip': placeholders['instance_data']['ip'],
'ports': [{'port': 5432, 'name': 'postgresql'}]})
if str(config['kubernetes'].pop('bypass_api_service', None)).lower() == 'true':
config['kubernetes']['bypass_api_service'] = True
else:
Expand All @@ -749,9 +753,12 @@ def write_log_environment(placeholders):
aws_region = log_env.get('AWS_REGION')
if not aws_region:
aws_region = placeholders['instance_data']['zone'][:-1]
log_env['LOG_AWS_HOST'] = 's3.{}.amazonaws.com'.format(aws_region)

log_env['LOG_AWS_REGION'] = aws_region

log_s3_key = 'spilo/{LOG_BUCKET_SCOPE_PREFIX}{SCOPE}{LOG_BUCKET_SCOPE_SUFFIX}/log/'.format(**log_env)
if os.getenv('LOG_GROUP_BY_DATE'):
log_s3_key += '{DATE}/'
log_s3_key += placeholders['instance_data']['id']
log_env['LOG_S3_KEY'] = log_s3_key

Expand All @@ -762,7 +769,7 @@ def write_log_environment(placeholders):
if not os.path.exists(log_env['LOG_ENV_DIR']):
os.makedirs(log_env['LOG_ENV_DIR'])

for var in ('LOG_TMPDIR', 'LOG_AWS_HOST', 'LOG_S3_KEY', 'LOG_S3_BUCKET', 'PGLOG'):
for var in ('LOG_TMPDIR', 'LOG_AWS_REGION', 'LOG_S3_ENDPOINT', 'LOG_S3_KEY', 'LOG_S3_BUCKET', 'PGLOG'):
write_file(log_env[var], os.path.join(log_env['LOG_ENV_DIR'], var), True)


Expand Down
5 changes: 3 additions & 2 deletions files/spilo/postgres-appliance/scripts/post_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export PGOPTIONS="-c synchronous_commit=local -c search_path=pg_catalog"
PGVER=$(psql -d "$2" -XtAc "SELECT pg_catalog.current_setting('server_version_num')::int/10000")
if [ "$PGVER" -ge 12 ]; then RESET_ARGS="oid, oid, bigint"; fi

(echo "DO \$\$
(echo "\set ON_ERROR_STOP on"
echo "DO \$\$
BEGIN
PERFORM * FROM pg_catalog.pg_authid WHERE rolname = 'admin';
IF FOUND THEN
Expand Down Expand Up @@ -50,7 +51,7 @@ CREATE EXTENSION IF NOT EXISTS pg_auth_mon SCHEMA public;
ALTER EXTENSION pg_auth_mon UPDATE;
GRANT SELECT ON TABLE public.pg_auth_mon TO robot_zmon;
CREATE EXTENSION IF NOT EXISTS pg_cron SCHEMA public;
CREATE EXTENSION IF NOT EXISTS pg_cron SCHEMA pg_catalog;
DO \$\$
BEGIN
PERFORM 1 FROM pg_catalog.pg_proc WHERE pronamespace = 'cron'::pg_catalog.regnamespace AND proname = 'schedule' AND proargnames = '{p_schedule,p_database,p_command}';
Expand Down
8 changes: 4 additions & 4 deletions files/spilo/postgres-appliance/scripts/spilo_commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
# (min_version, max_version, shared_preload_libraries, extwlist.extensions)
extensions = {
'columnar': (13, 16, True, True),
#'timescaledb': (9.6, 14, True, True),
#'timescaledb': (9.6, 16, True, True),
'pg_cron': (9.5, 15, True, True),
'pg_stat_kcache': (9.4, 15, True, False),
'pg_partman': (9.4, 15, False, True),
'pg_stat_kcache': (9.4, 16, True, False),
'pg_partman': (9.4, 16, False, True),
'wrappers': (14, 16, False, True),
'pgsodium': (14, 16, False, True),
'supabase_vault': (14, 16, False, True)
}
if os.environ.get('ENABLE_PG_MON') == 'true':
extensions['pg_mon'] = (11, 15, True, False)
extensions['pg_mon'] = (11, 16, True, False)


def adjust_extensions(old, version, extwlist=False):
Expand Down
17 changes: 17 additions & 0 deletions third-party/pgxman/pgxman_13_spilo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
postgres:
version: "13"
extensions:
- name: "multicorn"
version: "2.4.0+b68b75c"
- name: "mysql_fdw"
version: "2.9.1"
- name: "parquet_s3_fdw"
version: "1.0.0+5298b7f"
- name: "pg_ivm"
version: "1.7.0"
- name: "pgvector"
version: "0.5.1"
overwrite: true
- name: "pg_hint_plan"
version: "1.3.9"
1 change: 1 addition & 0 deletions third-party/pgxman/pgxman_14_spilo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ extensions:
version: "1.7.0"
- name: "pgvector"
version: "0.5.1"
overwrite: true
- name: "pg_hint_plan"
version: "1.4.2"
- name: "wrappers"
Expand Down

0 comments on commit 3dad64f

Please sign in to comment.