Closed ogmueller closed 7 months ago
Thanks for this because I've lost a lot of time trying to understand what's the problem with this docker image. I think the container should always listen to 0.0.0.0 because as you said, you can't access it directly without that. Could it be possible to make the container listen to 0.0.0.0 ?
Thank you
In my opinion, one of the best ways to fix it, is to set the env variable
HOSTNAME
to be empty, because than the service will bind itself to0.0.0.0
and by that would listen to the default and traefik network. It would be very helpful, to put theHOSTNAME
variable into theconfig.env
and explain why and when to set it/keep it empty.
Thank you! I spent ~2 hours trying to convert my instance to run behind Traefik. I was continually getting 404's (not a 502 in my case). I discovered this issue after a lot of trial and error and eventually simply adding HOSTNAME=
to the config.env
file, as you suggested, fixed the issue. Interestingly, v2 worked fine behind Traefik but not v3.
I echo the same statement about adding this to the docs/traefik readme.
Just commenting back to mention this has been fixed in #1015
Setting the HOSTNAME
variable in the config.env
file is no longer necessary as it's part of the Dockerfile used in the image build.
@rlew-is Great, thanks for confirming! I'll close this then.
If you like to use the rallly with docker and traefik, you will always get the error response "502 Bad Gateway". The reason is, that you will need to put the rallly container additionally into a traefik network. By default a docker container gets a random hostname (e.g., "6833a63bb4a7" or so) for each and every network it is assigned to. So rallly is going to have a different hostname and IP address in its default network than it will have in the traefik network. The problem is, that rallly is going to bind itself to ONE hostname's IP address only. So it will not bind to any other IP as you can see in
apps/web/server.js
:You can mitigate this problem by adding an NGINX or Apache as an additional proxy in the default network, but if you have traefik already, there is no need for an additional reverse proxy. You would just increase the chain of servers the request has to go through. So that is not an optimal solution.
In my opinion, one of the best ways to fix it, is to set the env variable
HOSTNAME
to be empty, because than the service will bind itself to0.0.0.0
and by that would listen to the default and traefik network. It would be very helpful, to put theHOSTNAME
variable into theconfig.env
and explain why and when to set it/keep it empty.