Hello *
I have a docker instance with my owncloud and I want to protect it with the GeoBlock plugin. I have the following in my docker-compose.yaml file for the owncloud:
For my monitor instance of traefik which is defined in the traefik.toml (traefik_dynamic.toml) this works fine. In my HTTP Middlewares entry I see my GeoBlock middleware and it also works when I try to connect via proxy from a different country. But for docker it doesn't. Do I miss something?
Hello @tommoulard ,
yes sure. Thank you for the quick reply. So I followed this tutorial. So my owncloud docker docker-compose.yml looks like in this tutorial. I have the following labels to register the instance with my traefik docker instance:
services:
owncloud:
image: owncloud/server:${OWNCLOUD_VERSION}
restart: always
depends_on:
- db
- redis
environment:
- ...
networks:
- web
- internal
labels:
- "traefik.enable=true"
- "traefik.http.routers.owncloud.rule=Host(`${OWNCLOUD_DOMAIN}`)"
- "traefik.http.routers.owncloud.tls=true"
- "traefik.http.routers.owncloud.tls.certresolver=lets-encrypt"
# I experimented with different flags but no success
#- "traefik.http.routers.owncloud.middlewares=geoblock"
#- "traefik.http.routers.owncloud.middlewares=geoBlock@file"
#- "traefik.http.middlewares.geoblock.plugin.GeoBlock.api=https://get.geojs.io/v1/ip/country/{ip}"
#- "traefik.http.middlewares.geoblock.plugin.GeoBlock.countries=US"
- "traefik.port=8080"
- "traefik.docker.network=web"
db:
...
redis:
...
And my traefik.toml file looks like the following:
With this config, the geo blocking works for my monitor instance of Traefik and I also see my Owncloud instance in the monitor. So the communication between traefik and my owncloud container seems to work fine. I have this setup running since a while. I just though it makes sense to block requests from other countries since I only have 2 users for my instance and we are both located in the same place.
But I don't understand what I have to do to enable it for my Owncloud Docker instance. As shown above I tried to define it in the labels sections of the docker-compose.yml but no success...
Edit: I think this is what I get from my traefik log file when I start my owncloud docker container:
does the trick to reference a middleware defined in the traefik_dynamic.toml
I'm not sure why it didn't work before. But maybe it was due to the fact that I just did a simple docker-compose restart, which might not be enough. After performing a full docker-compose down and docker-compose up -d on both containers now it seems to work. Jippie! Thanks anyway.