Closed samvdb closed 6 years ago
Sure... More than happy to accept PR... :)
So I will be forking this soon and providing a PR, I will be doing most of the the current labels that are currently available, except for the "segment" labels, as I haven't seen how those work, as of this moment.
My current example of most of the labels: https://docs.traefik.io/configuration/backends/file/
The list I'll be basing the labels of: https://github.com/containous/traefik/blob/master/docs/configuration/backends/rancher.md
Most of the labels I'll be adding would be based around what's shown in: https://docs.traefik.io/configuration/backends/file/
If anybody knows a more detailed .toml file, or at least provide an example of one somewhere that I can look at, I would try and base it off that.
@rawmind0 I am trying to figure out where the dynamic file is being created after reading the traefik.tmpl file.
I have checked /opt/traefik/etc/rules.toml but that always seems to stay empty.
Is there a specific place this file gets created? If I can find the file that gets created, or at least see the output of the template, I can make sure what I have done is at least correct.
@refusetofeel , racher-template reads tmpl configuration from /opt/tools/rancher-template/etc/traefik.yml
It generates /opt/traefik/etc/rules.toml
based on traefik labels found at rancher metadata service. If you get an empty file is due to you don't have any configured service. Output is based on file you reference, https://docs.traefik.io/configuration/backends/file/
@rawmind0, I think that's where I am getting confused, I currently have 3 services running, but when I use the terminal in the container and I use vi, I get an empty file. Also /opt/tools/rancher-template/etc/traefik.yml I assume is under root? I don't see it anywhere else.
@refusetofeel What traefik rancher integration are you using?? It's just works for external
.... For api
or metadata
no file is used..Built in integration...
@rawmind0 Ah, ok, yeah, I am using metadata. That you know of, any possible way to see the output? or at least see the rules its currently running on?
No output here.... This is traefik built in integration....All labels should be added...Templates available at traefik github repo, https://github.com/containous/traefik/blob/master/templates
Ah ok, I see, that actually helps, I'll see what I can do. Thanks @rawmind0
So I ran into an issue where I had created the whole template with the labels, and I was only able to get some part of it working, nothing special worked with the frontends, other then authbasic which was the only thing left under the normal configuration for a frontend.
I even hard coded most of the configuration for the frontends, and those did not take, so I think the label limitation is dependent on the traefik version.
I then updated from alpine-traefik:1.5.4-0 to alpine-traefik:1.6.0-0, and it seems all labels have started to work.
Weird thing is, I don't think it uses the template at all to create the rules. I erased everything I had in the template and ran traefik with a blank template, everything worked as it should have, all labels work and even https works. (granted I am using the current labels list, not the one provided by the template, so make sure you update to that)
So it seems traefik 1.6 added the full support needed for rancher, and acme.
I have 1.6 in production. seems stable yet with full support of all labels. Used it to enable CORS in a App. Exact version I'm using: 1.6.0-rc6
I just built the traefik-alpine image with version replaced to 1.6.0-rc6
@okaufmann I can attest to it being stable.
Although you should do the upgrade to the stable version, not the RC version, since in theory that should be the most stable version :), plus you get all the rest of the bug fixes.
I have been running the current 1.6 version for a couple days without an issues. I have also tried a few different labels and I can say that it's been working flawlessly. I haven't tested the segment labels yet, but by the way it looks, it should would work without issue.
@rawmind0 I think you would need to update the docker file, probably don't need to include the acme sidekick or the template file anymore.
Also probably best to add the new default acme server to the config, if you haven't already.
@refusetofeel , template neither acme sidekick are in Dockerfile. Template is just used for traefik with external integration. I think this concrete issue should be at rawmind0/alpine-traefik and not here, if you are using api or metadata integration. Acme sidekick is just for manage storage volume, not a functional sidekick, but it's not at Dockefile, just at compose files if you enable acme support.
@rawmind0 Oh, no wonder it never worked for me, my bad. I guess I was confused since the read me never included that in order for the template to be used, it would need to be run using the external integration. I figured it was used by all three methods.
Anyways, in that case, I will work on trying to test the external configuration, and see if what I have done so far works, and then do the PR.
Traefik 1.6.0 runs great in rancher. Everything is supported now, for clustering with acme you need to use consul though.
I dont want to sound ungrateful for your good work @rawmind0, but i believe the custom docker image can be deprecated now.
@refusetofeel , i tried to document it at traefik community-catalog package, explaining that there are 3 distinct integrations, 2 traefik built in, metadata
(recommended) and api
, and external
that use this image. Sorry if it's not so much clear.
No problem @samvdb , i was contributing to code traefik built in integration with rancher. At the moment it was ready, this image became deprecated or almost, due to built in integration is better. :)
As you can see on the configuration gist for rancher, they include more labels that are not implemented yet.
Tested in rancher v1.6.15-rc4 with traefik 1.5.4. Stuff like treafik.frontend.errors or redirect.permanent and traefik.frontend.whitelistSourceRange would be great additions.
https://github.com/containous/traefik/blob/master/docs/configuration/backends/rancher.md