-
Notifications
You must be signed in to change notification settings - Fork 350
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
n8n: new service #1630
base: main
Are you sure you want to change the base?
n8n: new service #1630
Changes from all commits
8c87d38
b24dc21
890cecc
d8f205d
0854c33
ed333d7
fd5a4f6
c83752b
1fe6eb5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
|
||
[comment]: # (Please add your documentation on top of this line) | ||
|
||
@AUTOGEN_OPTIONS@ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ ... }: | ||
{ } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
allowUnfree: true |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,77 @@ | ||||||||||
{ config | ||||||||||
, lib | ||||||||||
, pkgs | ||||||||||
, ... | ||||||||||
}: | ||||||||||
|
||||||||||
let | ||||||||||
inherit (lib) types; | ||||||||||
cfg = config.services.n8n; | ||||||||||
format = pkgs.formats.json { }; | ||||||||||
configFile = format.generate "n8n.json" cfg.settings; | ||||||||||
in | ||||||||||
{ | ||||||||||
options = { | ||||||||||
services.n8n = { | ||||||||||
enable = lib.mkEnableOption "n8n"; | ||||||||||
|
||||||||||
address = lib.mkOption { | ||||||||||
type = types.str; | ||||||||||
description = "Listen address"; | ||||||||||
default = "127.0.0.1"; | ||||||||||
}; | ||||||||||
|
||||||||||
port = lib.mkOption { | ||||||||||
type = types.port; | ||||||||||
default = 5678; | ||||||||||
description = '' | ||||||||||
The TCP port to accept connections. | ||||||||||
''; | ||||||||||
}; | ||||||||||
|
||||||||||
webhookUrl = lib.mkOption { | ||||||||||
type = types.nullOr types.str; | ||||||||||
default = null; | ||||||||||
description = '' | ||||||||||
WEBHOOK_URL for n8n, in case we're running behind a reverse proxy. | ||||||||||
This cannot be set through configuration and must reside in an environment variable. | ||||||||||
''; | ||||||||||
}; | ||||||||||
|
||||||||||
settings = lib.mkOption { | ||||||||||
type = format.type; | ||||||||||
default = { }; | ||||||||||
description = '' | ||||||||||
Configuration for n8n, see <https://docs.n8n.io/hosting/environment-variables/configuration-methods/> | ||||||||||
for supported values. | ||||||||||
''; | ||||||||||
}; | ||||||||||
}; | ||||||||||
}; | ||||||||||
|
||||||||||
config = lib.mkIf cfg.enable { | ||||||||||
env = { | ||||||||||
N8N_PORT = cfg.port; | ||||||||||
N8N_LISTEN_ADDRESS = cfg.address; | ||||||||||
WEBHOOK_URL = "${cfg.webhookUrl}"; | ||||||||||
N8N_CONFIG_FILES = "${configFile}"; | ||||||||||
Comment on lines
+56
to
+57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should work, no?
Suggested change
|
||||||||||
}; | ||||||||||
|
||||||||||
processes.n8n = { | ||||||||||
exec = "${pkgs.n8n}/bin/n8n"; | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's nice to have a |
||||||||||
|
||||||||||
process-compose = { | ||||||||||
readiness_probe = { | ||||||||||
exec.command = "${pkgs.curl}/bin/curl -f -k ${cfg.address}:${toString cfg.port}"; | ||||||||||
initial_delay_seconds = 1; | ||||||||||
period_seconds = 10; | ||||||||||
timeout_seconds = 2; | ||||||||||
success_threshold = 1; | ||||||||||
failure_threshold = 5; | ||||||||||
}; | ||||||||||
|
||||||||||
availability.restart = "on_failure"; | ||||||||||
}; | ||||||||||
}; | ||||||||||
}; | ||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To test that it launches, you can add a |
||
services.n8n = { | ||
enable = true; | ||
address = "0.0.0.0"; | ||
port = 5678; | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
allowUnfree: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
n8n
can be removed in favor of the test.