Manage multiple sites with Docker Compose and Traefik

  Рет қаралды 44,906

Andrew Schmelyun

Andrew Schmelyun

Күн бұрын

In this 9 minute video, I'll show you how I use Traefik Proxy in my local Docker environment to route web traffic to app services running in separate containers, on different ports. This is a basic example of a reverse proxy and uses a ready-made image from the Docker Hub!
You'll learn:
- What a good use case for a reverse proxy is
- How to add a Traefik container to your Docker Compose setup
- To route traffic from the browser to a specific Docker container
- 0:00 The setup
- 1:14 Adding Traefik
- 4:08 Routing with host names
- 6:03 Using PathPrefix
- 7:54 That's all
Send me new video ideas and vote on what's coming next: suggest.gg/aschmelyun
Follow me on Twitter! / aschmelyun
Join my newsletter, where I send out new information about twice each month in the PHP, JavaScript, and Docker realms: aschmelyun.substack.com

Пікірлер: 47
@aschmelyun
@aschmelyun Жыл бұрын
You can find the source code for the video as well as some more info on this GitHub repo: github.com/aschmelyun/docker-compose-traefik
@ltayn
@ltayn Жыл бұрын
can you do a tutorial on laravel 9 vite docker vue3? when i am trying to get this working it is going insanely slow. Note i am using wsl.
@aasthagupta2165
@aasthagupta2165 Жыл бұрын
thanku so much
@mihajlom1k1
@mihajlom1k1 Жыл бұрын
Very helpful tutorial for using traefik locally, thanks a lot!
@stevecampbell8697
@stevecampbell8697 8 ай бұрын
This is the easiest to understand guide on setting up Traefik with an app that I've found. Thanks!
@aschmelyun
@aschmelyun 8 ай бұрын
I'm glad you liked it! Appreciate the kind words.
@xe3333
@xe3333 Жыл бұрын
Just in time . Thanks 🙌
@viniciusalvess
@viniciusalvess 2 ай бұрын
Thank you Andrew, this is a very valuable video!
@alifallahrn
@alifallahrn Жыл бұрын
Thanks! It was very helpful! ❤
@huriorko
@huriorko Жыл бұрын
Thanks for doing that!!
@VitorJustin
@VitorJustin Жыл бұрын
Great video! Tks
@Henry-vr6zr
@Henry-vr6zr 11 ай бұрын
Best explanation yet! Thanks so much.
@aschmelyun
@aschmelyun 11 ай бұрын
Glad it was helpful!
@Henry-vr6zr
@Henry-vr6zr 11 ай бұрын
@@aschmelyun One question, however - if I had a NextJS 13 application with a node.js (Express) Backend - and they were both proxied under e.g. Traefik or Nginx so that to get to the site the url would just be e.g. "localhost" and to make requests to the (proxied) backend it'd be "localhost/api" (the same port as the site) - how would I fetch data inside of my app if the RSC is fetching the data server-side so won't be able to make the request through the proxied API? If that makes sense 😅 TL;DR - how in my Next app can I fetch data from my proxied backend both in client components (that can only access the API through the proxy) and also in server components (that can only access the API in the internal Docker network, not through the proxy)?
@ruslanvoroshchukowlookitlt245
@ruslanvoroshchukowlookitlt245 Жыл бұрын
Hi Andrew, thanks for continuing the sharing a very actual stuff. Could you please guide me on how to set up Traefik correctly to get access to the services from other devices on my local network? The use case is when we need to test the localhost on a native mobile / tablet OS. Thank you!
@davbaster
@davbaster Жыл бұрын
Thanks for the tutorial
@atiqbaqi
@atiqbaqi 10 ай бұрын
very helpful video.
@saragasmichalis2177
@saragasmichalis2177 Жыл бұрын
Super useful!!
@kinvain
@kinvain Жыл бұрын
Is it important to keep different "ports" section in application service? Or it could be changed to the same ports "80:80" for instance?
Жыл бұрын
Awesome!
@principe.borodin
@principe.borodin Жыл бұрын
awesome. wonderful.
@KaMZaTa
@KaMZaTa Жыл бұрын
Let's say I have 1 stack with 2 containers and another stack with 1 container. How can I isolate the stacks behind Traefik?
@memack101
@memack101 Жыл бұрын
Thanks.
@inteliconn995
@inteliconn995 Жыл бұрын
Thanks!
@topalek
@topalek Жыл бұрын
awesome
@vitusyu9583
@vitusyu9583 Ай бұрын
But seems you have missed out the part of the DNS resolution required to enable the browser to resolve the URL. or, I have missed something you did mention? Thx!
@pieterrossouw8596
@pieterrossouw8596 Жыл бұрын
Nginx seems to be faster (lower resource utilization or higher traffic before dropping requests). Passing in that docker socket as a volume also greatly increases the severity of exploitation if your version of the container becomes vulnerable. That said, nginx configuration files can be finicky so tomato potato. I'll just use both.
@Osys91
@Osys91 Жыл бұрын
Don't forget that traefik gives the ability to get an SSL cert out of the box when the container goes up.
@wushutebessa
@wushutebessa Жыл бұрын
I think I prefer ngnix proxy manager
@RuelLuna
@RuelLuna Жыл бұрын
how to use this on laravel sail?
@aschmelyun
@aschmelyun Жыл бұрын
You'll have to make changes to the docker-compose.yml file that Sail generates. I'm writing up a blog article about how exactly to do this, so keep an eye out for it!
@chris.dillon
@chris.dillon 9 ай бұрын
So, instead of like a vite dev server proxy for dev? Hmm.
@GerardoBelot
@GerardoBelot 6 ай бұрын
NO more than a like becouse I can't, thank for the video!!!
@scwan-ew8uh
@scwan-ew8uh Жыл бұрын
Show me the javascriptdockerfile
@waqaszafar9559
@waqaszafar9559 Жыл бұрын
good stuff.. when we are gonna see some kubernetes stuff videos on this channel.
@aschmelyun
@aschmelyun Жыл бұрын
As soon as I take some time to learn more about it, there's a lot to learn!
@navanshu
@navanshu Ай бұрын
Different port is same domain not different
@derfic
@derfic Жыл бұрын
Hello, nginx proxy is more powerful and useful 🙂 but without beautiful web gui
@AinzOoalG0wn
@AinzOoalG0wn Жыл бұрын
more powerful in what way?
@jayp9158
@jayp9158 Жыл бұрын
I just understood "I'm too dumb and lazy to understand this new Technology so I will stick with Nginx"
@derfic
@derfic Жыл бұрын
@@jayp9158 new technologies appear every day, but most of them sucks 🤷🏻‍♂️
@joedrezden
@joedrezden Жыл бұрын
Could nginx proxy ssh connections? I don't.
@derfic
@derfic Жыл бұрын
@@joedrezden lol, we speak about redirects of http traffic
Expose Your Docker Containers With Traefik
19:33
Techdox
Рет қаралды 13 М.
Установка и настройка Traefik 2 | Основы | UnixHost
10:57
Self-hosted Guide [by UnixHost]
Рет қаралды 11 М.
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 82 МЛН
Clowns abuse children#Short #Officer Rabbit #angel
00:51
兔子警官
Рет қаралды 78 МЛН
New model rc bird unboxing and testing
00:10
Ruhul Shorts
Рет қаралды 27 МЛН
WORLD'S SHORTEST WOMAN
00:58
Stokes Twins
Рет қаралды 50 МЛН
Running multiple Laravel apps locally with Docker
13:20
Andrew Schmelyun
Рет қаралды 37 М.
A Response to  You don't need a frontend framework
30:59
wat the doodle!
Рет қаралды 4,1 М.
Is this the BEST Reverse Proxy for Docker? // Traefik Tutorial
21:57
Christian Lempa
Рет қаралды 505 М.
Why aren't you using Fastify? Or Koa? Or NestJS?
9:58
Maximilian Schwarzmüller
Рет қаралды 43 М.
Traefik vs. Nginx performance benchmark
12:38
Anton Putra
Рет қаралды 38 М.
The Ultimate Traefik Plugins Revealed
9:12
IBRACORP
Рет қаралды 18 М.
Лучший браузер!
0:27
Honey Montana
Рет қаралды 363 М.
Хакер взломал компьютер с USB кабеля. Кевин Митник.
0:58
Последний Оплот Безопасности
Рет қаралды 1,3 МЛН
Todos os modelos de smartphone
0:20
Spider Slack
Рет қаралды 63 МЛН