From 6f96992cfbddd28b820697df406ae7c39e1a74a5 Mon Sep 17 00:00:00 2001 From: David Sperling Date: Thu, 24 Jan 2019 09:05:13 -0800 Subject: [PATCH 1/3] New COPY_DIR variable for #24 --- README.md | 8 +++++--- lucy/lucy.sh | 25 ++++++++++++++++++++----- lucy/lucy.yml | 1 + 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 87cfadf..8905306 100644 --- a/README.md +++ b/README.md @@ -79,9 +79,10 @@ This Docker image replaces the JMeter master/slave nomenclature with *Gru*, *Min * Step 3 - Run a Minion Task with the requested instance count * Step 4 - Get Gru and Minion's instance ID's * Step 5 - Get IP addresses from Gru and Minions -* Step 6 - Run Gru with the specified JMX -* Step 7 - Fetch the results from Gru -* Step 8 - Delete the cluster +* Step 6 - Copy all files to Minions/Gru, or just the JMX +* Step 7 - Run Gru with the specified JMX +* Step 8 - Fetch the results from Gru +* Step 9 - Delete the cluster ### Volumes The `lucy` container uses 3 volumes: @@ -112,6 +113,7 @@ The following required and optional environment variables are supported: |JMETER_FLAGS||None|Custom JMeter command line options. For example, passing `-X` will tell the Minion to exit at the end of the test| |RETAIN_CLUSTER||None|Set to `true` if you want to re-use your cluster for future tests. Warning, you will incur AWS charges if you leave your cluster running.| |CUSTOM_PLUGIN_URL||None|The URL of a custom plugin you want to install in the Minions. File will be copied to $JMETER_HOME/lib/ext.|| +|COPY_DIR||None|Set to `true` if you want to copy the directory in which the .jmx file is located to all Minions and Gru.| ## Notes All current JMeter Plugins are installed via the Plugins Manager. diff --git a/lucy/lucy.sh b/lucy/lucy.sh index a9fd619..64c16b0 100755 --- a/lucy/lucy.sh +++ b/lucy/lucy.sh @@ -138,21 +138,36 @@ else # uncomment if you want to pause Lucy to inspect Gru or a Minion #read -p "Press enter to start Gru setup: " - # Step 6 - Run Gru with the specified JMX - echo "Copying $INPUT_JMX to Gru" - scp -i $PEM_PATH/$KEY_NAME.pem -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $INPUT_JMX ec2-user@${GRU_HOST}:/tmp + # Step 6 - Copy all files to Minions/Gru, or just the JMX + if [ "$COPY_DIR" == '' ]; then + echo "Copying $INPUT_JMX to Gru" + scp -i $PEM_PATH/$KEY_NAME.pem -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $INPUT_JMX ec2-user@${GRU_HOST}:/tmp + else + # Get the public hosts (space delimited) so Lucy can reach them for scp. + PUBLIC_MINION_HOSTS=$(aws ec2 describe-instances --instance-ids $MINION_INSTANCE_IDS \ + --query 'Reservations[*].Instances[*].[PublicIpAddress]' --output text | tr '\n' ' ') + JMX_DIR=$(dirname $INPUT_JMX) + + for MINION_HOST in $PUBLIC_MINION_HOSTS; do + echo "Copying $INPUT_JMX and test files to Minion $MINION_HOST" + scp -i $PEM_PATH/$KEY_NAME.pem -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $JMX_DIR/* ec2-user@${MINION_HOST}:/tmp + done + echo "Copying $INPUT_JMX and test files to Gru $GRU_HOST" + scp -i $PEM_PATH/$KEY_NAME.pem -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $JMX_DIR/* ec2-user@${GRU_HOST}:/tmp + fi + # Step 7 - Run Gru with the specified JMX echo "Running Docker to start JMeter in Gru mode" JMX_IN_COMTAINER=/plans/$(basename $INPUT_JMX) ssh -i $PEM_PATH/$KEY_NAME.pem -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ec2-user@${GRU_HOST} \ "docker run --network host -v /tmp:/plans -v /logs:/logs --env MINION_HOSTS=$MINION_HOSTS --env JMETER_FLAGS=$JMETER_FLAGS smithmicro/jmeter:$JMETER_VERSION $JMX_IN_COMTAINER" - # Step 6 - Fetch the results from Gru + # Step 8 - Fetch the results from Gru echo "Copying results from Gru" scp -r -i $PEM_PATH/$KEY_NAME.pem -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ec2-user@${GRU_HOST}:/logs/* /logs fi -# Step 7 - Delete the cluster +# Step 9 - Delete the cluster if [ "$RETAIN_CLUSTER" == '' ]; then echo "Deleting cluster/$CLUSTER_NAME" ecs-cli down --cluster $CLUSTER_NAME --force diff --git a/lucy/lucy.yml b/lucy/lucy.yml index 778144e..e1954b0 100644 --- a/lucy/lucy.yml +++ b/lucy/lucy.yml @@ -9,5 +9,6 @@ services: - 50000:50000 volumes: - /logs:/logs + - /tmp:/plans environment: - CUSTOM_PLUGIN_URL= From 1be6e8fd692c4ff7735309427d7e5016e4007a26 Mon Sep 17 00:00:00 2001 From: David Sperling Date: Fri, 25 Jan 2019 10:30:02 -0800 Subject: [PATCH 2/3] csv demo --- plans/demo-csv.jmx | 113 +++++++++++++++++++++++++++++++++++++++ plans/search-strings.csv | 18 +++++++ 2 files changed, 131 insertions(+) create mode 100644 plans/demo-csv.jmx create mode 100644 plans/search-strings.csv diff --git a/plans/demo-csv.jmx b/plans/demo-csv.jmx new file mode 100644 index 0000000..d60450d --- /dev/null +++ b/plans/demo-csv.jmx @@ -0,0 +1,113 @@ + + + + + + false + true + false + + + + searchStringsCSVPath + ${__P(searchStringsCSVPath,/plans/searchStrings.csv)} + = + + + + + + + + continue + + false + 10 + + 1 + 1 + false + + + + + + , + utf-8 + /plans/search-strings.csv + false + false + true + shareMode.all + false + searchString + + + + + + + false + ${searchString} + = + true + q + + + + www.google.com + 80 + + + /search + GET + true + false + true + false + + + + + + + + false + + saveConfig + + + true + true + true + + true + false + false + false + false + true + true + false + false + false + true + true + true + false + true + 2 + true + true + true + true + true + true + + + + + + + + diff --git a/plans/search-strings.csv b/plans/search-strings.csv new file mode 100644 index 0000000..667ea2c --- /dev/null +++ b/plans/search-strings.csv @@ -0,0 +1,18 @@ +Niwuryik +DronFet3 +VegNudBoth +Tejyiajcy +jobWamRac +recuvNab +gomLakik5 +byWremirOk +Ikhecec9 +roamosIpMo +BijHonFatt +TrakIsvew +Avthudro +Dacfowokuc +KochutNad +Thanoisp +Lacnuop3 +dudoalRi From 97d7af3b2701f93ddb69f2f7e8d225ae3670e2a9 Mon Sep 17 00:00:00 2001 From: David Sperling Date: Sat, 26 Jan 2019 07:51:08 -0800 Subject: [PATCH 3/3] simplified scp --- README.md | 2 +- lucy/lucy.sh | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8905306..d868c7f 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ The following required and optional environment variables are supported: |JMETER_FLAGS||None|Custom JMeter command line options. For example, passing `-X` will tell the Minion to exit at the end of the test| |RETAIN_CLUSTER||None|Set to `true` if you want to re-use your cluster for future tests. Warning, you will incur AWS charges if you leave your cluster running.| |CUSTOM_PLUGIN_URL||None|The URL of a custom plugin you want to install in the Minions. File will be copied to $JMETER_HOME/lib/ext.|| -|COPY_DIR||None|Set to `true` if you want to copy the directory in which the .jmx file is located to all Minions and Gru.| +|COPY_DIR||None|Set to `true` if you want to copy the directory in which the .jmx file is located to all Minions and Gru. The files will be located in all Docker containers in ` /plans`. Update your JMX file to reference external files at `/plans/...`| ## Notes All current JMeter Plugins are installed via the Plugins Manager. diff --git a/lucy/lucy.sh b/lucy/lucy.sh index 64c16b0..8367923 100755 --- a/lucy/lucy.sh +++ b/lucy/lucy.sh @@ -143,17 +143,15 @@ else echo "Copying $INPUT_JMX to Gru" scp -i $PEM_PATH/$KEY_NAME.pem -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $INPUT_JMX ec2-user@${GRU_HOST}:/tmp else - # Get the public hosts (space delimited) so Lucy can reach them for scp. - PUBLIC_MINION_HOSTS=$(aws ec2 describe-instances --instance-ids $MINION_INSTANCE_IDS \ + # Get Gru and Minion public hosts (space delimited) so Lucy can reach them for scp. + PUBLIC_HOSTS=$(aws ec2 describe-instances --instance-ids $GRU_INSTANCE_ID $MINION_INSTANCE_IDS \ --query 'Reservations[*].Instances[*].[PublicIpAddress]' --output text | tr '\n' ' ') JMX_DIR=$(dirname $INPUT_JMX) - for MINION_HOST in $PUBLIC_MINION_HOSTS; do - echo "Copying $INPUT_JMX and test files to Minion $MINION_HOST" - scp -i $PEM_PATH/$KEY_NAME.pem -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $JMX_DIR/* ec2-user@${MINION_HOST}:/tmp + for HOST in $PUBLIC_HOSTS; do + echo "Copying $INPUT_JMX and test files to $HOST" + scp -i $PEM_PATH/$KEY_NAME.pem -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $JMX_DIR/* ec2-user@${HOST}:/tmp done - echo "Copying $INPUT_JMX and test files to Gru $GRU_HOST" - scp -i $PEM_PATH/$KEY_NAME.pem -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $JMX_DIR/* ec2-user@${GRU_HOST}:/tmp fi # Step 7 - Run Gru with the specified JMX