Issue with prod

Describe the problem/error/question

Hello! I have issue with self-host n8n. I set up with docker compose. It was working like 6 months perfectly and today stop working at all. I check all log and etc but still issue that “Cannot GET /, bad gateway”

Just stop working, I tried update to last version, restart containers and etc - nothing is working. Pls can some one explain me? or maybe someone faced same issue?

What is the error message (if any)?

Please share your workflow


version: "3"

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:
      - ${DATA_FOLDER}/letsencrypt:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro

  n8n:
    image: custom-nodes-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.middlewares.n8n.headers.accesscontrolallowmethods=GET,OPTIONS,PUT,POST,DELETE
      - traefik.http.middlewares.n8n.headers.accesscontrolallowheaders=*
      - traefik.http.middlewares.n8n.headers.accesscontrolalloworiginlist=*
      - traefik.http.middlewares.n8n.headers.accesscontrolmaxage=100
      - traefik.http.middlewares.n8n.headers.addvaryheader=true
      - traefik.http.routers.n8n.middlewares=n8n@docker
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD

      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - N8N_LOG_LEVEL=debug
      - N8N_LOG_OUTPUT=console
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/

        #DB
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_USER=n8n
      - DB_POSTGRESDB_PASSWORD=

        #SMTP
      - N8N_EMAIL_MODE=smtp
      - N8N_SMTP_HOST=smtp.gmail.com
      - N8N_SMTP_PORT=587
      - N8N_SMTP_SECURE=true
      - [email protected]
      - N8N_SMTP_PASS=somfgdgdirhgvisr
      - [email protected]
      - N8N_SMTP_SSL=false

        #queue EXECUTION_MODE
      - EXECUTION_MODE=queue
      - EXECUTIONS_PROCESS=own
        #Execution data
      - EXECUTIONS_DATA_PRUNE=false
      - EXECUTIONS_DATA_MAX_AGE=999999
        #Redis
      - QUEUE_BULL_REDIS_HOST=redis
      - QUEUE_BULL_REDIS_PORT=6379
        #Metrics
      - N8N_METRICS=true
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
    volumes:
      - ${DATA_FOLDER}/.n8n:/home/node/.n8n
    links:
      - postgres

  #worker1
  worker1:
    image: custom-nodes-n8n
    command: "n8n worker"
    environment:
      - NODE_ENV=production
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_USER=n8n
      - DB_POSTGRESDB_PASSWORD=
      - EXECUTIONS_PROCESS=own
      - QUEUE_BULL_REDIS_HOST=redis
      - QUEUE_BULL_REDIS_PORT=6379

  redis:
    image: redis:latest
    restart: always
    environment:
      - ALLOW_EMPTY_PASSWORD=


  postgres:
    image: postgres:13
    restart: always
    environment:
      - POSTGRES_DB=n8n
      - POSTGRES_USER=n8n
      - POSTGRES_PASSWORD=
    volumes:
      - ./postgres:/var/lib/postgresql/data

  adminer:
    image: adminer
    restart: always
    ports:
      - "8080:8080"
    labels:
      - traefik.enable=true
      - traefik.http.routers.adminer.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`) && (PathPrefix(`/adminer`) || PathPrefix(`/adminer/`))
      - traefik.http.routers.adminer.entrypoints=websecure
#      - traefik.http.routers.adminer.tls.certresolver=myresolver
      - traefik.http.routers.adminer.tls.certresolver=mytlschallenge
      - traefik.http.services.adminer.loadbalancer.server.port=8080

Share the output returned by the last node

Information on your n8n setup

  • n8n version:latest
  • Postgres
  • Docker compose
  • Ubuntu

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:

Hello I mention it below.

Hi @David_Semenenko, I am sorry you are having trouble.

“Bad Gateway” suggests your reverse proxy server isn’t able to talk to n8n. Any errors in your server logs (you can view them using docker compose logs for example)? Can you reach n8n directly from your server using curl -v http://127.0.0.1:5678 for example?

I found problem, I was using workers with own executions process.

Error:

 # worker7:
 #   image: custom-nodes-n8n
 #   command: "n8n worker"
 #   environment:
 #     - NODE_ENV=production
 #     - DB_TYPE=postgresdb
 #     - DB_POSTGRESDB_HOST=
 #     - DB_POSTGRESDB_DATABASE=
 #     - DB_POSTGRESDB_USER=n8n
 #     - DB_POSTGRESDB_PASSWORD=
 #     - EXECUTIONS_PROCESS=own
 #     - QUEUE_BULL_REDIS_HOST=redis
 #     - QUEUE_BULL_REDIS_PORT=6379

Fixed:

worker1:
    image: custom-nodes-n8n
    command: "n8n worker"
    environment:
      - NODE_ENV=production
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=
      - DB_POSTGRESDB_DATABASE=
      - DB_POSTGRESDB_USER=
      - DB_POSTGRESDB_PASSWORD=
      - EXECUTIONS_PROCESS=main
      - QUEUE_BULL_REDIS_HOST=redis
      - QUEUE_BULL_REDIS_PORT=6379

  #worker2
  worker2:
    image: custom-nodes-n8n
    command: "n8n worker"
    environment:
      - NODE_ENV=production
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=
      - DB_POSTGRESDB_DATABASE=
      - DB_POSTGRESDB_USER=
      - DB_POSTGRESDB_PASSWORD=
      - EXECUTIONS_PROCESS=queue
      - QUEUE_BULL_REDIS_HOST=redis
      - QUEUE_BULL_REDIS_PORT=6379

Logs:
"warn | Own mode has been deprecated and will be removed in a future version of n8n. If you need the isolation and performance gains, please consider using queue mode. “”

At some point too many workflow processes accumulated in the database, and n8n tried to do them simultaneously.

but I have another question. How can I how can I increase productivity? because I have a lot of workflow