First draft of working 2.0 traefik

This commit is contained in:
Simon 2019-09-30 21:07:54 +02:00
parent eb1a2ee38c
commit c1197a4fba
4 changed files with 64 additions and 51 deletions

View File

@ -1,45 +1,36 @@
version: '3' version: '3'
# Create 3 node-red docker containers ready to operate behind traefik Reverse proxy
services: services:
nodered1: #Nodered Docker container 1 whoami:
image: nodered/node-red-docker:latest # A container that exposes an API to show its IP address
restart: always image: containous/whoami
user: root
environment:
- TZ= America/New_York
networks:
- web
volumes:
- /home/simon/docker/noder_data/:/data # Do nor forget to set NR volumes
ports:
- "1882:1880"
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.backend=nodered1" - "traefik.http.routers.whoami.rule=Host(`whoami.localhost`)"
- "traefik.docker.network=web" - "traefik.http.routers.whoami.entrypoints=web"
- "traefik.frontend.rule=Host:node.docker.localhost"
whoami:
image: emilevauge/whoami
labels:
- traefik.enable=true
- "traefik.frontend.rule=Host:whoami.docker.localhost"
traefix: # Traefix docker compose start here reverse-proxy:
image: traefik:alpine # The official v2.0 Traefik docker image
# command: --api --docker image: traefik:v2.0
restart: always container_name: "traefik"
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
ports: ports:
# The HTTP port
- "80:80" - "80:80"
- "443:443" #- "8080:8080"
- "8080:8080"
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # So that Traefik can listen to the Docker events
- /docker/traefik:/etc/traefik - /var/run/docker.sock:/var/run/docker.sock
networks: - ./traefik.yml:/etc/traefik/traefik.yml
- web - ./static_config.yml:/etc/traefik/static_config.yml
labels:
networks: - "traefik.http.routers.traefik.rule=Host(`tr.localhost`)"
web: - "traefik.http.routers.traefik.entrypoints=web"
external: true - "traefik.http.services.service1.loadbalancer.server.port=8080"
- "traefik.enable=true"

14
static_config.yml Normal file
View File

@ -0,0 +1,14 @@
http:
routers:
test-router:
rule: "Host(`test.localhost`)"
service: my-service
entryPoints:
- web
services:
my-service:
loadBalancer:
servers:
- url: https://milvert.com

View File

@ -1,15 +0,0 @@
logLevel = "DEBUG"
defaultEntryPoints = ["http"]
[api]
# Port for the status/dashboard page
dashboard = true
[entryPoints]
[entryPoints.http]
address = ":80"
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "docker.localhost"
exposedByDefault = false

23
traefik.yml Normal file
View File

@ -0,0 +1,23 @@
log:
level: DEBUG
api:
insecure: true
dashboard: true
debug: true
providers:
docker:
exposedbydefault: false
file:
filename: "/etc/traefik/static_config.yml"
watch: true
entryPoints:
web:
address: ":80"