Skip to content

Instantly share code, notes, and snippets.

@ascrutae
Created May 27, 2018 01:30
Show Gist options
  • Save ascrutae/1f0f2047b3ad9057b3e1415525e1c0ff to your computer and use it in GitHub Desktop.
Save ascrutae/1f0f2047b3ad9057b3e1415525e1c0ff to your computer and use it in GitHub Desktop.
#!/bin/bash
PRG="$0"
PRGDIR=`dirname "$PRG"`
[ -z "$DEPLOY_HOME" ] && DEPLOY_HOME=`cd "$PRGDIR" >/dev/null; pwd`
#
# env variables
JMETER_HOME=${DEPLOY_HOME}/apache-jmeter-4.0
ZK_HOME=${DEPLOY_HOME}/zookeeper-3.4.11
ELASTIC_HOME=${DEPLOY_HOME}/elasticsearch-5.3.0
TEST_DEMO_HOME=${DEPLOY_HOME}/test-demo
REPLACE_FILES_HOME=${DEPLOY_HOME}/replace-files
SKYWALKING_COLLECTOR_10800=${DEPLOY_HOME}/skywalking-10800
SKYWALKING_COLLECTOR_20800=${DEPLOY_HOME}/skywalking-20800
#
# stop previous process
KILL_PREVIOUS_PROCESS_ID=`jps | awk '{print $1}' | xargs kill -9`
#
# unzip package
tar -xvf ${DEPLOY_HOME}/apache-skywalking-apm-incubating.tar.gz > /dev/null
echo "unzip Done!"
#
# clear package
rm -rf ${SKYWALKING_COLLECTOR_10800}
rm -rf ${SKYWALKING_COLLECTOR_20800}
echo "clear package Done!"
#
# copy package
mv ${DEPLOY_HOME}/apache-skywalking-apm-incubating ${SKYWALKING_COLLECTOR_10800}
cp -r ${SKYWALKING_COLLECTOR_10800} ${SKYWALKING_COLLECTOR_20800}
echo "copy package Done!"
#
# copy agent
rm -rf ${DEPLOY_HOME}/test-demo/skywalking-agent/*
cp -r ${SKYWALKING_COLLECTOR_10800}/agent/* ${TEST_DEMO_HOME}/skywalking-agent
echo "copy agent Done!"
#
#
cp ${REPLACE_FILES_HOME}/webappService.sh ${SKYWALKING_COLLECTOR_10800}/bin/webappService.sh
cp ${REPLACE_FILES_HOME}/application-10800.yml ${SKYWALKING_COLLECTOR_10800}/config/application
.yml
cp ${REPLACE_FILES_HOME}/application-20800.yml ${SKYWALKING_COLLECTOR_20800}/config/application
.yml
echo "replace config files Done!"
#
#
cd ${ZK_HOME} && bin/zkServer.sh start > /dev/null
echo "start zk server Done!"
#
#
rm -rf ${ELASTIC_HOME}/data
cd ${ELASTIC_HOME} && nohup bin/elasticsearch &
echo "start elastic search Done!"
#
#
sleep 5
cd ${SKYWALKING_COLLECTOR_10800} && bin/collectorService.sh
sleep 15
cd ${SKYWALKING_COLLECTOR_20800} && bin/collectorService.sh
sleep 1
echo "start collector cluster Done!"
#
#
cd ${SKYWALKING_COLLECTOR_10800} && bin/webappService.sh
echo "start webui Done!"
#
#
cd ${TEST_DEMO_HOME} && rm -rf kafka_2.11-1.0.0/logs/*
cd ${TEST_DEMO_HOME} && bin/startup.sh > /dev/null
echo "start demo Done!"
sleep 60
#
#
cd ${JMETER_HOME} && rm -rf testdemo.jtl
cd ${JMETER_HOME} && nohup bin/jmeter -n -t test-demo.jmx -l testdemo.jtl &
echo "start jmeter Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment