Last active
October 11, 2022 08:50
-
-
Save Noschvie/f7aacaef60108fdf327c3c91c482da18 to your computer and use it in GitHub Desktop.
Node-Red and Traefik : Configuration and Setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.3' | |
services: | |
############################################### | |
#### Traefik Proxy Setup ##### | |
############################################### | |
traefik: | |
image: traefik:latest | |
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: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment