Closed ramonsmits closed 1 year ago
My current configuration:
traefik docker-compose.yml
version: "3.3"
services:
traefik:
image: traefik:v2.9
container_name: traefik
volumes:
- ./traefik.yml:/etc/traefik/traefik.yml
- /var/run/docker.sock:/var/run/docker.sock
- ./letsencrypt:/letsencrypt
- ./dynamic-configuration.yml:/etc/traefik/dynamic-configuration.yml
- ./geoblock:/plugins-local/src/github.com/PascalMinder/geoblock/
network_mode: host
dynamic-configuration.yml
http:
middlewares:
geoblock:
plugin:
GeoBlock:
allowLocalRequests: true
logLocalRequests: false
logAllowedRequests: false
logApiRequests: true
api: "https://get.geojs.io/v1/ip/country/{ip}"
apiTimeoutMs: 750
cacheSize: 25
forceMonthlyUpdate: true
allowUnknownCountries: false
unknownCountryApiResponse: nil
countries:
- NL
traefik.yml
providers:
file:
filename: /etc/traefik/dynamic-configuration.yml
watch: true
experimental:
localPlugins:
geoblock:
moduleName: github.com/PascalMinder/geoblock
whoami docker-compose.yml
version: "3.3"
services:
whoami:
image: traefik/whoami:latest
container_name: whoami
environment:
- WHOAMI_PORT_NUMBER=82
labels:
- traefik.enable=true
- traefik.http.routers.whoami.rule=host(`whoami.smigo.nl`)
- traefik.http.routers.whoami.entrypoints=http
- traefik.http.services.whoami.loadbalancer.server.port=82
- traefik.http.routers.whoami.middlewares=compression,geoblock@file
network_mode: host
Tried to use geoblock@file
and geoblock
but both don't work.
The version on plugins.traefik.io
has not the last read me. I updated the readme in one of the commits after the last release. That's the reason, that the readme on plugins.traefik.io
and on GitHub are not the same. The one on GitHub should be better. ;)
It does not matter to Traefik if you map the configuration to /etc/traefik/dynamic-configuration.yml
or /dynamic-configuration.yml
. But yes, I see, it is confusing using both in the same readme.
There is an example under docker
with everything you need to create the Traefik container and two whoami
containers. What I see in your config:
http:
middlewares:
geoblock: # i am not sure if this could be a problem with the same name, try using something like my-geoblock
plugin:
GeoBlock: # write this in lower case
allowLocalRequests: true
logLocalRequests: false
logAllowedRequests: false
logApiRequests: true
api: "https://get.geojs.io/v1/ip/country/{ip}"
apiTimeoutMs: 750
cacheSize: 25
forceMonthlyUpdate: true
allowUnknownCountries: false
unknownCountryApiResponse: nil
countries:
- NL
The README, the geoblock guidance on plugins.traefik.io and the info there underneath the Install Plugin isn't aligned and sort of contradicting.
I'm using Traefik v2.9.0-rc4 and cannot get it to work
What is the CORRECT dynamic configuration path?
Options:
a.
- /docker/config/traefik/dynamic-configuration.yml:/etc/traefik/dynamic-configuration.yml
(README) b.- "/a/docker/config/traefik/data/dynamic-configuration.yml:/dynamic-configuration.yml"
(README, but lower)What is the correct way to install plugin?
From plugins.traefik.io description:
From plugins.traefik.io Install Plugin:
From README:
- /docker/config/traefik/plugin/geoblock:/plugins-local/src/github.com/PascalMinder/geoblock/
volumeexperimental.localPlugins
(instead ofexperimental.plugins
as plugins.traefik.io Install Plugin states)