I am trying to set up Traefik for the first time. I have almost everything working. In my dynamic config file, it looks like everything is getting loaded except my router. I am not getting any errors in my log file (even with debug turned on), but the router is not showing up
Here is my static config file: traefik.yaml
Here is my dynamic file: dynamic.yaml
Here is my logfile: logfile
It looks to me like it is reading the provider file correctly. It pulls in the service, but not the router. I have checked the syntax in the docs a dozen times and have re-written it multiple times. I cannot figure out what I am doing wrong.
Your missing your router statement in the dynamic.yaml file for the router itself. I'm assuming my router your referring to the traefik dashboard.
Now a couple a ways to do it. Assuming you want your router accessed over http (since in your static traefik.yml you set api to insecure: true, you would construct your dynamic file like this
rule: "Host(`XXX.XXX`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
I obtained this information (with very slight modification from: https://doc.traefik.io/traefik/operations/dashboard/)
Hi @kevdog. Thanks for the reply.
I think I misspoke. I can get to the traefik dashboard internally just fine (I don't want to expose it outside). What I meant is that my router that is in my dynamic.yaml file (named "router-1") does not show up anywhere. It is not in the logs, even though service-1 is in the logs and both the router and the service are in the same dynamic.yaml file.
What I meant is that when I look in the dashboard, my router-1 is not in the router part of the dashboard.
I would have expected that if there was a problem with my yaml file I would get an error in the logs (since I have the debug level set).
Traefik set up the api router automatically because the insecure option is set (you can see this in the logs), so in my dashboard, I do have 4 routers for the api. But not the one router that I specified.
Ok sorry I totally misread your post .. Sorry
Ok so since I'm fairly new to traefik as well, if your only route doesn't show up within the dashboard it means something is probably wrong with your dynamic configuration file. One wrong line in the dynamic config files pretty much takes down the entire file (which is really annoying) but I've been told that's how yaml processers work. Anyway I took a second look at your dynamic config file and here are things you could possibly try:
- Dont need additional http declaration on line 14
- Your options line (like #10) - need to be something like options: acme@file
- You may need like a dummy declared middlewares section (I'm not sure, but I was told each route needs a rule, middlewares and service section). For middlewares I usually do the following (I have no idea if this is necessary but you could try:
Then I would reference this in the routers section:
- main: "XXX.XXX"
- Lastly -- From just copying and pasting some of your stuff -- (which it could be paste bin for all I know) -- make sure that line idents are only two spaces (not 3 or 4).
Look in your logs -- There should be something regarding loading the config file from your dynamic file and sometimes there are clues to what line the configuration is choking at. It's really hard at first since I admit sometimes there isn't a good clue whats going on.
Hi @kevdog, thanks for all the help! I will try some of these later today. I didn't know a middleware was required, I don't need one, so that dummy one is helpful, thanks. In the docs when they give examples for routers, they do not have middlewares. They only have middlewares in the middleware part of the doc. So I assumed it was not required.
Haha yeah I am not good with yaml, I will change all my spacing.
I agree, I would have expected errors in the yaml file to be in the log files, but I have the log level at debug and there is nothing in the logfile about this. I have the logfile up above, does it look correct? Is there something I am missing to get more detail in the log?
That's the thing which kind of drives me crazy. They mention the dynamic config one time in the log file and that's it. Nothing else. This means something is wrong with the config file and I'm betting its the yaml space requirements. The debugging could be way better if you ask me. Usually if the file format is correct you're going to see lines talking about your router and setting up the router and services from the file. The very fact that none of this stuff isn't even mentioned -- there's a problem.
Okay, that makes sense. But the fact that the service-1 in my dynamic config is read in correctly (it is in the logs) is odd, since it is below my router-1 in the yaml. So if the router-1 was wrong and it stopped reading the yaml, I would not expect the service-1 to be there. I'll double check everything tonight. Thanks again for the help!
I agree with you --- it is confusing. Perhaps there is another explanation.
Okay, the problem was your 1. comment above - the second http overwrites the first. So it doesn't even see the router. I removed that and I get a new error now. Thanks for your help! But it looks like the 3 spaces was okay. Yaml is weird.
Ok awesome, if you need help just post. Thanks.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.