Help with NodeBB deployment
Hello, guys.
First of all, thank you in advance for any provided help. Here's the issue:
We're trying to use railway to host a NodeBB forum. We've cloned NodeBB github repo (https://github.com/NodeBB/NodeBB/tree/v3.4.3) and added a small script to generate a config.json file with desired settings. Please note that a dockerfile is already provided within the NodeBB repo. We've added the necessary .env variables to the dockerfile (as stated in railway docs) in order to pass the necessary parameters (forum url, port, db host, db username, etc.).
Evertything seems to be running smoothly according to the output (check the printscreen), but when trying to access the URL (http://forum-ga.up.railway.app:4567/), we get a "ERR_CONNECTION_TIMED_OUT" error. What are we missing here? $PORT variable is being used to set the app port.
Here's the
Project ID: eb420912-7d00-4c05-8b5a-85b0415e95f4
and Service ID: 859de496-3bee-497b-9ad4-6f12965595a4
Once again, thank you.
75 Replies
Project ID:
eb420912-7d00-4c05-8b5a-85b0415e95f4,859de496-3bee-497b-9ad4-6f12965595a4
can you provide your clone of the repo?
I also noticed that you are trying to specify a port in that public url, you can only access railway services that run http externally over https port 443
GitHub
GitHub - GameAchievements/nodebb-forum: Repo for the GameAchievemen...
Repo for the GameAchievements forum. Contribute to GameAchievements/nodebb-forum development by creating an account on GitHub.
I think I'm understanding the issue... The only available port for testing on a public domain is 443, right?
I mean, we could use nginx as proxy to redirect traffic do the correct internal port
way overthinking it
railway auto generates a PORT environment variable internally that it expects your app to listen on, but if you cant listen on the PORT environment variable because for example your app listens on a fixed port and doesnβt provide a way to specify an environment variable to be used as the port, you can set a PORT service variable to what your app listens on so that railway knows to map 443 to what internal port
oh!
I changed the PORT value manually, but I can leave it be
I actually have an additional variable called NODEBB_PORT that points to your PORT
how are you "pointing" it?
NODEBB_PORT=${{PORT}}
do you also have a PORT set?
actually, now that I've erased it, it lists itself as empty string
nope
I had it set moments ago with 4567
the auto generated PORT is only available at run time, since its a random number
this is the default port for NodeBB
but it should work like this, right?
that's what I had before
thats what you want, put it back to that please
alright
done
then this would be the url, note https and no port (since 443 is implied because of https)
https://forum-ga.up.railway.app/
Just to confirm we're getting the right values on the generated config.json
and our output looks like this:
@Brody , can you open the URL to check one thing?
it's repeating the main domain on a loop
lol havent seen that happen before
what is
NODEBB_PUBLIC_URL
set tothat one uses RAILWAY_PUBLIC_URL
it's just a pointer
screenshot please
and the pointer on RAW...
NODEBB_PUBLIC_URL=${{RAILWAY_PUBLIC_DOMAIN}}
it should be a url
https://${{RAILWAY_PUBLIC_DOMAIN}}
oh boy...
not saying thats the main issue, but its one of them
let's try it
are these used during the build phase?
https://github.com/GameAchievements/nodebb-forum/blob/main/Dockerfile#L18-L27
yep
those ones are injected in the "mighty powerful" script you can see under "scripts" folder
strange that the original dockerfile wouldnt include them?
I've added them manually
i know
this was a way we found to have a properly configured config.json file
can nodedd only be configured by a config.json file?
cause the guys at NodeBB say: hey, you just need to run ./nodebb setup
but on railway, no can do (as far as I know, right?)
I think that command would generate the config.json for you
you can do a whole lot of things you never thought possible, as long as you have a deep understanding of both the software you are trying to run and of railway
I'm guess this is a problem caused by my ignorance. But we're always learning, right? π
we are always learning, first time ive heard of nodedd
it's a nodeJS forum
okay look at this, this is so damn funny
https://nodebb.readthedocs.io/en/latest/
the official documentation
https://docs.nodebb.org/installing/os/ubuntu/
we've been trying to follow this and adjust to their dockerfile thing so that railway can work with it
but since we're not working with a common VM with a shell, we need to adapt
https://github.com/GameAchievements/nodebb-forum/blob/main/scripts/generate_config.js
using only the config.json instead of also allowing you to set this all with environment variables is a poor design decision in my opinion
this is the little script generates the config.json I was talking about
this is a very nice work around though, for sure
cheers
now im getting a 500 status code
but if nodedd is logging to a log file its going to be hard to debug
yup, we're on the same page
you can only view logs if you log unbuffered to stdout / stderr, since railway has no way to know what random log file any given app logs to
at least we got rid of the loop in the URL
true
let me show you the log now
theres also a very slim chance you could set the log file to
/dev/stdout
this is sounding like there's internal stuff mising on the nodeBB files
would you happen to have a volume?
I'm not sure. I don't think so
I've added an nginx service and a mongo DB instance
what nginx for?
to mess around and arrive to the conclusion that I should've talked to Brody earlier π
lmao
my first guess is this is a permission error, remove all the chown and USER stuff from the dockerfile
let me try that
"#9 32.01 npm ERR! code EACCES"
I guess we need chown after all
there are other threads about the error we're getting on the forum template
I don't wan't to keep bugging you with this. You already gave a very nice help
chuck a
RAILWAY_RUN_UID=0
in there for good measurewhat does that do?
runs the container as uid 0
aka the root user
can I add that to variables on railway?
yep
alright, with that variable set, deploy is running for 6 minutes and seems stuck
Log for reference
was worth a try
yep. Anyway, I'll mark this as solved since the "problem" with railway was sucessfully solved
Once again, thank you very much for the kind help π
no problem, happy to help where I can
how can I mark the post as "solved"?
already done