ci: Fixes to benchmarks in cloud (#10626)

This commit is contained in:
Tomi Turtiainen 2024-08-30 17:49:50 +03:00 committed by GitHub
parent a20c915e57
commit 15f311c890
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 28 additions and 10 deletions

View file

@ -2,7 +2,7 @@ name: Destroy Benchmark Env
on:
schedule:
- cron: '0 1 * * *'
- cron: '0 4 * * *'
workflow_dispatch:
permissions:

View file

@ -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

View file

@ -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" {

View file

@ -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" {

View file

@ -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"

View file

@ -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({
$: $({

View file

@ -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';
}