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