<commit_before>#!/bin/bash

# REQUIRED:
#   ZOOKEEPER_PORT_2181_TCP_ADDR
export HOSTNAME=${HOSTNAME-els}
export IP=${ADV_IP:-`ip ro get 8.8.8.8 | grep -oP "(?<=src )(\S+)"`}
export ELS_NODE_TYPE=${ELS_NODE_TYPE:-standard}
export ELS_HEAP_SIZE=${ELS_HEAP_SIZE:-`free -g | grep Mem: | awk '{printf( "%.0fg\n", $2 / 2 + 1 )}'`}

export CONFIG_FILE=/etc/elasticsearch/elasticsearch.yml
# replace variables in template with environment values
echo "TEMPLATE: generating configuation."
perl -pe 's/%%([A-Za-z0-9_]+)%%/defined $ENV{$1} ? $ENV{$1} : $&/eg' < ${CONFIG_FILE}.tmpl > $CONFIG_FILE


export CONFIG_FILE=/etc/supervisor/conf.d/els-supervisor.conf
# replace variables in template with environment values
echo "TEMPLATE: generating configuation."
perl -pe 's/%%([A-Za-z0-9_]+)%%/defined $ENV{$1} ? $ENV{$1} : $&/eg' < ${CONFIG_FILE}.tmpl > $CONFIG_FILE


# check if all properties have been replaced
if grep -qoP '%%[^%]+%%' $CONFIG_FILE ; then
    echo "ERROR: Not all variable have been resolved,"
    echo "       please set the following variables in your environment:"
    grep -oP '%%[^%]+%%' $CONFIG_FILE | sed 's/%//g' | sort -u
    exit 1
fi


exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
<commit_msg>more work on els/aws plugin<commit_after>#!/bin/bash

# REQUIRED:
#   ZOOKEEPER_PORT_2181_TCP_ADDR
export HOSTNAME=${HOSTNAME-els}
export IP=${ADV_IP:-`ip ro get 8.8.8.8 | grep -oP "(?<=src )(\S+)"`}
export ELS_NODE_TYPE=${ELS_NODE_TYPE:-standard}
export ELS_HEAP_SIZE=${ELS_HEAP_SIZE:-`free -g | grep Mem: | awk '{printf( "%.0fg\n", $2 / 2 + 1 )}'`}
export AWS_ACCESS_KEY=${AWS_ACCESS_KEY:-}
export AWS_SECRET_KEY=${AWS_SECRET_KEY:-}
export AWS_REGION=${AWS_REGION:-eu-west}
export AWS_REPOS_NAME=${AWS_REPOS_NAME:-samsara-backups}
export AWS_REPOS_ACCESS_KEY=${AWS_REPOS_ACCESS_KEY:-$AWS_ACCESS_KEY}
export AWS_REPOS_SECRET_KEY=${AWS_REPOS_SECRET_KEY:-$AWS_SECRET_KEY}
export AWS_REPOS_BASE_PATH=${AWS_REPOS_BASE_PATH:-/samsara}

export CONFIG_FILE=/etc/elasticsearch/elasticsearch.yml
# replace variables in template with environment values
echo "TEMPLATE: generating configuation."
perl -pe 's/%%([A-Za-z0-9_]+)%%/defined $ENV{$1} ? $ENV{$1} : $&/eg' < ${CONFIG_FILE}.tmpl > $CONFIG_FILE


export CONFIG_FILE=/etc/supervisor/conf.d/els-supervisor.conf
# replace variables in template with environment values
echo "TEMPLATE: generating configuation."
perl -pe 's/%%([A-Za-z0-9_]+)%%/defined $ENV{$1} ? $ENV{$1} : $&/eg' < ${CONFIG_FILE}.tmpl > $CONFIG_FILE


# check if all properties have been replaced
if grep -qoP '%%[^%]+%%' $CONFIG_FILE ; then
    echo "ERROR: Not all variable have been resolved,"
    echo "       please set the following variables in your environment:"
    grep -oP '%%[^%]+%%' $CONFIG_FILE | sed 's/%//g' | sort -u
    exit 1
fi


exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf

{'fraction_non_alphanumeric': 0.17192982456140352, 'fraction_numerical': 0.014736842105263158, 'mean_word_length': 4.890495867768595, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2752441', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1076, 'n_words': 242}