Skip to content

Commit

Permalink
local-dev: traefik: use file configuration
Browse files Browse the repository at this point in the history
This means the docker socket doesn't need to be mounted into the traefik
container, at the cost/advantage of putting the config in separate files
instead of container labels.

Signed-off-by: Hank Donnay <hdonnay@redhat.com>
  • Loading branch information
hdonnay committed Nov 11, 2021
1 parent 0fd1120 commit 3ee44c1
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 0 deletions.
40 changes: 40 additions & 0 deletions local-dev/traefik/config/clair.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
http:
entrypoint:
clair:
address: ':6060'
routers:
indexer:
entryPoints: [clair]
rule: 'PathPrefix(`/indexer`)'
service: indexer
matcher:
entryPoints: [clair]
rule: 'PathPrefix(`/matcher`)'
service: matcher
notifier:
entryPoints: [clair]
rule: 'PathPrefix(`/notifier`)'
service: notifier
services:
indexer:
loadBalancer:
servers:
- url: "http://clair-indexer:6060/"
healthCheck:
path: /healthz
port: 8089
matcher:
loadBalancer:
servers:
- url: "http://clair-matcher:6060/"
healthCheck:
path: /healthz
port: 8089
notifier:
loadBalancer:
servers:
- url: "http://clair-notifier:6060/"
healthCheck:
path: /healthz
port: 8089
17 changes: 17 additions & 0 deletions local-dev/traefik/config/dashboard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
http:
routers:
api:
entryPoints: [traefik]
rule: 'PathPrefix(`/api`) || PathPrefix(`/dashboard`)'
service: 'api@internal'
dashboard-redirect:
entryPoints: [traefik]
rule: 'Path(`/`)'
middlewares: [dashboard-redirect]
service: 'api@internal'
middlewares:
dashboard-redirect:
redirectRegex:
regex: '.*'
replacement: '${1}/dashboard/'
14 changes: 14 additions & 0 deletions local-dev/traefik/config/grafana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
http:
routers:
grafana:
entryPoints: [traefik]
rule: 'PathPrefix(`/grafana`)'
service: grafana
services:
grafana:
loadBalancer:
servers:
- url: "http://clair-grafana:3000/"
healthCheck:
path: /grafana/api/health
14 changes: 14 additions & 0 deletions local-dev/traefik/config/jaeger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
http:
routers:
jaeger:
entryPoints: [traefik]
rule: 'PathPrefix(`/jaeger`)'
service: jaeger
services:
jaeger:
loadBalancer:
servers:
- url: "http://clair-jaeger:16686/"
healthCheck:
path: /
14 changes: 14 additions & 0 deletions local-dev/traefik/config/pgadmin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
http:
routers:
pgadmin:
entryPoints: [traefik]
rule: 'PathPrefix(`/pgadmin`)'
service: pgadmin
services:
pgadmin:
loadBalancer:
servers:
- url: "http://clair-pgadmin/"
healthCheck:
path: /pgadmin
13 changes: 13 additions & 0 deletions local-dev/traefik/config/postgresql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
tcp:
routers:
postgresql:
entryPoints: [postgresql]
service: postgresql
# Traefik docs say this hack is needed if not using TLS.
rule: 'HostSNI(`*`)'
services:
postgresql:
loadBalancer:
servers:
- address: 'clair-database:5432'
14 changes: 14 additions & 0 deletions local-dev/traefik/config/prom.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
http:
routers:
prom:
entryPoints: [traefik]
rule: 'PathPrefix(`/prom`)'
service: prom
services:
prom:
loadBalancer:
servers:
- url: "http://clair-prometheus:9090/"
healthCheck:
path: /prom/-/healthy
20 changes: 20 additions & 0 deletions local-dev/traefik/traefik.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
global:
sendAnonymousUsage: false
api:
insecure: false
dashboard: true
entryPoints:
traefik:
address: ':8080'
clair:
address: ':6060'
postgresql:
address: ':5432'
providers:
file:
directory: /etc/traefik/config
metrics:
prometheus:
addServicesLabels: true
accessLog: {}

0 comments on commit 3ee44c1

Please sign in to comment.