E
E
EmachinesDIMA2022-01-04 15:35:12
Docker
EmachinesDIMA, 2022-01-04 15:35:12

How to properly connect docker services to traefik?

Hello everyone and Happy New Year!

Please tell me the "best practices" and competent ones for "inclusion" of traefik in the project as a replacement for jwilder/nginx-proxy ?

was guided by this article (taken as a basis) - https://habr.com/ru/post/508636/

configuration files:
https://pastebin.com/uvahpzyF - traefik.yml
https://pastebin.com/rWswuzzq -
docker -compose.yml

Essence of the question:
1. there is a working project that we decided to cut into independent projects / repositories: CMS , react (front), admin panel, etc. Previously, there was a monolith.
2. We made an independent assembly of projects - each of the modules has its own nginx service.
3. To make everything work as one, we launched jwilder|nginx-proxy as a "substrate". However, the transition to orchestration is ahead and it was decided to move to traefik.

4. I added tags to nginx configs of working services:
labels:
- "traefik.frontend.rule=HostRegexp:{subdomain:[az]+}.domain.com

" did not appear.

In this connection, the question arose: how to connect services to traefik correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Zubkov, 2022-01-05
@EmachinesDIMA

Each service must have its own name. Therefore, for the frontend you write

- "traefik.frontend.rule=HostRegexp:{subdomain:[a-z]+}.domain.com"

For backend:
- "traefik.backend.rule=HostRegexp:{subdomain:[a-z]+}.domain.com"

If it doesn't help, then turn on the debug mode in traefik and look in the logs for what it says.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question