<commit_before>#!/bin/bash
#
# Start sirepo
#
set -e
if [[ $RADIA_RUN_DIR && $RADIA_RUN_PORT ]]; then
    db_dir=$RADIA_RUN_DIR
    port=$RADIA_RUN_PORT
else
    db_dir=$1
    port=$2
fi
if [[ $RADIA_RUN_RABBITMQ_HOST ]]; then
    : ${RADIA_RUN_CHANNEL:=dev}
    export SIREPO_SERVER_JOB_QUEUE=Celery
    if [[ $RADIA_RUN_CHANNEL != dev ]]; then
        SIREPO_SERVER_SESSION_SECRET=$(cat "$RADIA_RUN_DIR/sirepo_celery_secret" || exit 1)
    fi
    export SIREPO_SERVER_SESSION_KEY=sirepo_$RADIA_RUN_CHANNEL
    export SIREPO_CELERY_TASKS_BROKER_URL=amqp://guest@"$RADIA_RUN_RABBITMQ_HOST"//
fi
if [[ ! -d $db_dir ]]; then
    echo "$db_dir: db_dir doesn't exist" 1>&2
    exit 1
fi
if [[ ! $port =~ ^[0-9]{2,5}$ ]]; then
    echo "$port: port invalid port (100-99999)" 1>&2
    exit 1
fi
. ~/.bashrc
export PYTHONUNBUFFERED=1
mkdir -p "$db_dir"
cd "$db_dir"
echo "$(date -u '+%Y-%m-%dT%H:%M:%SZ') sirepo service http --db-dir '$db_dir' --port '$port'" > start.log
env >> start.log
exec sirepo service http --db-dir "$db_dir" --port "$port" >> start.log 2>&1<commit_msg>configure service with environment vars<commit_after>#!/bin/bash
set -e
db_dir=$1
port=$2
if [[ ! -d $db_dir ]]; then
    echo "$db_dir: db_dir doesn't exist" 1>&2
    exit 1
fi
if [[ ! $port =~ ^[0-9]{2,5}$ ]]; then
    echo "$port: port invalid port (100-99999)" 1>&2
    exit 1
fi
. ~/.bashrc
export PYTHONUNBUFFERED=1
mkdir -p "$db_dir"
cd "$db_dir"
export SIREPO_PKCLI_SERVICE_PORT=$port
export SIREPO_PKCLI_SERVICE_DB_DIR=$PWD
(echo "$(date -u '+%Y-%m-%dT%H:%M:%SZ') sirepo service http; env) > start.log
sirepo service http >> start.log 2>&1
{'fraction_non_alphanumeric': 0.1681087762669963, 'fraction_numerical': 0.02904820766378245, 'mean_word_length': 4.13968253968254, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '6184645', 'n_tokens_mistral': 729, 'n_tokens_neox': 678, 'n_words': 155}