diff --git a/README.md b/README.md index 87cfadf..d868c7f 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. 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 a9fd619..8367923 100755 --- a/lucy/lucy.sh +++ b/lucy/lucy.sh @@ -138,21 +138,34 @@ 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 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 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 + 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= 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