2 ms·
> Traefik isn't that complicated though, definitely worth learning. Hmm, not sure I fully agree here! I recently setup Traefik 2 for the first time, to front
by GordonS 6y ago
> Traefik isn't that complicated though, definitely worth learning.
Hmm, not sure I fully agree here!
I recently setup Traefik 2 for the first time, to front a bunch of containers. I didn't want to do anything particularly complex: expose services on 4 different ports, automatic Let's Encrypt certificates, strip a prefix for one of the services, enable the Traefik dashboard, and a few other bits and bobs.
For context, I've configured nginx (and Apache before it) a few times over the years, and have an in-depth understanding of networking and HTTP. Still, I struggled to get things working - it was like whack-a-mole; I'd get something working, but something else would stop working! As someone else has noted, it's difficult to Google docs/samples, because Traefik 1.x is a thing, and is configured differently.
I was configuring it in my Docker Compose file, and it's quite confusing - some stuff is added in the command line for the entrypoint, while other stuff is as labels. At some point I also realised that you can't quite configure quite everything in this way - some stuff, like TLS config, can only be done in files.
The syntax for config in Compose files is pretty ugly too, and it's not always obvious - middleware config for example.
I'm wondering if I might have made things easier for myself if I'd put all the config in YAML/TOML files instead, but I think the config for every other container was in the compose file, so it seemed more natural to do the same for Traefik. Anyway, next time I think I'll try config files, or maybe try Haproxy instead.