<commit_before>#!/bin/bash

PATH=$PATH:/usr/lib/postgresql/${PGVERSION}/bin
WALE_ENV_DIR=/home/postgres/etc/wal-e.d/env

function write_postgres_yaml
{
  local_address=$(cat /etc/hosts |grep ${HOSTNAME}|cut -f1)
  cat >> postgres.yml <<__EOF__
loop_wait: 10
aws_use_host_address: "on"
etcd:
  scope: $SCOPE
  ttl: 30
  host: 127.0.0.1:8080
postgresql:
  name: postgresql_${HOSTNAME}
  listen: ${local_address}:5432
  data_dir: $PGDATA
  replication:
    username: standby
    password: <PASSWORD>
    network: 0.0.0.0/0
  superuser:
    password: <PASSWORD>
  admin:
    username: admin
    password: <PASSWORD>
  parameters:
    archive_mode: "on"
    wal_level: hot_standby
    archive_command: "envdir ${WALE_ENV_DIR} wal-e --aws-instance-profile wal-push \"%p\" -p 1"
    max_wal_senders: 5
    wal_keep_segments: 8
    archive_timeout: 1800s
    max_replication_slots: 5
    hot_standby: "on"
  recovery_conf:
    restore_command: "envdir ${WALE_ENV_DIR} wal-e --aws-instance-profile wal-fetch \"%f\" \"%p\" -p 1"
__EOF__
}<commit_msg>Update aws private ip address information<commit_after>#!/bin/bash

PATH=$PATH:/usr/lib/postgresql/${PGVERSION}/bin
WALE_ENV_DIR=/home/postgres/etc/wal-e.d/env

function write_postgres_yaml
{
  aws_private_ip=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)
  cat >> postgres.yml <<__EOF__
loop_wait: 10
etcd:
  scope: $SCOPE
  ttl: 30
  host: 127.0.0.1:8080
postgresql:
  name: postgresql_${HOSTNAME}
  listen: 0.0.0.0:5432
  connect_address: {aws_private_ip}:5432
  data_dir: $PGDATA
  replication:
    username: standby
    password: <PASSWORD>
    network: 0.0.0.0/0
  superuser:
    password: <PASSWORD>
  admin:
    username: admin
    password: <PASSWORD>
  parameters:
    archive_mode: "on"
    wal_level: hot_standby
    archive_command: "envdir ${WALE_ENV_DIR} wal-e --aws-instance-profile wal-push \"%p\" -p 1"
    max_wal_senders: 5
    wal_keep_segments: 8
    archive_timeout: 1800s
    max_replication_slots: 5
    hot_standby: "on"
  recovery_conf:
    restore_command: "envdir ${WALE_ENV_DIR} wal-e --aws-instance-profile wal-fetch \"%f\" \"%p\" -p 1"
__EOF__
}
{'fraction_non_alphanumeric': 0.13649155722326453, 'fraction_numerical': 0.040337711069418386, 'mean_word_length': 3.729490022172949, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6939389', 'n_tokens_mistral': 906, 'n_tokens_neox': 841, 'n_words': 167}