Docker image

Describe the problem/error/question

So I need to front end how to reach the REST API of the back end
with VUE_APP_URL_BASE_API should I create docker

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @Kylychbek,

Can you share some more information? Are you seeing any errors?

There is no error, just I’m bit confused in building of docker image? Is there any information where I can see how to build docker image according to this requirements?

Hey @Kylychbek,

To be honest I am still not sure what you are actually trying to do, Can you share more information on what you are doing I might then be able to work out what information you need to resolve your issue.

I do have an application which is backend services is running on kubernetes and front end part is on s3 bucket. I do have cloudfront which is pointing to s3 bucket. when I should do add with default image of n8n it is not working. I need to customize default image to make it work basically I need to make sure that front end will reach the REST API of the back end
with VUE_APP_URL_BASE_API

I’m adding in cloudront as a behaviour this. So my frontend is related with backend services within one elastic loadbalancer so they should be all be under one load balancer (ALB) and make routing with path such example.com/n8n

Hey @Kylychbek,

So in that case what error are you seeing or does everything look like it is working?

hello @Jon,
so here’s our scenario. our backend services are running in k8s under one ALB and they are reachable via example.com/backen-service, and frontend is running in s3 bucket hosted website accessible via example.com. when i was trying to configure n8n v.1.3.1 to run in the same ALB under example.com/n8n, it is not working, its just loading the page without indicating specific errors. we also use Cloudfront for our application, s3 and backend services as a behaviors. n8n was also added, but still no luck. so the main question is how can we make our n8n to run in the same ALB under example.com/n8n path? Currently n8n runs in a separate ALB and works fine

So when the page loads what do you see? Have you also built the front end as it’s own project or are you actually referring to having workers running in queue mode and a main n8n instance?

it was just a blank page with a spinning wheel in the middle as it was trying to load, but nothing.
here are deployment yaml files i use for n8n:
WORKER Deployment yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: n8n-worker-deployment
namespace: n8n
labels: &labels
app: n8n-worker
component: deployment
spec:
replicas: 5
selector:
matchLabels: *labels
template:
metadata:
labels: *labels
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: backend
operator: In
values:
- n8n
containers:
- name: n8n-worker
image: n8nio/n8n:1.3.1
# command: [“n8n”]
# args: [“worker”]
command: [“/bin/sh”, “-c”]
args: [“n8n worker --concurrency=2;”]
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 5678
envFrom:
- configMapRef:
name: n8n-configmap
- secretRef:
name: n8n-secrets
# livenessProbe:
# httpGet:
# path: /healthz
# port: 5678
# readinessProbe:
# httpGet:
# path: /healthz
# port: 5678
resources:
limits:
cpu: “550m”
memory: “2048Mi”
requests:
cpu: “500m”
memory: “1024Mi”

deploy.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: n8n
component: deployment
name: n8n-deployment
namespace: n8n
spec:
replicas: 3
selector:
matchLabels:
app: n8n
component: deployment
template:
metadata:
labels:
app: n8n
component: deployment
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: backend
operator: In
values:
- n8n
containers:
- envFrom:
- configMapRef:
name: n8n-configmap
- secretRef:
name: n8n-secrets
image: “n8nio/n8n:1.3.1”
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
path: /healthz
port: 5678
scheme: HTTP
name: n8n
ports:
- containerPort: 5678
name: http
protocol: TCP
readinessProbe:
httpGet:
path: /healthz
port: 5678
scheme: HTTP
resources:
limits:
cpu: “550m”
memory: “2048Mi”
requests:
cpu: “500m”
memory: “1024Mi”

ConfigMap:
apiVersion: v1
kind: ConfigMap
metadata:
name: n8n-configmap
namespace: n8n
labels:
app: n8n
component: configmap
data:
DB_TYPE: “postgresdb”
DB_TABLE_PREFIX: “XXXX”
DB_POSTGRESDB_HOST: “XXXXXXX.rds.amazonaws.com
DB_POSTGRESDB_USER: “postgresadmin”
DB_POSTGRESDB_DATABASE: “n8n”
DB_POSTGRESDB_SCHEMA: “n8n”
DB_POSTGRESDB_PORT: “5432”
EXECUTIONS_MODE: “queue”
QUEUE_BULL_REDIS_HOST: “XXXXXX.cache.amazonaws.com
QUEUE_BULL_REDIS_PORT: “6379”
NODE_OPTIONS: “–max-old-space-size=8192”

hope this will help to get a better idea what we are trying to figure out)

If you open your browser and check the network tab does it show any errors? It could just be that your reverse proxy is not configured correctly.

so, i deployed n8n under ALB where other backend services are running and this is what i get when trying to access n8n with alb address. when using domain URL exampe.com/n8n it redirects me to my website right away.

INGRESS yaml file:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: n8n-service-ing
namespace: xxxxx
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/listen-ports: ‘[{“HTTP”:5678},{“HTTPS”:443}]’
alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
alb.ingress.kubernetes.io/healthcheck-path: /healthz
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/group.name: xxxxx
spec:
rules:
- host: example.com
- http:
paths:
- path: /n8n
pathType: Prefix
backend:
service:
name: n8n-service-lb
port:
number: 80

what am i missing?


these are the errors form console inspect. please note i can see n8n.io- Workflow Automation in the browser.
some of the errors:
Refused to apply style from ‘https://xxxxx.com/assets/index-6122886e.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.
index-8ab146da.js:1
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/html”. Strict MIME type checking is enforced for module scripts per HTML spec.

If you browse direct does that work? I would be tempted to try a simplified deployment first and see if that works then grow it out as needed.

So I’m as well having same issue, so when I am using just domain it is working but it is not working with path. So When I use domain as example.com it does work, but when I use example.com/n8n it does not work so how can I implement that example.com/n8n in that case there is Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/html”. Strict MIME type checking is enforced for module scripts per HTML spec. this error

Hey @Kylychbek

Do you have N8N_PATH set to /n8n?

Yes I did specify

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: n8n
component: deployment
name: n8n-deployment
namespace: prod-polaris
spec:
replicas: 1
selector:
matchLabels:
app: n8n
component: deployment
template:
metadata:
labels:
app: n8n
component: deployment
spec:
containers:
- name: n8n # Container name is missing in your original YAML.
envFrom:
- configMapRef:
name: n8n-configmap
- secretRef:
name: n8n-secrets
env:
- name: N8N_HOST
value: example.com
- name: N8N_PATH
value: /n8n/
- name: N8N_PORT
value: “5678”
- name: N8N_PROTOCOL
value: https
- name: NODE_ENV
value: production
- name: WEBHOOK_URL
value: https://example.com/n8n/
image: n8nio/n8n:1.3.1
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
path: /healthz
port: 5678
scheme: HTTP
ports:
- containerPort: 5678
name: http
protocol: TCP
readinessProbe:
httpGet:
path: /healthz
port: 5678
scheme: HTTP
resources:
limits:
cpu: “550m”
memory: “2048Mi”
requests:
cpu: “500m”
memory: “1024Mi”

In that case this could be related to an older issue where installing n8n on a path doesn’t always correctly work.

If you don’t use a path and Instead install using a subdomain does that work?

yes, it does work with subdomain. When I use dev.example.com it is working perfectly fine. But only when I add path to domain it is not working. Is it possible solution with subdomain and path?

Hey @Kylychbek,

It sounds like the old bug is back so we will need to create a dev ticket for it so we can set a priority and get it fixed.