# \*\*\*Guide\*\*\* Node-Red and Traefik : Configuration and Setup

**URL:** <https://forum.hhf.technology/t/guide-node-red-and-traefik-configuration-and-setup/143>\
**Category:** Tutorials\
**Tags:** traefik, docker-compose, node-red, docker\
**Created:** [August 16, 2023, 11:14am UTC](https://forum.hhf.technology/t/guide-node-red-and-traefik-configuration-and-setup/143 "2023-08-16T11:14:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hhf.technoloy](https://forum.hhf.technology/user_avatar/forum.hhf.technology/hhf.technoloy/32/68_2.png) [@hhf.technoloy](https://forum.hhf.technology/u/hhf.technoloy)\
**Post date:** [August 16, 2023, 11:14am UTC](https://forum.hhf.technology/t/guide-node-red-and-traefik-configuration-and-setup/143/1 "2023-08-16T11:14:00Z")

</div>

```yaml
version: '3.3'

services:
  ###############################################
  #### Traefik Proxy Setup #####
  ###############################################
  traefik:
    image: traefik:v2.11
    container_name: traefik
    restart: always
    ports:
      - "80:80" # <== http
      - "8060:8080" # <== :8080 is where the dashboard runs on
    command:
    #### These are the CLI commands that will configure Traefik and tell it how to work! ####
      ## API Settings - https://docs.traefik.io/operations/api/, endpoints - https://docs.traefik.io/operations/api/#endpoints ##
      - --api.insecure=true # <== Enabling insecure api, NOT RECOMMENDED FOR PRODUCTION
      - --api.dashboard=true # <== Enabling the dashboard to view services, middlewares, routers, etc...
      - --api.debug=true # <== Enabling additional endpoints for debugging and profiling
      ## Log Settings (options: ERROR, DEBUG, PANIC, FATAL, WARN, INFO) - https://docs.traefik.io/observability/logs/ ##
      - --log.level=INFO # <== Setting the level of the logs from traefik
      ## Provider Settings - https://docs.traefik.io/providers/docker/#provider-configuration ##
      - --providers.docker=true # <== Enabling docker as the provider for traefik
      - --providers.docker.exposedbydefault=false # <== Don't expose every container to traefik, only expose enabled ones
      ## Entrypoints Settings - https://docs.traefik.io/routing/entrypoints/#configuration ##
      # Traefik will listen to incoming request on the port 80 (HTTP)
      - --entrypoints.web.address=:80 # <== Defining an entrypoint for port :80 named web
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock # <== Volume for docker admin
    labels:
    #### Labels define the behavior and rules of the traefik proxy for this container ####
      - traefik.enable=true # <== Enable traefik on itself to view dashboard and assign subdomain to view it
      - traefik.http.routers.api.service=api@internal # <== Enabling the api to be a service to access
      - traefik.http.routers.traefik.rule=PathPrefix(`/api`) || PathPrefix(`/dashboard`)

  ###############################################
  #### Site Setup Container #####
  ###############################################
  whoami:
    image: containous/whoami
    container_name: simple-service
    labels:
      #### Labels define the behavior and rules of the traefik proxy for this container ####
      - traefik.enable=true # <== Enable traefik to proxy this container
      # Allow request only from the predefined entry point named "web"
      - traefik.http.routers.whoami.entrypoints=web
      # The domain the service will respond to
      - traefik.http.routers.whoami.rule=Host(`whoami.myDomain.local`)

  ###############################################
  #### Node-red Container #####
  ###############################################
  nodered:
    image: ctmagazin/ctnodered:latest
    container_name: node-red
    restart: always
# ports:
# - "1880:1880"
    volumes:
      - nodered_data:/data
      - /etc/localtime:/etc/localtime
    environment:
      - TZ=Europe/Vienna
    labels:
    #### Labels define the behavior and rules of the traefik proxy for this container ####
      - traefik.enable=true # <== Enable traefik to proxy this container
      # Allow request only from the predefined entry point named "web"
      - traefik.http.routers.nodered.entrypoints=web
      # The domain the service will respond to
      - traefik.http.routers.nodered.rule=Host(`dashboard.myDomain.local`)
      - traefik.http.routers.nodered.middlewares=add-ui,auth
      - traefik.http.middlewares.add-ui.addprefix.prefix=/ui
      # Declaring the user list
      - traefik.http.middlewares.auth.basicauth.users=admin:$$2y$$05$$xWXh2U94hXGAWa2gRR/feuzHgX0n65uyGdD9XGdj4wYMwJvrMtd/G

volumes:
  nodered_data:

```
