wakurtosis/run.sh

42 lines
1.5 KiB
Bash
Raw Normal View History

2023-01-11 11:44:03 +00:00
#!/bin/sh
dir=$(pwd)
# Parse arg if any
ARGS1=${1:-"wakurtosis"}
ARGS2=${2:-"config.json"}
2023-01-11 11:44:03 +00:00
# Main .json configuration file
enclave_name=$ARGS1
wakurtosis_config_file=$ARGS2
2023-01-22 18:47:16 +00:00
echo "- Enclave name: " $enclave_name
echo "- Configuration file: " $wakurtosis_config_file
# Create and run Gennet docker container
echo -e "\nRunning topology generation"
cd gennet-module
docker run --name gennet-container -v ${dir}/config/:/config gennet --config-file /config/${wakurtosis_config_file} --output-dir /config/topology_generated
cd ..
docker rm gennet-container > /dev/null 2>&1
2023-01-11 11:44:03 +00:00
# Delete the enclave just in case
kurtosis enclave rm -f $enclave_name > /dev/null 2>&1
2023-01-11 11:44:03 +00:00
# Create the new enclave and run the simulation
echo -e "\nInitiating enclave "$enclave_name
kurtosis_cmd="kurtosis run --enclave-id ${enclave_name} . '{\"wakurtosis_config_file\" : \"config/${wakurtosis_config_file}\"}' > kurtosisrun_log.txt 2>&1"
eval $kurtosis_cmd
echo -e "Enclave " $enclave_name " is up and running"
2023-01-11 11:44:03 +00:00
# Fetch the WSL service id and display the log of the simulation
wsl_service_id=$(kurtosis enclave inspect wakurtosis 2>/dev/null | grep wsl- | awk '{print $1}')
# kurtosis service logs wakurtosis $wsl_service_id
echo -e "\n--> To see simulation logs run: kurtosis service logs wakurtosis $wsl_service_id <--"
2023-01-11 11:44:03 +00:00
# Fetch the Grafana address & port
grafana_host=$(kurtosis enclave inspect wakurtosis 2>/dev/null | grep grafana- | awk '{print $6}')
echo -e "\n--> Statistics in Grafana server at http://$grafana_host/ <--"
echo "Output of kurtosis run command written in kurtosisrun_log.txt"