mirror of https://github.com/vacp2p/wakurtosis.git
Modified runner and wakurtosis to add cadvisor to the enclave. Also updated kurtosis version
This commit is contained in:
parent
b717993984
commit
035fbc9379
|
@ -9,7 +9,7 @@ More info about Kurtosis: https://docs.kurtosis.com/
|
|||
|
||||
#### Before using this repository note that:
|
||||
|
||||
- **You are using Kurtosis version 0.66.2**. This is important, as they are working on it and changes can be huge depending on different versions. You can find all Kurtosis versions [here](https://github.com/kurtosis-tech/kurtosis-cli-release-artifacts/releases).
|
||||
- **You are using Kurtosis version 0.67.1**. This is important, as they are working on it and changes can be huge depending on different versions. You can find all Kurtosis versions [here](https://github.com/kurtosis-tech/kurtosis-cli-release-artifacts/releases).
|
||||
- The topology files that will be used by default are defined in `config/topology_generated/`. This topology is created with the [gennet](gennet-module/Readme.md) module.
|
||||
- Kurtosis can set up services in a parallel manner, defined in the `config.json` file (see below).
|
||||
- Only `kurtosis` and `docker` are needed to run this.
|
||||
|
|
4
build.sh
4
build.sh
|
@ -2,8 +2,10 @@
|
|||
sudo apt-get update
|
||||
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
||||
|
||||
apt-get install -y jq
|
||||
|
||||
# Install the suitable kurtosis-cli
|
||||
kurtosis_version=0.66.2
|
||||
kurtosis_version=0.67.1
|
||||
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list
|
||||
sudo apt update
|
||||
sudo apt-mark unhold kurtosis-cli
|
||||
|
|
|
@ -10,4 +10,8 @@ scrape_configs:
|
|||
scrape_interval: 1s
|
||||
file_sd_configs:
|
||||
- files:
|
||||
- '/tmp/targets.json'
|
||||
- '/tmp/targets.json'
|
||||
- job_name: 'cadvisor'
|
||||
scrape_interval: 5s
|
||||
static_configs:
|
||||
- targets: ['cadvisor:8080']
|
||||
|
|
48
run.sh
48
run.sh
|
@ -2,9 +2,6 @@
|
|||
|
||||
dir=$(pwd)
|
||||
|
||||
# Set up Cadvisor
|
||||
# docker run --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw --volume=/var/lib/docker/:/var/lib/docker:ro --volume=/dev/disk/:/dev/disk:ro --volume=/sys:/sys:ro --volume=/etc/machine-id:/etc/machine-id:ro --publish=8080:8080 --detach=true --name=cadvisor --privileged --device=/dev/kmsg gcr.io/cadvisor/cadvisor
|
||||
docker run --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw --volume=/var/lib/docker/:/var/lib/docker:ro --volume=/dev/disk/:/dev/disk:ro --volume=/sys:/sys:ro --volume=/etc/machine-id:/etc/machine-id:ro --publish=8080:8080 --detach=true --name=cadvisor --privileged --device=/dev/kmsg gcr.io/cadvisor/cadvisor:v0.47.0
|
||||
# Parse arg if any
|
||||
ARGS1=${1:-"wakurtosis"}
|
||||
ARGS2=${2:-"config.json"}
|
||||
|
@ -16,9 +13,38 @@ wakurtosis_config_file=$ARGS2
|
|||
echo "- Enclave name: " $enclave_name
|
||||
echo "- Configuration file: " $wakurtosis_config_file
|
||||
|
||||
# Delete the enclave just in case
|
||||
echo -e "\nCleaning up Kurtosis environment "$enclave_name
|
||||
docker container stop cadvisor > /dev/null 2>&1
|
||||
docker container rm cadvisor > /dev/null 2>&1
|
||||
kurtosis enclave rm -f $enclave_name > /dev/null 2>&1
|
||||
# kurtosis clean -a > /dev/null 2>&1 we do not want to delete all enclaves, just the one we will execute
|
||||
|
||||
# Delete previous logs
|
||||
echo -e "\Deleting previous logs in ${enclave_name}_logs"
|
||||
rm -rf ./${enclave_name}_logs > /dev/null 2>&1
|
||||
rm ./kurtosisrun_log.txt > /dev/null 2>&1
|
||||
|
||||
# Preparing enclave
|
||||
echo "Preparing enclave..."
|
||||
kurtosis enclave add --name ${enclave_name}
|
||||
enclave_preffix="$(kurtosis enclave inspect --full-uuids $enclave_name | grep UUID: | awk '{print $2}')"
|
||||
echo "Enclave network: "$enclave_preffix
|
||||
|
||||
# Get enclave last IP
|
||||
subnet="$(docker network inspect $enclave_preffix | jq -r '.[].IPAM.Config[0].Subnet')"
|
||||
echo "Enclave subnetork: $subnet"
|
||||
last_ip="$(ipcalc $subnet | grep HostMax | awk '{print $2}')"
|
||||
echo "cAdvisor IP: $last_ip"
|
||||
|
||||
|
||||
# Set up Cadvisor
|
||||
# docker run --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw --volume=/var/lib/docker/:/var/lib/docker:ro --volume=/dev/disk/:/dev/disk:ro --volume=/sys:/sys:ro --volume=/etc/machine-id:/etc/machine-id:ro --publish=8080:8080 --detach=true --name=cadvisor --privileged --device=/dev/kmsg gcr.io/cadvisor/cadvisor
|
||||
docker run --volume=/:/rootfs:ro --volume=/var/run:/var/run:rw --volume=/var/lib/docker/:/var/lib/docker:ro --volume=/dev/disk/:/dev/disk:ro --volume=/sys:/sys:ro --volume=/etc/machine-id:/etc/machine-id:ro --publish=8080:8080 --detach=true --name=cadvisor --privileged --device=/dev/kmsg --network $enclave_preffix --ip=$last_ip gcr.io/cadvisor/cadvisor:v0.47.0
|
||||
|
||||
|
||||
# Delete topology
|
||||
rm -rf ./config/topology_generated > /dev/null 2>&1
|
||||
|
||||
# Remove previous logs
|
||||
rm -rf ./$enclave_name_logs > /dev/null 2>&1
|
||||
|
||||
|
@ -38,16 +64,6 @@ fi
|
|||
|
||||
docker rm gennet-container > /dev/null 2>&1
|
||||
|
||||
# Delete the enclave just in case
|
||||
echo -e "\nCleaning up Kurtosis environment "$enclave_name
|
||||
kurtosis enclave rm -f $enclave_name > /dev/null 2>&1
|
||||
kurtosis clean -a > /dev/null 2>&1
|
||||
|
||||
# Delete previous logs
|
||||
echo -e "\Deleting previous logs in ${enclave_name}_logs"
|
||||
rm -rf ./${enclave_name}_logs > /dev/null 2>&1
|
||||
rm ./kurtosisrun_log.txt > /dev/null 2>&1
|
||||
|
||||
# Create the new enclave and run the simulation
|
||||
jobs=$(cat config/${wakurtosis_config_file} | jq -r ".kurtosis.jobs")
|
||||
|
||||
|
@ -62,7 +78,7 @@ wsl_service_name=$(kurtosis enclave inspect $enclave_name 2>/dev/null | grep wsl
|
|||
echo -e "\n--> To see simulation logs run: kurtosis service logs $enclave_name $wsl_service_name <--"
|
||||
|
||||
# Fetch the Grafana address & port
|
||||
grafana_host=$(kurtosis enclave inspect $enclave_name 2>/dev/null | grep grafana- | awk '{print $6}')
|
||||
grafana_host=$(kurtosis enclave inspect $enclave_name | 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"
|
||||
|
@ -76,7 +92,7 @@ cid_suffix="$(kurtosis enclave inspect --full-uuids $enclave_name | grep $wsl_se
|
|||
# Construct the fully qualified container name that kurtosis created
|
||||
cid="$enclave_preffix--user-service--$cid_suffix"
|
||||
|
||||
# Wait for the container to halt; this will block
|
||||
# Wait for the container to halt; this will block
|
||||
echo -e "Waiting for simulation to finish ..."
|
||||
status_code="$(docker container wait $cid)"
|
||||
|
||||
|
|
Loading…
Reference in New Issue