<commit_before>#!/bin/bash

source $(dirname "$0")/utils.bash

export PGPASSWORD=$DB_ENV_POST<PASSWORD>_PASSWORD

# Wait for dependencies
wait_for_service db 5432
wait_for_service solr 8983 

# Check if database already exist or create a new one
count=$(psql -lqt -U postgres -h db | cut -d \| -f 1 | grep -w ckan | wc -l)

if [[ $count -eq 0 ]]; then
  echo 'Creating database...'
  createuser -h db -U postgres -S -D -R -w $CKAN_DB_USER
  createdb -h db -U postgres -O $CKAN_DB_USER $CKAN_DB_NAME -E utf-8 
  psql -h db -U postgres -c "ALTER ROLE $CKAN_DB_USER WITH ENCRYPTED PASSWORD '<PASSWORD>';"
fi

# Configure filestore
mkdir -p $STORE_PATH
chown apache $STORE_PATH
chmod u+rwx $STORE_PATH

# Add MQ settings
if [ ! -f /srv/app/conf/app.ini ]; then
    cp -n "$APP_CONFIG_FILE" /srv/app/conf/
else
    cp -f /srv/app/conf/app.ini "$APP_CONFIG"
fi
"$APP_HOME"/bin/paster --plugin=ckan config-tool -f "$APP_CONFIG_FILE" "$CKAN_CONFIG/$CONFIG_FILE" -e

# Initialize db
"$APP_HOME"/bin/paster --plugin=ckan db init -c "${CKAN_CONFIG}/ckan.ini"

exec httpd-foreground<commit_msg>Docker: Removed hard-coded password for ckan db user.<commit_after>#!/bin/bash

source $(dirname "$0")/utils.bash

export PGPASSWORD=$DB_ENV_<PASSWORD>_PASSWORD

# Wait for dependencies
wait_for_service db 5432
wait_for_service solr 8983 

# Check if database already exist or create a new one
count=$(psql -lqt -U postgres -h db | cut -d \| -f 1 | grep -w ckan | wc -l)

if [[ $count -eq 0 ]]; then
  echo 'Creating database...'
  createuser -h db -U postgres -S -D -R -w $CKAN_DB_USER
  createdb -h db -U postgres -O $CKAN_DB_USER $CKAN_DB_NAME -E utf-8 
  psql -h db -U postgres -c "ALTER ROLE $CKAN_DB_USER WITH ENCRYPTED PASSWORD '$<PASSWORD>';"
fi

# Configure filestore
mkdir -p $STORE_PATH
chown apache $STORE_PATH
chmod u+rwx $STORE_PATH

# Add MQ settings
if [ ! -f /srv/app/conf/app.ini ]; then
    cp -n "$APP_CONFIG_FILE" /srv/app/conf/
else
    cp -f /srv/app/conf/app.ini "$APP_CONFIG"
fi
"$APP_HOME"/bin/paster --plugin=ckan config-tool -f "$APP_CONFIG_FILE" "$CKAN_CONFIG/$CONFIG_FILE" -e

# Initialize db
"$APP_HOME"/bin/paster --plugin=ckan db init -c "${CKAN_CONFIG}/ckan.ini"

exec httpd-foreground
{'fraction_non_alphanumeric': 0.133575647432985, 'fraction_numerical': 0.010904134484325307, 'mean_word_length': 3.6652542372881354, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '2448710', 'n_tokens_mistral': 911, 'n_tokens_neox': 867, 'n_words': 260}