Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add concurrency flag to workers #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion n8n/queue/docker-compose-worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ services:
- /home/ubuntu/n8n/appdata:/home/node/.n8n
# Wait 5 seconds to start n8n to make sure that PostgreSQL is ready
# when n8n tries to connect to it
command: /bin/sh -c "sleep 5; n8n worker"
command: /bin/sh -c "sleep 5; n8n worker --concurrency=${N8N_CONCURRENCY}"

19 changes: 13 additions & 6 deletions tf/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ variable "n8n_version" {
default = "0.177.0"
}

variable "n8n_concurrency" {
description = "n8n worker concurrency level"
default = "10"
}

resource "aws_security_group" "allow_n8n_ssh" {
name = "allow_n8n_ssh"
description = "Allow SSH and n8n inbound traffic"
Expand Down Expand Up @@ -508,9 +513,10 @@ data "cloudinit_config" "queue_worker_init" {
content_type = "text/x-shellscript"
filename = "example.sh"
content = templatefile("${path.module}/script-templates/worker/queue_worker_start_script.tftpl", {
postgresHost = "${local.worker_queue_main_ip}",
redisHost = "${local.worker_queue_main_ip}",
n8nVersion = "${var.n8n_version}"
postgresHost = "${local.worker_queue_main_ip}",
redisHost = "${local.worker_queue_main_ip}",
n8nVersion = "${var.n8n_version}",
n8nConcurrency = "${var.n8n_concurrency}"
})
}
}
Expand Down Expand Up @@ -578,9 +584,10 @@ data "cloudinit_config" "queue_webhook_init" {
content_type = "text/x-shellscript"
filename = "example.sh"
content = templatefile("${path.module}/script-templates/worker/queue_worker_start_script.tftpl", {
postgresHost = "${local.worker_queue_main_ip}",
redisHost = "${local.worker_queue_main_ip}",
n8nVersion = "${var.n8n_version}"
postgresHost = "${local.worker_queue_main_ip}",
redisHost = "${local.worker_queue_main_ip}",
n8nVersion = "${var.n8n_version}"
n8nConcurrency = "${var.n8n_concurrency}"
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mkdir -p /home/ubuntu/n8n/appdata
echo "N8N_VERSION=${n8nVersion}" >> /home/ubuntu/n8n/.env
echo "DB_POSTGRESDB_HOST=${postgresHost}" >> /home/ubuntu/n8n/.env
echo "QUEUE_BULL_REDIS_HOST=${redisHost}" >> /home/ubuntu/n8n/.env
echo "N8N_CONCURRENCY=${n8nConcurrency}" >> /home/ubuntu/n8n/.env

sleep 1

Expand Down