Roy
Roy

Reputation: 5

EPRNext is not available with Traefik v3.0

I deployed ERPNext through docker compose and used Traefik as proxy. It can connect to ERPNext through port 80 in 2.10, but in order to support OpenTelemetry, I upgraded it to v3.0, and ERPNext cannot be connected through it. Below is my docker compose.

version: "3.8"

services:
  frontend:
    image: frappe/erpnext:${ERPNEXT_VERSION}
    platform: linux/amd64
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - nginx-entrypoint.sh
    environment:
      BACKEND: backend:8000
      FRAPPE_SITE_NAME_HEADER: frontend
      SOCKETIO: websocket:9000
      UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
      UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
      UPSTREAM_REAL_IP_RECURSIVE: "off"
      PROXY_READ_TIMEOUT: 120
      CLIENT_MAX_BODY_SIZE: 50m
    labels:
      - traefik.enable=true
      - traefik.http.services.frontend.loadbalancer.server.port=8080
      - traefik.http.routers.frontend.entrypoints=web
      - traefik.http.routers.frontend.rule=HostRegexp(`{any:.+}`)
    volumes:
      - sites:/home/frappe/frappe-bench/sites
      - logs:/home/frappe/frappe-bench/logs

  proxy:
    image: traefik:v3.0
    command:
      - --api.insecure=true
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
      - --entryPoints.web.address=:80
      - --log.level=DEBUG
      - --tracing=true
      - --tracing.serviceName=ERPNext
      - --tracing.otlp=true
      - --tracing.otlp.grpc=true
      - --tracing.otlp.grpc.insecure=true
      - --tracing.otlp.grpc.endpoint={otel-collector-hostname}:4317
    depends_on:
      - frontend
    ports:
      - 80:80
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    userns_mode: host

I tried checking via Traefik Dashboard but its status says Success.
Traefik Dashboard

It works in Traefik 2.10 when I read port 80 in the browser. However, in v3.0, a 404 not found error occurs. The only difference between the two is the Traefik version. Please ignore otel's configuration because it is only supported above 3.

Traefik 2.10:
browser.

Traefik 3.0:
404

Upvotes: 0

Views: 46

Answers (1)

bluepuma77
bluepuma77

Reputation: 471

With v3 of Traefik some regex handling changed (doc), so HostRegexp(`{any:.+}`) is probably the issue.

New V3 Syntax Notable Changes HeaderRegexp, HostRegexp, PathRegexp, QueryRegexp, and HostSNIRegexp matchers now uses the Go regexp syntax.

You might be able to work around with:

# static configuration
core:
  defaultRuleSyntax: v2

Note that you should probably not use

  proxy:
    image: traefik:v3.0
    ...
    depends_on:
      - frontend

as Traefik will not be able to serve other services when the one is down.

Upvotes: 0

Related Questions