2013-05-01 13:51:26 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
echo "This will run a stand-alone version of Druid"
|
|
|
|
set +u
|
|
|
|
shopt -s xpg_echo
|
|
|
|
shopt -s expand_aliases
|
|
|
|
trap "exit 1" 1 2 3 15
|
|
|
|
|
|
|
|
SCRIPT_DIR=`dirname $0`
|
2015-08-18 20:01:17 -04:00
|
|
|
MAVEN_DIR="${SCRIPT_DIR}/extensions-repo"
|
2015-02-11 11:10:58 -05:00
|
|
|
|
|
|
|
if [[ ! -d "${SCRIPT_DIR}/lib" || ! -d "${SCRIPT_DIR}/config" ]]; then
|
|
|
|
echo "This script appears to be running from the source location. It must be run from its deployed location."
|
|
|
|
echo "After building, unpack services/target/druid-services-*-SNAPSHOT-bin.tar.gz, and run the script unpacked there."
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
2013-05-01 13:51:26 -04:00
|
|
|
CURR_DIR=`pwd`
|
|
|
|
cd ${SCRIPT_DIR}
|
|
|
|
SCRIPT_DIR=`pwd`
|
|
|
|
cd ${CURR_DIR}
|
|
|
|
|
|
|
|
[ -d /tmp/example ] && echo "Cleaning up from previous run.." && /bin/rm -fr /tmp/example
|
|
|
|
|
2015-02-11 11:10:58 -05:00
|
|
|
source $SCRIPT_DIR/select_example.sh
|
2013-05-01 13:51:26 -04:00
|
|
|
|
2015-02-11 11:10:58 -05:00
|
|
|
select_example SPEC_FILE "${SCRIPT_DIR}/examples" "*_realtime.spec" "${1}" "${1}_realtime.spec"
|
2013-05-01 13:51:26 -04:00
|
|
|
|
2015-02-11 11:10:58 -05:00
|
|
|
EXAMPLE_LOC=$(dirname $SPEC_FILE)
|
2013-05-01 13:51:26 -04:00
|
|
|
# run before script if it exists
|
2015-02-11 11:10:58 -05:00
|
|
|
if [ -x ${EXAMPLE_LOC}/before.sh ]; then
|
2013-05-01 13:51:26 -04:00
|
|
|
trap "set +x; cd ${EXAMPLE_LOC} && ./after.sh && cd ${CURR_DIR}; exit 1" EXIT
|
|
|
|
cd ${EXAMPLE_LOC}
|
|
|
|
./before.sh
|
|
|
|
cd ${CURR_DIR}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# start process
|
2015-02-17 18:21:16 -05:00
|
|
|
JAVA_ARGS="-Xmx512m -Duser.timezone=UTC -Dfile.encoding=UTF-8"
|
2013-05-01 13:51:26 -04:00
|
|
|
JAVA_ARGS="${JAVA_ARGS} -Ddruid.realtime.specFile=${SPEC_FILE}"
|
2015-09-16 18:57:04 -04:00
|
|
|
JAVA_ARGS="${JAVA_ARGS} -Ddruid.publish.type=noop"
|
2013-05-01 13:51:26 -04:00
|
|
|
|
|
|
|
DRUID_CP=${EXAMPLE_LOC}
|
2013-05-05 00:02:31 -04:00
|
|
|
#For a pull
|
2015-02-18 14:19:47 -05:00
|
|
|
DRUID_CP=${SCRIPT_DIR}/../config/realtime:${DRUID_CP}
|
2013-05-05 00:02:31 -04:00
|
|
|
#For the kit
|
2014-11-21 18:36:42 -05:00
|
|
|
DRUID_CP=${DRUID_CP}:${SCRIPT_DIR}/config/_common
|
2013-08-22 22:48:21 -04:00
|
|
|
DRUID_CP=${DRUID_CP}:${SCRIPT_DIR}/config/realtime
|
2015-02-18 14:19:47 -05:00
|
|
|
DRUID_CP=${DRUID_CP}:${SCRIPT_DIR}/lib/*
|
2013-05-01 13:51:26 -04:00
|
|
|
|
|
|
|
echo "Running command:"
|
|
|
|
|
2013-10-02 17:22:39 -04:00
|
|
|
(set -x; java ${JAVA_ARGS} -classpath ${DRUID_CP} io.druid.cli.Main example realtime)
|