2 years ago
I currently have the existing repo to deploy a jupyter lab notebook that runs on port 8888 https://github.com/dClimate/jupyter-notebooks and I have deployments essentially working however the last step is that the generated public domain I assume is defaulting to 8080 but I want to have it forward to 8888. I can do this by deleting the domain (first screenshot) and second screenshot (deleting). Then the third screenshot to create one and then select one (fourth), fifth with options
59 Replies
I thought by doing this https://github.com/dClimate/jupyter-notebooks/blob/main/railway.json#L31 it would work but it doesn't appear to
Essentially I want to programtically from the template map and expose the appropriate port for the public domain instead of the default railway one https://docs.railway.com/guides/public-networking
2 years ago
set the PORT variable to 8888
2 years ago
in the service variables
2 years ago
I guess I'm confused, how does this help with creating a template that automatically sets the generated domain to forward to the appropriate port?
2 years ago
setting the PORT variable will tell the domain to point to 8888
So where I'm confused is where/how is that set automatically within the template?
would it be this within railway.json?
...
"variables": {
"JUPYTER_TOKEN": {
"description": "Token for Jupyter authentication",
"required": true,
"sensitive": true
},
"PORT": {
"value": 8888
}
}
...is that a railway reference variable? if it sees the word port it will forward to 8888 instead of 8080?
2 years ago
it's just a regular variable
Again so my question is how will railway know to point to that value? I have 4 services running on different ports but the publicly generated domain should only point to 8888, by setting "PORT" in railway.json as shown above will this solve the problem? This should happen in a way that anyone who also deploys the template will have it work automatically for them without having to edit or do anything on their end
the template is here if you'd like to try fwiw https://railway.app/template/6Iv9BG?referralCode=1CR-cB
2 years ago
I'm not sure why railway.json keeps being used, I had previously mentioned service variables.
how will railway know? because that's just how it's been designed to work, don't know what to tell you here.
2 years ago
have you tried it?
I mentioned railway.json because this is how the project is being deployed from the template correct?
2 years ago
no
how can I create a repeatable programmatic file that when another user deploys from a template
2 years ago
you set PORT on the template service
2 years ago
yes, no need to over think this
2 years ago
save the changes, yes
save changes on the service that's already deployed or update the template? for the former I saved it but for the latter I see no option to have changes propagate
2 years ago
You'd need to redeploy the template
2 years ago
No problem!
hmm this wasn't obvious at all from the documentation, PORT seeming like a "magic" variable
2 years ago
just gotta trust me, I've been doing this for a long time
is there any way you guys can make this clear on the docs as I ctrl'd f'd maybe I missed it
as it was strange to think that things had to be done in a UI vs railway.json(the latter being only for deploying) whereas template is using the UI for the former
2 years ago
that this is the port that will be exposed on the domain as the default instead of the provided one?
2 years ago
will make a note of that
so the more information the better, even in an appendix to not overwhelm users
2 years ago
haha I'm not going that, but I will add the extra information
one more question while we're here, I see when I go to deploy the template now there is an option for the user to input details, is there a way to pre-fill it?
2 years ago
set the variable to 8888 in the template composer then
2 years ago
no problem




