R
Join ServerRailway
✋|help
Server Error 503
I am setting my access url inside the app to
Deploy logs are healthy but still I get a Server Error Page
0.0.0.0:${{PORT}}
Where PORT
is automatically injected by railway.Deploy logs are healthy but still I get a Server Error Page
54cd68ae-8dc4-4d04-b044-17564e857147
34777 isn't a port that railway would generate
I also tried manullay overwriting it
by setting PORT=3000 environment varibale
same effect
where is it getting 34777 from then
Let me fix something. Do I need port INSIDE my Dockerfile?
not unless you need to reference it during build, otherwise you don't need any arg or expose for the port stuff
I have an environment variable
ACCESS_URL=0.0.0.0:${{PORT}}
in my service config
and That variable is being used in the Dockerfile
that's definitely unorthodox
ideally you shouldn't need to set anything up with ports in the dockerfile
The container actually runs the servive on a port
remove both PORT and CODER_HTTP_ADDRESS
trying will update
then just simply listen on the auto generated PORT, no need to complicate things like that
It worked
yay
But Why?
because you are now listening on the port railway wants you to
Again 503
then why did you say that it worked
I removed CODER_ACCESS_URL it worked
I removed PORT it is back to 503
I do not know
railway deployed on every varibale delete or add
It does not wait for you to finihs adding or deleting all varibales
yes it does
theres a toast with a timer, it has a button that says cancel
it turns out I need
PORT
you shouldn't
but if the broken code works with a PORT set then all good
I will experiment more
sounds good
Thanks a lot for the quick response
I appreaciate.
no problem!
Seems like I need
PORT
even I am not using it anywherejust deleting the varibale gives me 503
what framework is this anyway?
It is a Dockerfile based on Coder.com
ghcr.io/coder/coder
using this image
railway has a template for coder
that is code-server
I am from Coder community
and I want to publish a new template for oour product Coder Server
looked like the same logo to me 🤷
yeah
my bad
code-server is a product
this one is named coder
interesting, lots of stars
By the way I figured it out
what was it
in the coder image port 3000 is kind of hardocded. like it listens on 127.0.0.1:3000
But railway expects 0.0.0.0
so I set 0.0.0.0:3000
Now Railway does not know which port to connect to if I do not set
PORT=3000
make it also listen on the railways injected PORT so you won't have to set your own, much better portability that way especially for templates
We have a variable
CODER_HTTP_ADDRESS
that defaults to 127.0.0.1:3000
I overrode that to
0.0.0.0:3000
and then I need PORT=3000
varibaleI bet you could do better
other thing I can do is,
define
and then set
define
ENV PORT=
in my Dockerfileand then set
CODER_HTTP_ADDRESS=0.0.0.0:$PORT
then Coder will listen on railway injected port
yay that's what I like to hear
But don't you think railway should allow directly using images from a registry?
Instead of a repo that has a minimal Dockerfile
this has been asked before, and I forget the answer a team member gave
the 2nd method didn't work. railway is not passing any
PORT
personally I don't see a problem with a repo that has just a dockerfile for a template
and it is defaulting to 3000
FROM ghcr.io/coder/coder:v0.21.1
ENV PORT=3000
ENV CODER_HTTP_ADDRESS=0.0.0.0:$PORT
ENV CODER_ACCESS_URL=
ENV CODER_PG_CONNECTION_URL=
ENV CODER_EXPERIMENTS=*
ENV CODER_DEBUG=false
ENV CODER_TELEMETRY_INSTALL_SOURCE=
you'd likely need to do a
ARG PORT
in the dockerfiledidn't work
instead of the ENV PORT=3000
FROM ghcr.io/coder/coder:v0.21.1
ARG PORT=3000
ENV CODER_HTTP_ADDRESS=0.0.0.0:$PORT
ENV CODER_ACCESS_URL=
ENV CODER_PG_CONNECTION_URL=
ENV CODER_EXPERIMENTS=*
ENV CODER_DEBUG=false
ENV CODER_TELEMETRY_INSTALL_SOURCE=
haha no not like that
just
ARG PORT
Then why if there is no PORT?
or PORT is empty
there will be if it's ran on railway
I would like to use the same Dockerfile for other deployments
other platforms locally
And also, even if default is set
then you can specify the port in the docker run command
It should be overridden, when passed from outside
don't know if that's how ARG works but sounds plausible
What I mean is even if we set an ARG to a deafult value it should take the value passed by railway
wait
waiting
Tried
ARG PORT
ENV PORT=${PORT:-3000}
ENV CODER_HTTP_ADDRESS=0.0.0.0:$PORT
didn't work
ARG PORT
ENV CODER_HTTP_ADDRESS=0.0.0.0:$PORT
Also did not work