Home Catalogus Traefik
reverse_proxy

Traefik

A modern, cloud-native reverse proxy and load balancer that automatically discovers services.

ARM64 & AMD64
Docker & Rootless Podman
100% Self-Hosted (Geen Lock-in)
RAM Profiel: Gemiddeld
Standaard Poort: Port 80

Waarom deze configuratie?

Snelle Start (Standalone Docker Compose)

Onderstaand compose-fragment is direct te gebruiken in elke Docker- of Podman-omgeving:

services:
  traefik-init:
    image: busybox:1.36
    container_name: njorddeploy-traefik-init
    restart: "no"
    volumes:
      - "./data/traefik/acme-storage:/etc/traefik/acme"
    command:
      - "sh"
      - "-c"
      - "touch /etc/traefik/acme/acme.json && chmod 600 /etc/traefik/acme/acme.json"

  traefik:
    image: traefik:latest
    container_name: njorddeploy-traefik
    restart: unless-stopped
    depends_on:
      traefik-init:
        condition: service_completed_successfully
    security_opt:
      - "no-new-privileges:true"

    command:
      - "--api.dashboard=true"
      - "--log.level=INFO"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--entrypoints.dashboard.address=:8080"
      - "--entrypoints.web.http.redirections.entrypoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"

    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"

    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./data/traefik/acme-storage:/etc/traefik/acme"
      - "./data/traefik/config:/etc/traefik/dynamic/"
      - "./traefik/certs:/etc/traefik/certs:ro"

    networks:
      - njorddeploy_net

    labels:
      - "traefik.enable=true"
      - "traefik.http.middlewares.traefik-auth.basicauth.users=admin:$$apr1$$526B9557$$sKx5.cVfgrd3n2V3bV0S9/"
      - "traefik.http.routers.traefik-dashboard-direct.entrypoints=dashboard"
      - "traefik.http.routers.traefik-dashboard-direct.service=api@internal"
      - "traefik.http.routers.traefik-dashboard-direct.rule=PathPrefix(`/`)"
      - "traefik.http.routers.traefik-dashboard-direct.middlewares=traefik-auth"
      - "traefik.http.routers.traefik-dashboard-secure.rule=Host(`component_id.njorddeploy.com`)"
      - "traefik.http.routers.traefik-dashboard-secure.entrypoints=websecure"
      - "traefik.http.routers.traefik-dashboard-secure.service=api@internal"
      - "traefik.http.routers.traefik-dashboard-secure.tls=true"
      - "traefik.http.routers.traefik-dashboard-secure.middlewares=traefik-auth"
      - "traefik.http.routers.traefik-dashboard-http.rule=Host(`component_id.njorddeploy.com`)"
      - "traefik.http.routers.traefik-dashboard-http.entrypoints=web"

networks:
  njorddeploy_net:

Start de service direct via de commandline: docker compose up -d

Configuratie & Omgevingsvariabelen

Belangrijkste configuratieparameters en standaardwaarden uit de NjordDeploy component-sjabloon:

Variable Default Value Description
TRAEFIK_CERTIFICATE_METHOD self-signed Select the method for handling SSL certificates. 'self-signed' is the recommended default for local networks and requires no extra setup. 'lets-encrypt' provides a trusted certificate but requires you to own a domain name and forward port 80 from your router to this device.
TRAEFIK_ADMIN_EMAIL {{ DOTENV.LETS_ENCRYPT_REGISTRATION_EMAIL }} Your email address, used for Let's Encrypt registration and recovery.
TRAEFIK_WEB_PORT 8080 The external port to access the Traefik dashboard (e.g., 8080).
TRAEFIK_LOG_LEVEL INFO Logging verbosity. Options: DEBUG, INFO, WARN, ERROR.
TRAEFIK_ACME_STORAGE_PATH /opt/njorddeploy/data/traefik/acme-storage Host directory for storing Let's Encrypt SSL certificates.
TRAEFIK_CONFIG_PATH /opt/njorddeploy/data/traefik/config Host directory for Traefik's dynamic configuration files.
DOMAIN_NAME njorddeploy.com Your public domain name for dashboard access (e.g., traefik.your.domain). Required for Let's Encrypt.
TRAEFIK_DASHBOARD_USERS admin:$apr1$526B9557$sKx5.cVfgrd3n2V3bV0S9/ SECURITY CRITICAL: A 'user:hashed_password' pair for dashboard access. You MUST use a tool like 'htpasswd' to generate a compatible md5 hash (apr1 format). The default value is 'admin:password'. For production, generate a new hash, store it in your .env file (e.g., TRAEFIK_USERS_HASH=...), and reference it here using the macro: {{ DOTENV.TRAEFIK_USERS_HASH }}.

Ecosysteem & Bedrijfsintegratie

Eenvoudig beheren via NjordDeploy

Installeer, bewaak en update deze service met 1 klik op uw eigen Raspberry Pi of Proxmox server via de NjordDeploy Configurator.