mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 20:54:07 -08:00
ci: Fixes to benchmarks in cloud (#10626)
This commit is contained in:
parent
a20c915e57
commit
15f311c890
|
@ -2,7 +2,7 @@ name: Destroy Benchmark Env
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 1 * * *'
|
- cron: '0 4 * * *'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
|
|
4
.github/workflows/benchmark-nightly.yml
vendored
4
.github/workflows/benchmark-nightly.yml
vendored
|
@ -58,6 +58,10 @@ jobs:
|
||||||
tenant-id: ${{ env.ARM_TENANT_ID }}
|
tenant-id: ${{ env.ARM_TENANT_ID }}
|
||||||
subscription-id: ${{ env.ARM_SUBSCRIPTION_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
|
- name: Run the benchmark with debug logging
|
||||||
if: github.event.inputs.debug == 'true'
|
if: github.event.inputs.debug == 'true'
|
||||||
run: pnpm benchmark-in-cloud --n8nTag ${{ inputs.n8n_tag || 'nightly' }} --benchmarkTag ${{ inputs.benchmark_tag || 'latest' }} --debug
|
run: pnpm benchmark-in-cloud --n8nTag ${{ inputs.n8n_tag || 'nightly' }} --benchmarkTag ${{ inputs.benchmark_tag || 'latest' }} --debug
|
||||||
|
|
|
@ -21,8 +21,6 @@ variable "ssh_public_key" {
|
||||||
|
|
||||||
variable "vm_size" {
|
variable "vm_size" {
|
||||||
description = "VM Size"
|
description = "VM Size"
|
||||||
# 8 vCPUs, 32 GiB memory
|
|
||||||
default = "Standard_DC8_v2"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "tags" {
|
variable "tags" {
|
||||||
|
|
|
@ -15,8 +15,8 @@ variable "host_size_family" {
|
||||||
|
|
||||||
variable "vm_size" {
|
variable "vm_size" {
|
||||||
description = "VM Size"
|
description = "VM Size"
|
||||||
# 2 vCPUs, 8 GiB memory
|
# 8 vCPUs, 32 GiB memory
|
||||||
default = "Standard_DC2s_v2"
|
default = "Standard_DC8_v2"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "number_of_vms" {
|
variable "number_of_vms" {
|
||||||
|
|
|
@ -8,6 +8,22 @@ set -euo pipefail;
|
||||||
CURRENT_USER=$(whoami)
|
CURRENT_USER=$(whoami)
|
||||||
|
|
||||||
# Mount the data disk
|
# 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
|
if [ -d "/n8n" ]; then
|
||||||
echo "Data disk already mounted. Clearing it..."
|
echo "Data disk already mounted. Clearing it..."
|
||||||
sudo rm -rf /n8n/*
|
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
|
sudo -E bash nodesource_setup.sh
|
||||||
|
|
||||||
# Install docker, docker compose and nodejs
|
# Install docker, docker compose and nodejs
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
sudo DEBIAN_FRONTEND=noninteractive apt-get update -yq
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io docker-compose nodejs
|
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq docker.io docker-compose nodejs
|
||||||
|
|
||||||
# Add the current user to the docker group
|
# Add the current user to the docker group
|
||||||
sudo usermod -aG docker "$CURRENT_USER"
|
sudo usermod -aG docker "$CURRENT_USER"
|
||||||
|
|
|
@ -30,6 +30,8 @@ async function main() {
|
||||||
|
|
||||||
const runDir = path.join(baseRunDir, n8nSetupToUse);
|
const runDir = path.join(baseRunDir, n8nSetupToUse);
|
||||||
fs.emptyDirSync(runDir);
|
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({
|
const dockerComposeClient = new DockerComposeClient({
|
||||||
$: $({
|
$: $({
|
||||||
|
|
|
@ -122,9 +122,7 @@ async function ensureVmIsReachable(sshClient) {
|
||||||
* @returns Path where the scripts are located on the VM
|
* @returns Path where the scripts are located on the VM
|
||||||
*/
|
*/
|
||||||
async function transferScriptsToVm(sshClient) {
|
async function transferScriptsToVm(sshClient) {
|
||||||
await sshClient.ssh('rm -rf ~/n8n');
|
await sshClient.ssh('rm -rf ~/n8n && git clone --depth=1 https://github.com/n8n-io/n8n.git');
|
||||||
|
|
||||||
await sshClient.ssh('git clone --depth=1 https://github.com/n8n-io/n8n.git');
|
|
||||||
|
|
||||||
return '~/n8n/packages/@n8n/benchmark/scripts';
|
return '~/n8n/packages/@n8n/benchmark/scripts';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue