8n8 setup on wsl2 docker and traefik

Hello,

I want to start testing 8m8 on my local wsl2 using docker.

I have setup like so

traefik.yml

  dashboard: true
  insecure: false

entryPoints:
  web:
    address: ":80"
  websecure:
    address: ":443"
  dashbord:
    address: ":8080"

certificatesResolvers:
  myresolver:
    acme:
      email: [email protected]
      storage: acme.json
      httpChallenge:
        entryPoint: web

providers:
  docker:
    exposedByDefault: false

base-docker-compose for traefik

version: '3'
services:
  reverse-proxy:
    image: traefik:v2.11
    command: --configFile=/etc/traefik/traefik.yml
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./traefik.yml:/etc/traefik/traefik.yml
      - ./acme.json:/acme.json
#    labels:
#      - "traefik.enable=true"
#      - "traefik.http.routers.mydashboard.rule=Host(`dashbord.yourdomain.com`)"
#      - "traefik.http.routers.mydashboard.service=api@internal"
#      - "traefik.http.routers.mydashboard.entrypoints=dashbord"
#      - "traefik.http.routers.mydashboard.tls=true"
#      - "traefik.http.routers.mydashboard.middlewares=myauth"
#      - "traefik.http.routers.nginx.tls.certresolver=myresolver"
#      - "traefik.http.middlewares.myauth.basicauth.users=test:$$2a$12$$SIpKLFKZwZTynxGggolVk.2UUkXDb0UKcPie2a6Sp./jAlHgh8d8K"
    networks:
      - traefik-test
networks:
  traefik-test:
    external: true


sub directory

8n8/data
8n8/doccker-compose.yml

services:
  n8n:
    networks:
      - traefik-test
    image: docker.n8n.io/n8nio/n8n
    restart: always
    ports:
      - "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=myresolver
      - 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
      - traefik.http.routers.n8n.middlewares=n8n@docker
      - "traefik.http.services.n8n.loadbalancer.server.port=5678"
      - "traefik.http.services.n8n.loadbalancer.passHostHeader=true"
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD
      - N8N_PORT=5678
      - N8N_PROTOCOL=http
      - NODE_ENV=production
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
    volumes:
      - ./data:/home/node/.n8n

volumes:
  traefik_data:
    external: true
  n8n_data:
    external: true
networks:
  traefik-test:
    external: true

.env


# The top level domain to serve from
DOMAIN_NAME=yourdomain.com

# The subdomain to serve from
SUBDOMAIN=n8n

# DOMAIN_NAME and SUBDOMAIN combined decide where n8n will be reachable from
# above example would result in: https://n8n.example.com

# Optional timezone to set which gets used by Cron-Node by default
# If not set New York time will be used
GENERIC_TIMEZONE=Europe/Berlin

# The email address to use for the SSL certificate creation
[email protected]

N8N_BASIC_AUTH_USER=test
N8N_BASIC_AUTH_PASSWORD=test

When i start 8n8 container

n8n-1  | User settings loaded from: /home/node/.n8n/config
n8n-1  | Last session crashed
n8n-1  | Initializing n8n process
n8n-1  | n8n ready on 0.0.0.0, port 5678
n8n-1  | Version: 1.51.1
n8n-1  |
n8n-1  | Editor is now accessible via:
n8n-1  | http://n8n.yourdomain.com:5678/

And on web page i get page but 404 page not found

I don`t know what is missing for me here.

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Hey @Przemyslaw_Fieluba,

Welcome to the community :raised_hands:

Which url are you using is it http://n8n.yourdomain.com:5678/ or https://n8n.yourdomain.com? Have you also set up your DNS record to point your n8n domain to your machine running it and made sure that the firewall is allowing the request through?

@Jon
I add info in hosts
127.0.0.1 8n8.yourdomain.com

https://8n8.yourdomain.com/ i get 404
https://8n8.yourdomain.com:5678/ ERR_SSL_PROTOCOL_ERROR
http://8n8.yourdomain.com:5678/setup
Your n8n server is configured to use a secure cookie, however you are visiting this via an insecure URL

Also it works on
http://localhost:5678/workflow/new

Uh solved

for some reason config .env was not read.

I put
- "traefik.http.routers.n8n.rule=Host(8n8.yourdomain.com)"

And its start to works

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.