How to set port for publicly generated domain
faolain
PROOP

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

Closed

59 Replies

faolain
PROOP

2 years ago

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


faolain
PROOP

2 years 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

2 years ago

This is what it looks like when it works

1319431706117406770


faolain
PROOP

2 years 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


2 years ago

set the PORT variable to 8888


faolain
PROOP

2 years ago

Hmm not sure what you mean? where?


2 years ago

in the service variables


faolain
PROOP

2 years ago

in the railway.json?


2 years ago


faolain
PROOP

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


faolain
PROOP

2 years ago

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


faolain
PROOP

2 years 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

2 years ago

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


faolain
PROOP

2 years 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

2 years ago

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.


faolain
PROOP

2 years ago

I think something is getting lost in translation


2 years ago

have you tried it?


faolain
PROOP

2 years ago

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


2 years ago

no


faolain
PROOP

2 years ago

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


faolain
PROOP

2 years ago

they can automatically have the ports adequately setup


faolain
PROOP

2 years ago

So like this?

1319440535253155890


2 years ago

yes, no need to over think this


faolain
PROOP

2 years ago

do I need to update the template


faolain
PROOP

2 years ago

now that I edited the original service?


2 years ago

save the changes, yes


faolain
PROOP

2 years 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


2 years ago

You'd need to redeploy the template


faolain
PROOP

2 years ago

I just did that and there seems to be no difference


faolain
PROOP

2 years ago

nvm


faolain
PROOP

2 years ago

works now


faolain
PROOP

2 years ago

thanks @Brody (was a slow refresh)


2 years ago

No problem!


faolain
PROOP

2 years ago

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


faolain
PROOP

2 years 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

2 years ago

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


faolain
PROOP

2 years 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


2 years ago


faolain
PROOP

2 years ago

Can you guys add a sentence here

1319442839704178688


faolain
PROOP

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


faolain
PROOP

2 years ago

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


faolain
PROOP

2 years ago

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


faolain
PROOP

2 years ago

but this way more info is better


2 years ago

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


faolain
PROOP

2 years 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

2 years ago

What I mean by that is I see this

1319447679629262940


faolain
PROOP

2 years ago

to at least pre-fill port with 8888


2 years ago

set the variable to 8888 in the template composer then


faolain
PROOP

2 years ago

hmm where is that?


faolain
PROOP

2 years ago

this?

1319449725342191770


faolain
PROOP

2 years ago

ah it took another second to update


faolain
PROOP

2 years ago

okay perfect thanks again brody!


2 years ago

no problem


Welcome!

Sign in to your Railway account to join the conversation.

Loading...