<commit_before>#!/bin/bash

#
# Experimental script to install all required components locally (localhost). The script downloads,
# configures and starts Cassandra, Redis, and Tomcat instances. It also build, installs and starts
# the CQS and CNS web service endpoints as well as a single CNS Worker Node in Consumer/Producer
# mode. This script is intended for educational purpose only or to quickly setup a local CMB instance 
# for testing.
#
# The script should be run from the CMB root directory: 'bin/democonf.sh'. 
#
# Make sure user has write access to /var.
#
# Look in var/log when things go wrong at runtime.
#

CASS=apache-cassandra-1.0.10
REDIS=redis-2.4.17
TOMCAT=apache-tomcat-7.0.30

echo "Warning: Starting download and configuration of several things."
sleep 10

set -e
set -x

# We can try to get CMB itself.
if [ ! -d .git -a ! -d ../.git ]; then
   git clone <EMAIL>:Comcast/cmb.git && cd cmb
fi


## Get Tomcat and configure instances.

# The CQS Tomcat instance will listen on 3xxx.
# The CNS Tomcat instance will listen on 4xxx.

# Surely there is a better way to get an Apache mirror.
MIRROR=`curl -s http://www.apache.org/dyn/mirrors/mirrors.cgi | grep strong | head -1 | sed 's;.*<strong>\(.*\)</strong>.*$;\1;'`

echo "Using Apache mirror $MIRROR."
curl $MIRROR/tomcat/tomcat-7/v7.0.30/bin/$TOMCAT.tar.gz | tar zxf -

# Quickly make Tomcat instances for CQS and CNS.
# Should use CATALINA_BASE as we did before.
# Make the instances listen on different ports.
mkdir -p var/log
cp -R $TOMCAT tomcat-cqs
sed -i 's/ort="8/ort="3/g' tomcat-cqs/conf/server.xml
(cd var/log && ln -s ../../tomcat-cqs/logs cqs)
cp -R $TOMCAT tomcat-cns
sed -i 's/ort="8/ort="4/g' tomcat-cns/conf/server.xml
(cd var/log && ln -s ../../tomcat-cns/logs cns)<commit_msg>Tomcat 7.0.30 has been pulled from mirrors.  Annoying.  Now using 7.0.32.<commit_after>#!/bin/bash

#
# Experimental script to install all required components locally (localhost). The script downloads,
# configures and starts Cassandra, Redis, and Tomcat instances. It also build, installs and starts
# the CQS and CNS web service endpoints as well as a single CNS Worker Node in Consumer/Producer
# mode. This script is intended for educational purpose only or to quickly setup a local CMB instance 
# for testing.
#
# The script should be run from the CMB root directory: 'bin/democonf.sh'. 
#
# Make sure user has write access to /var.
#
# Look in var/log when things go wrong at runtime.
#

CASS=apache-cassandra-1.0.10
REDIS=redis-2.4.17
TOMCAT_VERSION="7.0.32"
TOMCAT="apache-tomcat-$TOMCAT_VERSION"

echo "Warning: Starting download and configuration of several things."
sleep 10

set -e
set -x

# We can try to get CMB itself.
if [ ! -d .git -a ! -d ../.git ]; then
   git clone <EMAIL>:Comcast/cmb.git && cd cmb
fi


## Get Tomcat and configure instances.

# The CQS Tomcat instance will listen on 3xxx.
# The CNS Tomcat instance will listen on 4xxx.

# Surely there is a better way to get an Apache mirror.
MIRROR=`curl -s http://www.apache.org/dyn/mirrors/mirrors.cgi | grep strong | head -1 | sed 's;.*<strong>\(.*\)</strong>.*$;\1;' | sed 's;/$;;'`

echo "Using Apache mirror $MIRROR."
curl $MIRROR/tomcat/tomcat-7/v$TOMCAT_VERSION/bin/$TOMCAT.tar.gz | tar zxf -

# Quickly make Tomcat instances for CQS and CNS.
# Should use CATALINA_BASE as we did before.
# Make the instances listen on different ports.
mkdir -p var/log
cp -R $TOMCAT tomcat-cqs
sed -i 's/ort="8/ort="3/g' tomcat-cqs/conf/server.xml
(cd var/log && ln -s ../../tomcat-cqs/logs cqs)
cp -R $TOMCAT tomcat-cns
sed -i 's/ort="8/ort="4/g' tomcat-cns/conf/server.xml
(cd var/log && ln -s ../../tomcat-cns/logs cns)
{'fraction_non_alphanumeric': 0.12517081169718502, 'fraction_numerical': 0.015851325498770157, 'mean_word_length': 3.4798041615667077, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6910070', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1271, 'n_words': 476}