-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fails to trigger in presence of other middlewares #13
Comments
Hey @flargargoyl have you set up the When the container is stopped, the service takes over listening to the traefik route (by listening to |
@adyanth yes, i have. Copied what was in |
just got a guess. I have used another middleware handler to catch the http error codes and redirect them to be using a custom page. Feels like this may have broken this catching route. I`ll shut down that custom error page handler and re-test and come back with the results. |
Ahh yes, that would do it. You can try keeping the custom page middleware after this one to see if that helps. For logs, the combination of traefik and the service logs usually gets to the issue. |
ive checked both but it didn't gave me the reason for not starting the container up again, nor any attempt off doing so and ive noticed absence of the route for 'nyc' service, hence thought its related. I'll test around the error handler, its not required in my setup, just a gimmic anyways. Will come back here in either case to update. Thanks for your support. |
@adyanth okay, that was not it. I think i'm lost in those configs. http: Do i need to change it`s names? ive changed entropion to mine as i have http and https, so that's working. heres manager and service compose parts manager: nyc: ports:- "${NYC_PORT:-8080}:8080"
- traefik.http.services.nyc.loadbalancer.server.port=80
- traefik-container-manager.path=/whoami # Prefix matched to the incoming path.
|
to add to that, i`ve copied the whoami service configuration https://github.com/adyanth/traefik-container-manager/blob/main/docker-compose.yml from here, changed entripoint name (i use http and https). Manager uses both. whoami service is running and i see its routers, servicies and middleware in Traefik, however i CANNOT reach it via my subdomain. Container is accessible via same network as Traefik, and is started, but something in routing dosen`t work. Ive also saved this in a separate file in my dynamic configuration folder, but i |
Can you please upload the yaml files or quote them using code blocks? From your initial log:
That comes from https://github.com/adyanth/traefik-container-manager-service/blob/760c4570422cb52c129c789d6b2101cdd3ecafed/main.go#L287 Which means that the container was indeed started. Can you please let the container be stopped, send a request and run PS: You need to define both the plugin and the plugin config per container. If you share the yaml properly, I can take a look and correct it for you. |
sorry, only now noticed broken formatting. Here`s my configuration for manager, nyc and whoami. manager: nyc: whoami: |
did another test. Made sure nyc is started, seen it`s "face", looking at logs of Manager: today at 1:51:08 PMServer listening on port 10000. tried accessing the web of nyc few more times. Checked container status with docker compose ps - its been nyc exited (0) every time. |
You also have whoami running right? Does it work as expected? Could you also share the logs from Traefik itself? The middleware logs are written to the traefik logs itself. Let me try this on my system to make sure I am not missing something obvious here. |
no, whoami is still not working. Container is up, traefik sees it, but i can let me see traefik logs for ncy and whoami, i need to clear few things from them but will post them soon. |
nyc traefik logs whoami traefik logs |
note, ive removed FQDN and email from those logs |
Can you please re pull and update the adyanth/traefik-container-manager-service image? It might not have been up to date with the repository. I just built/pushed it and tested it with the default whoami config and it works with both host and port configs and it worked fine for me. Those logs look acceptable to me, the problem is with the manager service itself, if any. Please attach the manager logs after updating it if it fails. |
updated the image, done docker compose up -d nyc manager traefik whoami --force-recreate https://pastebin.com/frytaDeM manager logs same deal. nyc is accesible once, killed with timeout and never spun up again. was i correct taking this and putting into a .yml file in my dynamic configuration folder? Do i need to configure it for other services as well? |
ive managed to make whoami work using my "template" of lables whoami:
|
You do not need to add the dynamic config separately. The labels are all you need. The logs you shared do not show any activity after the services were stopped due to timeout. This most definitely points to an issue with the configuration. I tried to reproduce the issue. Adding the below section to the I see one problem though, that is the container has a very slow starting healthcheck that does not let it start until 5-10 sec. Using the YAML below works every time for me. Even without it, you need to wait 10+ seconds once the container stops to start it back up. nyc:
image: modem7/newyearcountdown
healthcheck:
disable: true
labels:
- traefik.enable=true
- traefik.http.routers.nyc.entrypoints=web
- traefik.http.routers.nyc.rule=Host(`localhost`)
- traefik.http.routers.nyc.middlewares=nyc-timeout
- traefik.http.middlewares.nyc-timeout.plugin.traefik-container-manager.timeout=5
- traefik.http.middlewares.nyc-timeout.plugin.traefik-container-manager.name=nyc
- traefik.http.middlewares.nyc-timeout.plugin.traefik-container-manager.ServiceUrl=http://manager:10000/api
- traefik.http.services.nyc.loadbalancer.server.port=8080
- traefik-container-manager.name=nyc
- traefik-container-manager.host=localhost |
i'll try it out. If clearly feels that middlewares i use clashes with this one somehow, but i'm not an expert enough to figure out which and why. |
I'd recommend trying with this middleware as the first one in the chain (or the last one, won't hurt to try both) once the default configuration works for you. |
in my case i had to:
|
Haha, I'm in the same boat! Sure, do remember to reply here if you get it sorted, I'd like to know what it was. If you single it out back to this plugin, feel free to open it back :) |
Ive managed to make it working with default configs. Is there a way to diagnose this or build around? Im using middlewares for security and authentication. And another question. Is there a way to make it work with TCP service \ entrypoint? I've tried, but didn't managed to, traefik was not creating a tcp router. I believe there`s no way to attach custom middleware to a tcp router? |
Hey @flargargoyl I remember using other middlewares along with this but it's been quite some time and I might be remembering it wrong. I will look into that when I get some time. Regarding TCP, yes, there is no way to attach a middleware to a TCP router, and since TCP does not need SNI, there isn't much you can do anyway. Maybe you can add a http middleware to a dummy http route pointing to the same container just as a turn on switch, but then you would need to keep the timeouts large enough. |
@adyanth i see, understood. Will it help if i give you my middlewares configurations? Nothing too fancy, just ensuring proper HTTPS and oauth redirections. |
Sure, please do. If it is any middleware, I should be good to troubleshoot, but if not, your config would definitely help. |
[http.middlewares] [http.middlewares.middlewares-rate-limit] [http.middlewares.middlewares-secure-headers] [http.middlewares.middlewares-oauth] [http.middlewares.middlewares-authelia]
[http.middlewares] [http.middlewares.chain-basic-auth] [http.middlewares.chain-oauth] [http.middlewares.chain-authelia] [http.middlewares.chain-nextcloud]
|
using the available information, configured servcie
manager:
image: adyanth/traefik-container-manager-service
expose:
- 10000
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
networks:
t2_proxy:
labels:
- traefik.enable=true
- traefik.http.routers.manager.entrypoints=http
- traefik.http.routers.manager.rule=HostRegexp(
{host:.+}
)- traefik.http.routers.manager.priority=1
- traefik.http.middlewares.manager.errors.status=404
- traefik.http.middlewares.manager.errors.service=manager
- traefik.http.middlewares.manager.errors.query=/
- traefik.http.routers.manager.middlewares=manager-timeout
- traefik.http.services.manager.loadbalancer.server.port=80
- traefik.http.middlewares.manager-timeout.plugin.traefik-container-manager.Name=generic-container-manager
- traefik.http.middlewares.manager-timeout.plugin.traefik-container-manager.ServiceUrl=http://manager:10000/api
lables on target service:
- "traefik.http.routers.nyc-rtr.middlewares=chain-oauth@file" # Google OAuth 2.0
manager
today at 10:57:56 PM- Service nyc is up
today at 10:57:56 PM&{nyc 60 0xc0000560e0 true}
today at 10:57:56 PMSent delay
today at 10:58:02 PMSleeping 60
today at 10:59:02 PMStopping service nyc
today at 10:59:02 PMService: &{name:nyc timeout:60 host: path: time:0xc0000560e0 isHandled:true}
today at 10:59:02 PMContainers [{9d15618ecffef4ee6a7b15d05bd1309a5c122a8b248ffefc413ba4f66657f876 [/nyc] modem7/newyearcountdown:latest sha256:1f724b5e683ddf48732153b7bc8792a60e991ecbd9df46a3ad998b2c09dbbc1e /docker-entrypoint.sh nginx -g 'daemon off;' 1657482972 [{ 8080 0 tcp}] 0 0 map[com.docker.compose.config-hash:aaaed66675816690a37325ccfee1567536a9b314cddf1e7ce27e0059d042022a com.docker.compose.container-number:1 com.docker.compose.depends_on: com.docker.compose.image:sha256:1f724b5e683ddf48732153b7bc8792a60e991ecbd9df46a3ad998b2c09dbbc1e com.docker.compose.oneoff:False com.docker.compose.project:docker com.docker.compose.project.config_files:/home/flar/docker/docker-compose.yml com.docker.compose.project.working_dir:/home/flar/docker com.docker.compose.service:nyc com.docker.compose.version:2.6.0 maintainer:NGINX Docker Maintainers [email protected] traefik-container-manager.host:nyc traefik-container-manager.name:nyc traefik.enable:true traefik.http.middlewares.nyc-timeout.plugin.traefik-container-manager.ServiceUrl:http://manager:10000/api traefik.http.middlewares.nyc-timeout.plugin.traefik-container-manager.name:nyc traefik.http.middlewares.nyc-timeout.plugin.traefik-container-manager.timeout:60 traefik.http.routers.nyc-rtr.entrypoints:https,http traefik.http.routers.nyc-rtr.middlewares:nyc-timeout traefik.http.routers.nyc-rtr.rule:Host(
nyc.zayir.org.ua
) || Host(nyc.lan
) traefik.http.routers.nyc-rtr.service:nyc-svc traefik.http.routers.nyc-rtr.tls:true traefik.http.routers.nyc-rtr.tls.options:myTLSOptions@file traefik.http.services.nyc-svc.loadbalancer.server.port:8080] running Up 2 minutes (healthy) {t2_proxy} 0xc0003ac030 []}]today at 10:59:02 PMUsing name: nyc
today at 10:59:02 PMmodem7/newyearcountdown:latest running
After the last record, if i try to access the URL of the nyc service, nothing happens. URL returns 404.
Can it be related to the fact that after the container stopped, traefik dosen`t have its route anymore?
The text was updated successfully, but these errors were encountered: