Labels in docker-compose are not updatable at runtime so I'd like to keep most of my rules and other Traefik configuration outside of docker-compose, ideally setting only a "traefik.enable=true" label there.
Using v2.0-beta, I tried declaring routing rules in traefik.toml/traefik.yml, guessing various permutations of namespace (eg, 'http.routers.someName') and service name as displayed in http://localhost:8080/api/http/services
(eg, 'sinatra-api_webstack@docker') but nothing works and I can't find documentation explaining conventions or syntax.
If possible, can you please share an example or explain the syntax?
Please let me know if the answer would differ for v1.7--I'll likely downgrade versions later today. (Because it's easier to find full examples from third parties.)
Cross provider reference was not possible in the 1.7, this is a new functionality of the v2, and the only thing you have to do, is to reference the full qualifier of you're service created in docker.
https://docs.traefik.io/v2.0/middlewares/overview/#provider-namespace
So for example in the provider file you need to create a router like this.
[http.routers.test]
rule = "PathPrefix(`/`)"
service = "sinatra-api_webstack@docker"
It should work, and if it doesn't work could you share your docker-compose
, your traefik.toml
and the debug log?
Thanks. I thought I tried that (with yml though) but haven't had a chance to revisit--will try again after I finish an active project and write again.