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

Can't open N8N selfHosted #9148

Closed
igortsev opened this issue Apr 16, 2024 · 5 comments
Closed

Can't open N8N selfHosted #9148

igortsev opened this issue Apr 16, 2024 · 5 comments

Comments

@igortsev
Copy link

Bug Description

Im installed N8N via Docker Compose from your config and N8N not accessebe after 20 min delay. I can open just after restart Docker containers. I tested on 2 different machines (Docker Linux and Windows) and have the same issue with Docker. Tested with SQLlite and PostgreSql, with Traefik and without

To Reproduce

  1. Get config from your documentation for Docker Compose
  2. Create volumes
  3. Run docker compose up
  4. Finish setup
  5. Leave to 20 minutes without actions
  6. Try to refresh page

Expected behavior

SignIn form or dashboard

Operating System

Ubuntu 22.04

n8n Version

1.36.4

Node.js Version

last

Database

PostgreSQL

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented Apr 16, 2024

Hey @igortsev,

Do you see any errors in the docker logs?

@igortsev
Copy link
Author

igortsev commented Apr 16, 2024

N8N_LOG_LEVEL:= 'info,warn,error,verbose,debug' - all clear, docker logs clear too. Just working after container restart. Tested that issue with 1.36.X with Docker compose Linux (Ubuntu22)/Windows 11. Just run and leave it ti 20 minutes and you wiil not open dashboard. Tested with localhost and VPS with HOST

@igortsev
Copy link
Author

services:
  traefik:
    image: "traefik"
    restart: always
    command:
      - "--api=true"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
      - "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
      - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - traefik_data:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro
  n8n:
    image: docker.n8n.io/n8nio/n8n
    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=web,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
      - traefik.http.routers.n8n.middlewares=n8n@docker
    environment:
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=${POSTGRES_PORT}
      - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
      - DB_POSTGRESDB_USER=${POSTGRES_USER}
      - DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
      - N8N_LOG_LEVEL:= 'info,warn,error,verbose,debug'
    links:
      - postgres
    volumes:
      - n8n_data:/home/node/.n8n
  postgres:
    image: postgres:latest
    restart: unless-stopped
    environment:
      POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  traefik_data:
    external: true
  n8n_data:
    external: true
  postgres_data:
    external: true

@Joffcom
Copy link
Member

Joffcom commented Apr 17, 2024

Hey @igortsev,

I am not able to reproduce this, What I did was...

  1. Went to Digital Ocean
  2. Created a droplet based on their Docker Image
  3. Updated DNS for n8n.my-testingdomain.com to point to the IP of the droplet
  4. Added an n8n user and gave it sudo and docker access
  5. Opened ports 80 and 443 on the firewall through ufw
  6. Pased in your compose file and added the version line that was missing
  7. Created 3 volumes based on your file (postgres_data, n8n_data, traefik_data)
  8. Created a .env file that contained the below
# The top level domain to serve from
DOMAIN_NAME=my-testing-domain.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/London

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

# Postgres
POSTGRES_PORT=5432
POSTGRES_DB=n8ndb
POSTGRES_USER=n8nuser
POSTGRES_PASSWORD=n8npass

I then ran docker compose up -d followed by docker compose logs -f so I could see what was happening

Gave it a few seconds then I loaded the page in my browser and completed the setup like normal.

As this appears to be working fine I suspect there was an issue on your first run maybe with the database or traefik validating the email address for the SSL cert.

Are you able to provide detailed steps on how to reproduce the issue?

@Joffcom
Copy link
Member

Joffcom commented May 15, 2024

Moving to closed for now until we have a way to reproduce.

@Joffcom Joffcom closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants