diff --git a/stress_test/package.json b/stress_test/package.json new file mode 100644 index 0000000..fd64570 --- /dev/null +++ b/stress_test/package.json @@ -0,0 +1,30 @@ +{ + "name": "stress_test", + "display_name": "Stress Test", + "description": "Stress Test for CPU, GPU, and Networking", + "parameters": [ + { + "name": "SERVER", + "display_name": "iPerf Server?", + "description": "Is this node a Server or Client for iPerf?", + "type": "boolean", + "required": false + }, + { + "name": "SERVER_IP", + "display_name": "Server IP Address", + "description": "IP Address of iPerf Server", + "type": "string", + "required": false + } + ], + "main": "stress_test/run.sh", + "dependencies": [ + "stress_test/run.sh", + "stress_test/stress_network_server.service", + "stress_test/stress_network_client.service", + "stress_test/stress_cpu.service", + "stress_test/stress_gpu.service", + "utils/cachengo.sh" + ] +} diff --git a/stress_test/run.sh b/stress_test/run.sh new file mode 100755 index 0000000..6bd5437 --- /dev/null +++ b/stress_test/run.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +source "utils/cachengo.sh" + +DATADIR=/data/$APPID + +function do_install { + set -e + cachengo-cli updateInstallStatus $APPID "Installing" + + cachengo-cli updateInstallStatus $APPID "Installing: Network Stress Test" + if [ "$SERVER" == "true" ]; then + NETWORKSERVICE=stress_network_server.service + cp stress_test/stress_network_server.service /lib/systemd/system/ + else + NETWORKSERVICE=stress_network_client.service + sed -i "s/#server_ip#/$SERVER_IP/" stress_test/stress_network_client.service + cp stress_test/stress_network_client.service /lib/systemd/system/ + fi + apt install iperf -y + + cachengo-cli updateInstallStatus $APPID "Installing: CPU Stress Test" + apt install stress -y + cp stress_test/stress_cpu.service /lib/systemd/system/ + + cachengo-cli updateInstallStatus $APPID "Installing: GPU Stress Test" + apt install hashcat -y + sed -i "s|#datadir#|$DATADIR|g" stress_test/stress_gpu.service + cp stress_test/stress_gpu.service /lib/systemd/system/ + mkdir -p $DATADIR + cd $DATADIR && curl -L https://github.com/hashcat/hashcat/archive/refs/tags/v5.1.0.zip -o hashcat-5.1.0.zip && cd - + unzip $DATADIR/hashcat-5.1.0.zip -d $DATADIR + + cachengo-cli updateInstallStatus $APPID "Installing: Starting Stress Test" +# systemctl enable $NETWORKSERVICE stress_cpu.service stress_gpu.service + systemctl daemon-reload + systemctl start $NETWORKSERVICE stress_cpu.service stress_gpu.service + + cachengo-cli updateInstallStatus $APPID "Installed" +} + +function do_uninstall { + cachengo-cli updateInstallStatus $APPID "Uninstalling" + systemctl stop stress_network_*.service stress_cpu.service stress_gpu.service + rm -rf /lib/systemd/system/stress_network_*.service + rm -rf /lib/systemd/system/stress_cpu.service + rm -rf /lib/systemd/system/stress_gpu.service + rm -rf $DATADIR + cachengo-cli updateInstallStatus $APPID "Uninstalled" +} + + +case "$1" in + install) do_install ;; + uninstall) do_uninstall ;; +esac diff --git a/stress_test/stress_cpu.service b/stress_test/stress_cpu.service new file mode 100644 index 0000000..296e512 --- /dev/null +++ b/stress_test/stress_cpu.service @@ -0,0 +1,7 @@ +[Unit] +Description=CPU_Stress_Test +[Service] +ExecStart=/usr/bin/stress --cpu 6 +Restart=always +[Install] +WantedBy=multi-user.target diff --git a/stress_test/stress_gpu.service b/stress_test/stress_gpu.service new file mode 100644 index 0000000..8e52229 --- /dev/null +++ b/stress_test/stress_gpu.service @@ -0,0 +1,8 @@ +[Unit] +Description=GPU_Stress_Test +[Service] +WorkingDirectory=#datadir#/hashcat-5.1.0 +ExecStart=/usr/bin/hashcat -b +Restart=always +[Install] +WantedBy=multi-user.target diff --git a/stress_test/stress_network_client.service b/stress_test/stress_network_client.service new file mode 100644 index 0000000..334b74a --- /dev/null +++ b/stress_test/stress_network_client.service @@ -0,0 +1,7 @@ +[Unit] +Description=Network_Stress_Test_Client +[Service] +ExecStart=/usr/bin/iperf3 -c #server_ip# -t 0 +Restart=always +[Install] +WantedBy=multi-user.target diff --git a/stress_test/stress_network_server.service b/stress_test/stress_network_server.service new file mode 100644 index 0000000..0a087e0 --- /dev/null +++ b/stress_test/stress_network_server.service @@ -0,0 +1,7 @@ +[Unit] +Description=Network_Stress_Test_Server +[Service] +ExecStart=/usr/bin/iperf3 -s +Restart=always +[Install] +WantedBy=multi-user.target