How to set port for publicly generated domain
faolain
PROOP

a year 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

faolain
PROOP

a year ago

296a4ed8-9ce2-4313-8827-59fc680abefb


faolain
PROOP

a year ago

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


faolain
PROOP

a year ago

This is what it looks like when it works

1319431706117406700


faolain
PROOP

a year ago

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


a year ago

set the PORT variable to 8888


faolain
PROOP

a year ago

Hmm not sure what you mean? where?


a year ago

in the service variables


faolain
PROOP

a year ago

in the railway.json?


a year ago


faolain
PROOP

a year 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?


a year ago

setting the PORT variable will tell the domain to point to 8888


faolain
PROOP

a year ago

So where I'm confused is where/how is that set automatically within the template?


faolain
PROOP

a year ago

would it be this within railway.json?

...
    "variables": {
        "JUPYTER_TOKEN": {
            "description": "Token for Jupyter authentication",
            "required": true,
            "sensitive": true
        },
       "PORT": {
           "value": 8888
        }
    }
...

faolain
PROOP

a year ago

is that a railway reference variable? if it sees the word port it will forward to 8888 instead of 8080?


a year ago

it's just a regular variable


faolain
PROOP

a year ago

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


faolain
PROOP

a year ago

the template is here if you'd like to try fwiw https://railway.app/template/6Iv9BG?referralCode=1CR-cB


a year 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.


faolain
PROOP

a year ago

I think something is getting lost in translation


a year ago

have you tried it?


faolain
PROOP

a year ago

I mentioned railway.json because this is how the project is being deployed from the template correct?


a year ago

no


faolain
PROOP

a year ago

how can I create a repeatable programmatic file that when another user deploys from a template


a year ago

you set PORT on the template service


faolain
PROOP

a year ago

they can automatically have the ports adequately setup


faolain
PROOP

a year ago

So like this?

1319440535253155800


a year ago

yes, no need to over think this


faolain
PROOP

a year ago

do I need to update the template


faolain
PROOP

a year ago

now that I edited the original service?


a year ago

save the changes, yes


faolain
PROOP

a year ago

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


a year ago

You'd need to redeploy the template


faolain
PROOP

a year ago

I just did that and there seems to be no difference


faolain
PROOP

a year ago

nvm


faolain
PROOP

a year ago

works now


faolain
PROOP

a year ago

thanks @Brody (was a slow refresh)


a year ago

No problem!


faolain
PROOP

a year ago

hmm this wasn't obvious at all from the documentation, PORT seeming like a "magic" variable


a year ago

just gotta trust me, I've been doing this for a long time


faolain
PROOP

a year ago

is there any way you guys can make this clear on the docs as I ctrl'd f'd maybe I missed it


faolain
PROOP

a year ago

yeah I do I just wasn't clear on exactly what needed to be done


faolain
PROOP

a year ago

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


a year ago


faolain
PROOP

a year ago

Can you guys add a sentence here

1319442839704178700


faolain
PROOP

a year ago

that this is the port that will be exposed on the domain as the default instead of the provided one?


a year ago

will make a note of that


faolain
PROOP

a year ago

basically the way I write docs now is assuming an LLM will parse it


faolain
PROOP

a year ago

so the more information the better, even in an appendix to not overwhelm users


faolain
PROOP

a year ago

but this way more info is better


a year ago

haha I'm not going that, but I will add the extra information


faolain
PROOP

a year ago

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?


faolain
PROOP

a year ago

What I mean by that is I see this

1319447679629262800


faolain
PROOP

a year ago

to at least pre-fill port with 8888


a year ago

set the variable to 8888 in the template composer then


faolain
PROOP

a year ago

hmm where is that?


faolain
PROOP

a year ago

this?

1319449725342191900


faolain
PROOP

a year ago

ah it took another second to update


faolain
PROOP

a year ago

okay perfect thanks again brody!


a year ago

no problem


Loading...