n8n | available fair-code licensed workflow automation tool | BPM library
kandi X-RAY | n8n Summary
Support
Quality
Security
License
Reuse
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample Here
n8n Key Features
n8n Examples and Code Snippets
Trending Discussions on n8n
Trending Discussions on n8n
QUESTION
I try to deploy n8n with its helm chart (https://github.com/8gears/n8n-helm-chart) to a GKE cluster. The problem I now face is when I set up the ingress to point to the application it loses the session constantly. I already found out that it has to be related to the ingress because when I access the pod directly everything works fine.
I try now to set up session affinity on the ingress, but I can't find any resource on how I can do this with terraform. My second option would be to set up an Nginx ingress but I have no experience how to do this. I hope someone can help me to find this out or point me to a better solution for the ingress. Thanks!
This is my terraform config for n8n:
resource "google_compute_managed_ssl_certificate" "n8n_ssl" {
name = "${var.release_name}-ssl"
managed {
domains = ["n8n.${var.host}"]
}
}
resource "helm_release" "n8n" {
count = 1
depends_on = [kubernetes_namespace.n8n, google_sql_database.n8n, google_sql_user.n8n, google_compute_managed_ssl_certificate.n8n_ssl]
repository = "https://8gears.container-registry.com/chartrepo/library"
chart = "n8n"
version = var.helm_version
name = var.release_name
namespace = var.namespace
recreate_pods = true
values = [
"${file("n8n_values.yaml")}"
]
set_sensitive {
name = "n8n.encryption_key"
value = var.n8n_encryption_key
}
set {
name = "config.database.postgresdb.host"
value = data.terraform_remote_state.cluster.outputs.database_connection
}
set {
name = "config.database.postgresdb.user"
value = var.db_username
}
set_sensitive {
name = "secret.database.postgresdb.password"
value = var.db_password
}
set {
name = "config.security.basicAuth.user"
value = var.username
}
set_sensitive {
name = "config.security.basicAuth.password"
value = var.password
}
}
resource "kubernetes_ingress" "n8n_ingress" {
wait_for_load_balancer = true
depends_on = [google_compute_managed_ssl_certificate.n8n_ssl]
metadata {
name = "${var.release_name}-ingress"
namespace = helm_release.n8n[0].namespace
annotations = {
"ingress.kubernetes.io/compress-enable" = "false",
"ingress.gcp.kubernetes.io/pre-shared-cert" = google_compute_managed_ssl_certificate.n8n_ssl.name
}
}
spec {
backend {
service_name = helm_release.n8n[0].name
service_port = 80
}
}
}
and my n8n_values.yml:
config:
port: 5678
generic:
timezone: Europe/London
database:
type: postgresdb
security:
basicAuth:
active: true
secret:
database:
postgresdb:
password: ""
extraEnv:
VUE_APP_URL_BASE_API: https://n8n.***/
WEBHOOK_TUNNEL_URL: https://n8n.***/
image:
repository: n8nio/n8n
pullPolicy: IfNotPresent
tag: latest
service:
type: ClusterIP
port: 80
ANSWER
Answered 2021-Aug-15 at 09:49To enable session affinity with GKE Ingress, you will need to create a BackendConfig resource. GKE Ingress supports client IP or cookie-based affinity.
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: my-backendconfig
spec:
sessionAffinity:
affinityType: "CLIENT_IP"
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: my-backendconfig
spec:
sessionAffinity:
affinityType: "GENERATED_COOKIE"
affinityCookieTtlSec: 50
When using terraform, I think you'd need to use the kubernetes_manifest resource to deploy the BackendConfig resource.
You would then need to add the BackendConfig as an annotation on the Service resource. Looking at the service.yaml provided by the helm chart, it does not appear you can add annotations via values.yaml so you'd need to modify it to support adding annotations.
QUESTION
I'm running the basic TLS challenge docker example:
version: "3.3"
services:
traefik:
image: "traefik:v2.4"
restart: always
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
#- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
- "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
ports:
- "443:443"
- "8080:8080"
volumes:
- ${DATA_FOLDER}/letsencrypt:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
n8n:
image: mjysci/n8n:latest-rpi
restart: always
ports:
- "127.0.0.1:5678:5678"
labels:
- traefik.enable=true
- traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
- traefik.http.routers.n8n.tls=true
- traefik.http.routers.n8n.entrypoints=websecure
- traefik.http.routers.n8n.tls.certresolver=mytlschallenge
- traefik.http.middlewares.n8n.headers.SSLRedirect=true
- traefik.http.middlewares.n8n.headers.STSSeconds=315360000
- traefik.http.middlewares.n8n.headers.browserXSSFilter=true
- traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
- traefik.http.middlewares.n8n.headers.forceSTSHeader=true
- traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
- traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
- traefik.http.middlewares.n8n.headers.STSPreload=true
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER
- N8N_BASIC_AUTH_PASSWORD
- N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_TUNNEL_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ${DATA_FOLDER}/.n8n:/home/node/.n8n
But when I'm running it says:
level=error msg="Unable to obtain ACME certificate for domains \"\": unable to generate a certificate for the domains []: error: one or more domains had a problem:\n[] [] acme: error presenting token: timeout 2021-02-01 10:09:04.491784271 +0000 UTC m=+378.657940910\n" providerName=mytlschallenge.acme routerName=n8n@docker rule="Host(``)"
In the browser, the application is available and works well with HTTPS but it says the certificate isn't valid (obviously). What could be wrong here?
ANSWER
Answered 2021-Feb-02 at 11:02i'm having the same problem on some domains. It looks like its a timeout. i tried to restart traefik now. same issue again.
ps: add traefik in the title of the thread, you may gain more visibility and answers.
EDIT: I reverted to version 2.3.7 and it works again. there must be a bug in 2.4 (latest)
i created an issue : https://github.com/traefik/traefik/issues/7848
QUESTION
I'm having trouble deploying n8n to Heroku via Docker registry and cannot figure out what I am doing wrong. Any help would be greatly appreciated.
Manually provision Postgres version 11:
heroku addons:create heroku-postgresql:hobby-dev --version=11 -a my-app
Dockerfile:
FROM n8nio/n8n
heroku.yml:
setup:
#addons:
# - plan: heroku-postgresql:hobby-dev
# version: 11
# as: DATABASE
config:
SUBDOMAIN: "my-app"
DOMAIN_NAME: "herokuapp.com"
NODE_ENV: "production"
TZ: "Europe/Berlin"
GENERIC_TIMEZONE: "Europe/Berlin"
N8N_HOST: "${SUBDOMAIN}.${DOMAIN_NAME}"
N8N_PORT: "${PORT}" #each app in heroku gets randomly assigned IP on start
N8N_PROTOCOL: "https"
N8N_ENCRYPTION_KEY: "mysupersecretkey"
WEBHOOK_TUNNEL_URL: "https://${SUBDOMAIN}.${DOMAIN_NAME}/"
VUE_APP_URL_BASE_API: "https://${SUBDOMAIN}.${DOMAIN_NAME}/"
DB_TYPE: "postgresdb"
DB_POSTGRESDB_HOST: "dbhost"
DB_POSTGRESDB_DATABASE: "dbname"
DB_POSTGRESDB_PORT: 5432
DB_POSTGRESDB_USER: "dbuser"
DB_POSTGRESDB_PASSWORD: "dbpass"
build:
docker:
web: Dockerfile
logs via heroku logs --tail
:
2020-04-15T11:19:50.178271+00:00 app[web.1]: [WARN tini (3)] Tini is not running as PID 1 and isn't registered as a child subreaper.
2020-04-15T11:19:50.178300+00:00 app[web.1]: Zombie processes will not be re-parented to Tini, so zombie reaping won't work.
2020-04-15T11:19:50.178302+00:00 app[web.1]: To fix the problem, use the -s option or set the environment variable TINI_SUBREAPER to register Tini as a child subreaper, or run Tini as PID 1.
2020-04-15T11:19:50.179480+00:00 app[web.1]: su-exec: setgroups: Operation not permitted
2020-04-15T11:24:54.478493+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=my-app.herokuapp.com request_id=myid fwd="myip" dyno= connect= service= status=503 bytes= protocol=https
ANSWER
Answered 2020-Apr-16 at 20:07That su-exec
error sounds like n8n requires root/elevated privileges, which you do not get on Heroku. If you have to configure it in some way to run strictly “unprivileged”, do that.
QUESTION
I'm totally lost in trying to calculate my disease prevalence based on a variable (in my case Postal Code). I've tried everything but nothing seems to work :(
I know disease prevalence is simple to calculate (total number of diseased divided by total population), but it won't let me sum the cases and sum the population by postal code in order to then divide them.
The column I'm trying to calculate prevalence for is called "Lyme" which is a logistic variable (0=negative, 1=positive). Then the column "FSA" is my postal codes. Please help!
Here is my code:
Data.All.df <- data.frame(Data.All) ## Create Data Frame from Data file
Data.All.df.2008 <- subset(Data.All.df, Year=="2008") ##only use 2008
library(dplyr)
Data.All.df.2008 <- Data.All.df.2008 %>%
group_by(FSA) %>%
mutate_each(funs(Cases = ((Lyme=="1")/((Lyme=="0")+(Lyme=="1")))))```
X.1 X Source Patient Accession Customer Year Date Country City Province Postal Name Age Gender Species Breed SNAP Apspp Ehrspp HW Lyme Coinfections dupID FSA
1710 4913 4913 Veterinary Clinic Bronson Sprartacus796575981360 7.97e+13 79657 2008 2008-01-08 Canada WINDSOR ON N8N 3T4 Bronson Sprartacus 132 Not Specified Canine Not Specified 4Dx 0 0 0 0 0 TRUE N8N
1711 4915 4915 Veterinary Clinic Scotty9233669481432 9.23e+13 92336 2008 2008-01-08 Canada WINDSOR ON N8R 1A5 Scotty 84 Not Specified Canine Not Specified 4Dx 0 0 0 0 0 TRUE N8R
1712 4916 4916 Veterinary Clinic Hershey9233683161435 9.23e+13 92336 2008 2008-01-08 Canada WINDSOR ON N8R 1A5 Hershey 48 Not Specified Canine Not Specified 4Dx 0 0 0 0 0 TRUE N8R
1713 4918 4918 Veterinary Clinic Brandy7965736441362 7.97e+13 79657 2008 2008-01-09 Canada WINDSOR ON N8N 3T4 Brandy 156 Not Specified Canine Not Specified 4Dx 0 0 0 0 0 TRUE N8N
1714 4919 4919 Veterinary Clinic Trish9233699481443 9.23e+13 92336 2008 2008-01-10 Canada WINDSOR ON N8R 1A5 Trish 132 Not Specified Canine Not Specified 4Dx 0 0 0 0 0 TRUE N8R
1715 4929 4929 Veterinary Clinic Lexie8001685020761364 8.00e+13 80016 2008 2008-01-17 Canada HALIFAX NS B3L 2C2 Lexie 29 Spayed Canine Non-Sporting 4Dx 0 0 0 0 0 TRUE B3L
1716 4937 4937 Veterinary Clinic CUBBIE79700431 7.97e+12 79700 2008 2008-01-21 Canada DARTMOUTH NS B2W 2N3 CUBBIE 118 Spayed Canine Non-Sporting 4Dx 0 0 0 0 0 TRUE B2W
1717 4945 4945 Veterinary Clinic Stevie7965765291433 7.97e+13 79657 2008 2008-01-25 Canada WINDSOR ON N8N 3T4 Stevie 36 Not Specified Canine Not Specified 4Dx 0 0 0 0 0 TRUE N8N
1718 4947 4947 Veterinary Clinic Bailey9233644191501 9.23e+13 92336 2008 2008-01-25 Canada WINDSOR ON N8R 1A5 Bailey 132 Not Specified Canine Not Specified 4Dx 0 0 0 0 0 TRUE N8R
1719 4948 4948 Veterinary Clinic ZAK925369448482 9.25e+12 92536 2008 2008-01-25 Canada HUNTSVILLE ON P1H 1B5 ZAK 96 Neutered Canine Hound 4Dx 0 0 0 0 0 TRUE P1H
17
ANSWER
Answered 2020-Jan-28 at 06:16Using the following minimal example data:
# Generate data.
set.seed(0934)
Data.All.df.2008 <- data.frame(FSA = sample(c("N8N", "N8R", "B3L", "P1H"), 50, T),
Lyme = sample(0:1, 50, T),
stringsAsFactors = F)
# First 10 observations.
head(Data.All.df.2008)
# FSA Lyme
# 1 N8N 1
# 2 P1H 1
# 3 N8N 0
# 4 P1H 0
# 5 N8N 1
# 6 N8N 1
Prevalence can be calculated as the number of positive diagnoses divided by the total number of observations, i.e. sum(Lyme)/n()
. The appropriate function is summarise
:
library(dplyr)
Data.All.df.2008 %>%
group_by(FSA) %>%
summarise(Prevalence = sum(Lyme)/n())
# # A tibble: 4 x 2
# FSA Prevalence
#
# 1 B3L 0.778
# 2 N8N 0.571
# 3 N8R 0.583
# 4 P1H 0.467
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install n8n
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page