Skip to content

Commit 327dbbb

Browse files
committed
apply feedback
1 parent 58ae08d commit 327dbbb

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

ENVIRONMENT.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,13 @@ Environment Configuration Settings
109109
- **KUBERNETES_BOOTSTRAP_LABELS**: a JSON describing names and values of labels used by Patroni as ``kubernetes.bootstrap_labels``. Default is empty.
110110
- **INITDB_LOCALE**: database cluster's default UTF-8 locale (en_US by default)
111111
- **ENABLE_WAL_PATH_COMPAT**: old Spilo images were generating wal path in the backup store using the following template ``/spilo/{WAL_BUCKET_SCOPE_PREFIX}{SCOPE}{WAL_BUCKET_SCOPE_SUFFIX}/wal/``, while new images adding one additional directory (``{PGVERSION}``) to the end. In order to avoid (unlikely) issues with restoring WALs (from S3/GC/and so on) when switching to ``spilo-13`` please set the ``ENABLE_WAL_PATH_COMPAT=true`` when deploying old cluster with ``spilo-13`` for the first time. After that the environment variable could be removed. Change of the WAL path also mean that backups stored in the old location will not be cleaned up automatically.
112-
- **WALG_DISABLE_S3_SSE**: by default wal-g are configured to encrypt files uploaded to S3. In order to disable it you can set this environment variable to ``true``.
112+
- **WALG_DISABLE_S3_SSE**: by default wal-g is configured to encrypt files uploaded to S3. In order to disable it you can set this environment variable to ``true``.
113113
- **USE_OLD_LOCALES**: whether to use old locales from Ubuntu 18.04 in the Ubuntu 22.04-based image. Default is false.
114114

115115
wal-g
116116
-----
117117

118+
wal-g is used everywhere in Spilo to perform backups and restore from them.
118119
- **WALG_DELTA_MAX_STEPS**, **WALG_DELTA_ORIGIN**, **WALG_DOWNLOAD_CONCURRENCY**, **WALG_UPLOAD_CONCURRENCY**, **WALG_UPLOAD_DISK_CONCURRENCY**, **WALG_DISK_RATE_LIMIT**, **WALG_NETWORK_RATE_LIMIT**, **WALG_COMPRESSION_METHOD**, **WALG_BACKUP_COMPRESSION_METHOD**, **WALG_BACKUP_FROM_REPLICA**, **WALG_SENTINEL_USER_DATA**, **WALG_PREVENT_WAL_OVERWRITE**: (optional) configuration options for wal-g.
119120
- **WALG_S3_CA_CERT_FILE**: (optional) TLS CA certificate for wal-g (see [wal-g configuration](https://github.com/wal-g/wal-g#configuration))
120121
- **WALG_SSH_PREFIX**: (optional) the ssh prefix to store WAL backups at in the format ssh://host.example.com/path/to/backups/ See `Wal-g <https://github.com/wal-g/wal-g#configuration>`__ documentation for details.

postgres-appliance/scripts/callback_aws.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313

1414
def get_instance_metadata():
1515
response = requests.put(
16-
url='http://169.254.169.254/latest/api/token',
16+
url='http://169.254.169.254/latest/api/token', # AWS EC2 metadata service endpoint to get a token
1717
headers={'X-aws-ec2-metadata-token-ttl-seconds': '60'}
1818
)
1919
token = response.text
2020
instance_identity = requests.get(
21-
url='http://169.254.169.254/latest/dynamic/instance-identity/document',
21+
url='http://169.254.169.254/latest/dynamic/instance-identity/document', # AWS EC2 metadata service endpoint to get instance identity document
2222
headers={'X-aws-ec2-metadata-token': token}
2323
)
2424
return instance_identity.json()
@@ -63,12 +63,12 @@ def main():
6363
)
6464
ec2 = boto3.client('ec2', config=config)
6565

66-
if argc == 5 and role in ('master', 'standby_leader') and action in ('on_start', 'on_role_change'):
66+
if argc == 5 and role in ('primary', 'standby_leader') and action in ('on_start', 'on_role_change'):
6767
associate_address(ec2, sys.argv[1], instance_id)
6868

6969
instance = get_instance(ec2, instance_id)
7070

71-
tags = [{'Key': 'Role', 'Value': role}]
71+
tags = [{'Key': 'Role', 'Value': LEADER_TAG_VALUE if role == 'primary' else role}]
7272
tag_resource(ec2, instance_id, tags)
7373

7474
tags.append({'Key': 'Instance', 'Value': instance_id})
@@ -79,10 +79,7 @@ def main():
7979
tags_to_update = tags
8080
else:
8181
for attachment in v['Attachments']:
82-
if attachment['Device'] == instance.get('RootDeviceName'):
83-
volume_device = 'root'
84-
else:
85-
volume_device = 'data'
82+
volume_device = 'root' if attachment['Device'] == instance.get('RootDeviceName') else 'data'
8683
tags_to_update = tags + [{'Key': 'Name', 'Value': 'spilo_{}_{}'.format(cluster, volume_device)}]
8784

8885
tag_resource(ec2, v.get('VolumeId'), tags_to_update)

postgres-appliance/scripts/postgres_backup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export PGHOST=/var/run/postgresql
2929
# push a new base backup
3030
log "producing a new backup"
3131
# We reduce the priority of the backup for CPU consumption
32-
nice -n 5 wal-g backup-push "$PGDATA" "${POOL_SIZE[@]}"
32+
nice -n 5 wal-g backup-push "$PGDATA"
3333

3434
# Collect all backups and sort them by modification time
3535
mapfile -t backup_records < <(wal-g backup-list 2>/dev/null |

0 commit comments

Comments
 (0)