diff --git a/.github/workflows/benchmark-destroy-nightly.yml b/.github/workflows/benchmark-destroy-nightly.yml index e4b3e0d981ebd..2ce4b51b3b64b 100644 --- a/.github/workflows/benchmark-destroy-nightly.yml +++ b/.github/workflows/benchmark-destroy-nightly.yml @@ -2,7 +2,7 @@ name: Destroy Benchmark Env on: schedule: - - cron: '0 1 * * *' + - cron: '0 4 * * *' workflow_dispatch: permissions: diff --git a/.github/workflows/benchmark-nightly.yml b/.github/workflows/benchmark-nightly.yml index f413a4aab7e86..2de86abaf740e 100644 --- a/.github/workflows/benchmark-nightly.yml +++ b/.github/workflows/benchmark-nightly.yml @@ -58,6 +58,10 @@ jobs: tenant-id: ${{ env.ARM_TENANT_ID }} subscription-id: ${{ env.ARM_SUBSCRIPTION_ID }} + - name: Destroy any existing environment + run: pnpm destroy-cloud-env + working-directory: packages/@n8n/benchmark + - name: Run the benchmark with debug logging if: github.event.inputs.debug == 'true' run: pnpm benchmark-in-cloud --n8nTag ${{ inputs.n8n_tag || 'nightly' }} --benchmarkTag ${{ inputs.benchmark_tag || 'latest' }} --debug diff --git a/packages/@n8n/benchmark/infra/modules/benchmark-vm/vars.tf b/packages/@n8n/benchmark/infra/modules/benchmark-vm/vars.tf index b7a3f18d77edd..69e6cd3572e89 100644 --- a/packages/@n8n/benchmark/infra/modules/benchmark-vm/vars.tf +++ b/packages/@n8n/benchmark/infra/modules/benchmark-vm/vars.tf @@ -21,8 +21,6 @@ variable "ssh_public_key" { variable "vm_size" { description = "VM Size" - # 8 vCPUs, 32 GiB memory - default = "Standard_DC8_v2" } variable "tags" { diff --git a/packages/@n8n/benchmark/infra/vars.tf b/packages/@n8n/benchmark/infra/vars.tf index 379bafe80baa0..cb90a5ccc3db2 100644 --- a/packages/@n8n/benchmark/infra/vars.tf +++ b/packages/@n8n/benchmark/infra/vars.tf @@ -15,8 +15,8 @@ variable "host_size_family" { variable "vm_size" { description = "VM Size" - # 2 vCPUs, 8 GiB memory - default = "Standard_DC2s_v2" + # 8 vCPUs, 32 GiB memory + default = "Standard_DC8_v2" } variable "number_of_vms" { diff --git a/packages/@n8n/benchmark/scripts/bootstrap.sh b/packages/@n8n/benchmark/scripts/bootstrap.sh index 665e46d87722e..d7b3ed2fde98a 100644 --- a/packages/@n8n/benchmark/scripts/bootstrap.sh +++ b/packages/@n8n/benchmark/scripts/bootstrap.sh @@ -8,6 +8,22 @@ set -euo pipefail; CURRENT_USER=$(whoami) # Mount the data disk +# First wait for the disk to become available +WAIT_TIME=0 +MAX_WAIT_TIME=60 + +while [ ! -e /dev/sdc ]; do + if [ $WAIT_TIME -ge $MAX_WAIT_TIME ]; then + echo "Error: /dev/sdc did not become available within $MAX_WAIT_TIME seconds." + exit 1 + fi + + echo "Waiting for /dev/sdc to be available... ($WAIT_TIME/$MAX_WAIT_TIME)" + sleep 1 + WAIT_TIME=$((WAIT_TIME + 1)) +done + +# Then mount it if [ -d "/n8n" ]; then echo "Data disk already mounted. Clearing it..." sudo rm -rf /n8n/* @@ -28,8 +44,8 @@ curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh sudo -E bash nodesource_setup.sh # Install docker, docker compose and nodejs -sudo DEBIAN_FRONTEND=noninteractive apt-get update -sudo DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io docker-compose nodejs +sudo DEBIAN_FRONTEND=noninteractive apt-get update -yq +sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq docker.io docker-compose nodejs # Add the current user to the docker group sudo usermod -aG docker "$CURRENT_USER" diff --git a/packages/@n8n/benchmark/scripts/runForN8nSetup.mjs b/packages/@n8n/benchmark/scripts/runForN8nSetup.mjs index c7f1e88904880..a6f4aeafe78ac 100755 --- a/packages/@n8n/benchmark/scripts/runForN8nSetup.mjs +++ b/packages/@n8n/benchmark/scripts/runForN8nSetup.mjs @@ -30,6 +30,8 @@ async function main() { const runDir = path.join(baseRunDir, n8nSetupToUse); fs.emptyDirSync(runDir); + // Make sure the n8n container user (node) has write permissions to the run directory + await $`chmod 777 ${runDir}`; const dockerComposeClient = new DockerComposeClient({ $: $({ diff --git a/packages/@n8n/benchmark/scripts/runInCloud.mjs b/packages/@n8n/benchmark/scripts/runInCloud.mjs index dee3a30f06b56..bc55cf52b5534 100755 --- a/packages/@n8n/benchmark/scripts/runInCloud.mjs +++ b/packages/@n8n/benchmark/scripts/runInCloud.mjs @@ -122,9 +122,7 @@ async function ensureVmIsReachable(sshClient) { * @returns Path where the scripts are located on the VM */ async function transferScriptsToVm(sshClient) { - await sshClient.ssh('rm -rf ~/n8n'); - - await sshClient.ssh('git clone --depth=1 https://github.com/n8n-io/n8n.git'); + await sshClient.ssh('rm -rf ~/n8n && git clone --depth=1 https://github.com/n8n-io/n8n.git'); return '~/n8n/packages/@n8n/benchmark/scripts'; }