Skip to content

Commit

Permalink
Upgrade Spilo to 2.1-p9 (#56)
Browse files Browse the repository at this point in the history
* Upgrade Spilo to 2.1-p9

Ref: https://github.com/zalando/spilo/releases/tag/2.1-p9

* Bump to 2.1-p9 for Spilo base

* Remove spilo shared_buffers config
  • Loading branch information
owenthereal authored Jan 31, 2023
1 parent a0cbda0 commit 4e06ec5
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
2 changes: 1 addition & 1 deletion 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 = "2.1-p7"
default = "2.1-p9"
}

variable "POSTGRES_BASE_VERSION" {
Expand Down
38 changes: 32 additions & 6 deletions files/spilo/postgres-appliance/scripts/configure_spilo.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,10 +769,11 @@ def write_wale_environment(placeholders, prefix, overwrite):
s3_names = ['WALE_S3_PREFIX', 'WALG_S3_PREFIX', 'AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY',
'WALE_S3_ENDPOINT', 'AWS_ENDPOINT', 'AWS_REGION', 'AWS_INSTANCE_PROFILE', 'WALE_DISABLE_S3_SSE',
'WALG_S3_SSE_KMS_ID', 'WALG_S3_SSE', 'WALG_DISABLE_S3_SSE', 'AWS_S3_FORCE_PATH_STYLE', 'AWS_ROLE_ARN',
'AWS_WEB_IDENTITY_TOKEN_FILE']
azure_names = ['WALG_AZ_PREFIX', 'AZURE_STORAGE_ACCOUNT', 'AZURE_STORAGE_ACCESS_KEY',
'AZURE_STORAGE_SAS_TOKEN', 'WALG_AZURE_BUFFER_SIZE', 'WALG_AZURE_MAX_BUFFERS',
'AWS_WEB_IDENTITY_TOKEN_FILE', 'AWS_STS_REGIONAL_ENDPOINTS']
azure_names = ['WALG_AZ_PREFIX', 'AZURE_STORAGE_ACCOUNT', 'WALG_AZURE_BUFFER_SIZE', 'WALG_AZURE_MAX_BUFFERS',
'AZURE_ENVIRONMENT_NAME']
azure_auth_names = ['AZURE_STORAGE_ACCESS_KEY', 'AZURE_STORAGE_SAS_TOKEN', 'AZURE_CLIENT_ID',
'AZURE_CLIENT_SECRET', 'AZURE_TENANT_ID']
gs_names = ['WALE_GS_PREFIX', 'WALG_GS_PREFIX', 'GOOGLE_APPLICATION_CREDENTIALS']
swift_names = ['WALE_SWIFT_PREFIX', 'SWIFT_AUTHURL', 'SWIFT_TENANT', 'SWIFT_TENANT_ID', 'SWIFT_USER',
'SWIFT_USER_ID', 'SWIFT_USER_DOMAIN_NAME', 'SWIFT_USER_DOMAIN_ID', 'SWIFT_PASSWORD',
Expand All @@ -791,7 +792,8 @@ def write_wale_environment(placeholders, prefix, overwrite):
wale = defaultdict(lambda: '')
for name in ['PGVERSION', 'PGPORT', 'WALE_ENV_DIR', 'SCOPE', 'WAL_BUCKET_SCOPE_PREFIX', 'WAL_BUCKET_SCOPE_SUFFIX',
'WAL_S3_BUCKET', 'WAL_GCS_BUCKET', 'WAL_GS_BUCKET', 'WAL_SWIFT_BUCKET', 'BACKUP_NUM_TO_RETAIN',
'ENABLE_WAL_PATH_COMPAT'] + s3_names + swift_names + gs_names + walg_names + azure_names + ssh_names:
'ENABLE_WAL_PATH_COMPAT'] + s3_names + swift_names + gs_names + walg_names + azure_names + \
azure_auth_names + ssh_names:
wale[name] = placeholders.get(prefix + name, '')

if wale.get('WAL_S3_BUCKET') or wale.get('WALE_S3_PREFIX') or wale.get('WALG_S3_PREFIX'):
Expand Down Expand Up @@ -851,7 +853,31 @@ def write_wale_environment(placeholders, prefix, overwrite):
elif wale.get('WAL_SWIFT_BUCKET') or wale.get('WALE_SWIFT_PREFIX'):
write_envdir_names = swift_names
elif wale.get("WALG_AZ_PREFIX"):
write_envdir_names = azure_names + walg_names
azure_auth = []
auth_opts = 0

if wale.get('AZURE_STORAGE_ACCESS_KEY'):
azure_auth.append('AZURE_STORAGE_ACCESS_KEY')
auth_opts += 1

if wale.get('AZURE_STORAGE_SAS_TOKEN'):
if auth_opts == 0:
azure_auth.append('AZURE_STORAGE_SAS_TOKEN')
auth_opts += 1

if wale.get('AZURE_CLIENT_ID') and wale.get('AZURE_CLIENT_SECRET') and wale.get('AZURE_TENANT_ID'):
if auth_opts == 0:
azure_auth.extend(['AZURE_CLIENT_ID', 'AZURE_CLIENT_SECRET', 'AZURE_TENANT_ID'])
auth_opts += 1

if auth_opts > 1:
logging.warning('Multiple authentication options configured for wal-g backup to Azure, using %s. Provide '
'either AZURE_STORAGE_ACCESS_KEY or AZURE_STORAGE_SAS_TOKEN or Service Principal '
'(AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID) for authentication (or use '
'MSI).', '/'.join(azure_auth))

write_envdir_names = azure_names + azure_auth + walg_names

elif wale.get("WALG_SSH_PREFIX"):
write_envdir_names = ssh_names + walg_names
else:
Expand Down Expand Up @@ -1022,7 +1048,7 @@ def main():

provider = get_provider()
placeholders = get_placeholders(provider)
logging.info('Looks like your running %s', provider)
logging.info('Looks like you are running %s', provider)

config = yaml.load(pystache_render(TEMPLATE, placeholders))
config.update(get_dcs_config(config, placeholders))
Expand Down
9 changes: 5 additions & 4 deletions files/spilo/postgres-appliance/scripts/spilo_commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
# (min_version, max_version, shared_preload_libraries, extwlist.extensions)
extensions = {
'columnar': (13, 14, True, True),
'pg_cron': (9.5, 14, True, True),
'pg_stat_kcache': (9.4, 14, True, False),
'pg_partman': (9.4, 14, False, True)
#'timescaledb': (9.6, 14, True, True),
'pg_cron': (9.5, 15, True, True),
'pg_stat_kcache': (9.4, 15, True, False),
'pg_partman': (9.4, 15, False, True)
}
if os.environ.get('ENABLE_PG_MON') == 'true':
extensions['pg_mon'] = (11, 14, True, False)
extensions['pg_mon'] = (11, 15, True, False)


def adjust_extensions(old, version, extwlist=False):
Expand Down

0 comments on commit 4e06ec5

Please sign in to comment.