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.
No description
75 Replies
Percy
Percyβ€’13mo ago
Project ID: eb420912-7d00-4c05-8b5a-85b0415e95f4,859de496-3bee-497b-9ad4-6f12965595a4
Brody
Brodyβ€’13mo ago
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
GameAchievements
GameAchievementsOPβ€’13mo ago
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.
GameAchievements
GameAchievementsOPβ€’13mo ago
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
Brody
Brodyβ€’13mo ago
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
GameAchievements
GameAchievementsOPβ€’13mo ago
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
Brody
Brodyβ€’13mo ago
how are you "pointing" it?
GameAchievements
GameAchievementsOPβ€’13mo ago
NODEBB_PORT=${{PORT}}
Brody
Brodyβ€’13mo ago
do you also have a PORT set?
GameAchievements
GameAchievementsOPβ€’13mo ago
actually, now that I've erased it, it lists itself as empty string nope I had it set moments ago with 4567
Brody
Brodyβ€’13mo ago
the auto generated PORT is only available at run time, since its a random number
GameAchievements
GameAchievementsOPβ€’13mo ago
this is the default port for NodeBB but it should work like this, right?
Brody
Brodyβ€’13mo ago
PORT=4567
NODEBB_PORT=${{PORT}}
PORT=4567
NODEBB_PORT=${{PORT}}
GameAchievements
GameAchievementsOPβ€’13mo ago
that's what I had before
Brody
Brodyβ€’13mo ago
thats what you want, put it back to that please
GameAchievements
GameAchievementsOPβ€’13mo ago
alright done
Brody
Brodyβ€’13mo ago
then this would be the url, note https and no port (since 443 is implied because of https) https://forum-ga.up.railway.app/
GameAchievements
GameAchievementsOPβ€’13mo ago
Just to confirm we're getting the right values on the generated config.json
No description
GameAchievements
GameAchievementsOPβ€’13mo ago
and our output looks like this:
No description
GameAchievements
GameAchievementsOPβ€’13mo ago
@Brody , can you open the URL to check one thing? it's repeating the main domain on a loop
Brody
Brodyβ€’13mo ago
lol havent seen that happen before what is NODEBB_PUBLIC_URL set to
GameAchievements
GameAchievementsOPβ€’13mo ago
that one uses RAILWAY_PUBLIC_URL it's just a pointer
Brody
Brodyβ€’13mo ago
screenshot please
GameAchievements
GameAchievementsOPβ€’13mo ago
No description
GameAchievements
GameAchievementsOPβ€’13mo ago
and the pointer on RAW... NODEBB_PUBLIC_URL=${{RAILWAY_PUBLIC_DOMAIN}}
Brody
Brodyβ€’13mo ago
it should be a url https://${{RAILWAY_PUBLIC_DOMAIN}}
GameAchievements
GameAchievementsOPβ€’13mo ago
oh boy...
Brody
Brodyβ€’13mo ago
not saying thats the main issue, but its one of them
GameAchievements
GameAchievementsOPβ€’13mo ago
let's try it
GameAchievements
GameAchievementsOPβ€’13mo ago
yep those ones are injected in the "mighty powerful" script you can see under "scripts" folder
Brody
Brodyβ€’13mo ago
strange that the original dockerfile wouldnt include them?
GameAchievements
GameAchievementsOPβ€’13mo ago
I've added them manually
Brody
Brodyβ€’13mo ago
i know
GameAchievements
GameAchievementsOPβ€’13mo ago
this was a way we found to have a properly configured config.json file
Brody
Brodyβ€’13mo ago
can nodedd only be configured by a config.json file?
GameAchievements
GameAchievementsOPβ€’13mo ago
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
Brody
Brodyβ€’13mo ago
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
GameAchievements
GameAchievementsOPβ€’13mo ago
I'm guess this is a problem caused by my ignorance. But we're always learning, right? πŸ˜ƒ
Brody
Brodyβ€’13mo ago
we are always learning, first time ive heard of nodedd
GameAchievements
GameAchievementsOPβ€’13mo ago
it's a nodeJS forum
Brody
Brodyβ€’13mo ago
okay look at this, this is so damn funny https://nodebb.readthedocs.io/en/latest/ the official documentation
GameAchievements
GameAchievementsOPβ€’13mo ago
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
Brody
Brodyβ€’13mo ago
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
GameAchievements
GameAchievementsOPβ€’13mo ago
this is the little script generates the config.json I was talking about
Brody
Brodyβ€’13mo ago
this is a very nice work around though, for sure
GameAchievements
GameAchievementsOPβ€’13mo ago
cheers
Brody
Brodyβ€’13mo ago
now im getting a 500 status code
Brody
Brodyβ€’13mo ago
but if nodedd is logging to a log file its going to be hard to debug
No description
GameAchievements
GameAchievementsOPβ€’13mo ago
yup, we're on the same page
Brody
Brodyβ€’13mo ago
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
GameAchievements
GameAchievementsOPβ€’13mo ago
at least we got rid of the loop in the URL
Brody
Brodyβ€’13mo ago
true
GameAchievements
GameAchievementsOPβ€’13mo ago
let me show you the log now
Brody
Brodyβ€’13mo ago
theres also a very slim chance you could set the log file to /dev/stdout
GameAchievements
GameAchievementsOPβ€’13mo ago
No description
GameAchievements
GameAchievementsOPβ€’13mo ago
this is sounding like there's internal stuff mising on the nodeBB files
Brody
Brodyβ€’13mo ago
would you happen to have a volume?
GameAchievements
GameAchievementsOPβ€’13mo ago
I'm not sure. I don't think so I've added an nginx service and a mongo DB instance
Brody
Brodyβ€’13mo ago
what nginx for?
GameAchievements
GameAchievementsOPβ€’13mo ago
to mess around and arrive to the conclusion that I should've talked to Brody earlier πŸ˜†
Brody
Brodyβ€’13mo ago
lmao my first guess is this is a permission error, remove all the chown and USER stuff from the dockerfile
GameAchievements
GameAchievementsOPβ€’13mo ago
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
Brody
Brodyβ€’13mo ago
chuck a RAILWAY_RUN_UID=0 in there for good measure
GameAchievements
GameAchievementsOPβ€’13mo ago
what does that do?
Brody
Brodyβ€’13mo ago
runs the container as uid 0 aka the root user
GameAchievements
GameAchievementsOPβ€’13mo ago
can I add that to variables on railway?
Brody
Brodyβ€’13mo ago
yep
GameAchievements
GameAchievementsOPβ€’13mo ago
alright, with that variable set, deploy is running for 6 minutes and seems stuck
GameAchievements
GameAchievementsOPβ€’13mo ago
Log for reference
No description
Brody
Brodyβ€’13mo ago
was worth a try
GameAchievements
GameAchievementsOPβ€’13mo ago
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 πŸ™
Brody
Brodyβ€’13mo ago
no problem, happy to help where I can
GameAchievements
GameAchievementsOPβ€’13mo ago
how can I mark the post as "solved"?
Brody
Brodyβ€’13mo ago
already done
Want results from more Discord servers?
Add your server