I'll admit it, I'm kind of a newbie here and just starting out with the whole concept of reverse proxy and so on.
So here's my issue, and I can't get quite my head around it (although I've been trying hard to solve it).
I'm using create-react-app to power 2 web apps on the same Debian server. I'm trying to dockerize each app, and let Traefik do all the heavy lifting to route incoming requests on port 80 to the corresponding docker container depending on the domain name used.
After several (failed) attempts, here is where I'm at in terms of docker-compose file
This is all fine and dandy, when I'm logging in to the Traefik dashboard, I can see the services up and running but strangely not request gets forwarded... I can't access my app from the outside.
Any help or insight will be much, much appreciated.
First correct the line bellow
(the router entrypoint name must match the corresponding router 'rule' name)
traefik.http.routers.whoami.entrypoints=web
to
traefik.http.routers.app.entrypoints=web
Second add a 'loadbalancer" to the service app to tell Traefik where to forward the requests
Generic sample, assuming your "app" listen to port XX, add
Thanks Nalta for your help.
Unfortunately I can't get it to work. I can see both services up and running, I can ping my docker container but using my external DNS domain nothing shows up...
Have you defined a port in your app image using "expose"? If not, you need to add loadbalancer to the labels. Make sure to use the correct port your app is listening on. Furthermore you should use the same ID within all the label strings:
Hey,
If that's any help, I'm joining my docker file as well for the react app.
FROM node:latest
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
EXPOSE 80
CMD ["npm", "start"]
When running docker-compose, I can access the traefik dashboard (on port 8080), but loading seems stuck when trying to access port 80 I can't reach my react app and no error appears on the dashboard... weird. To be honest, I'm a bit lost here.