Containerized Dash apps and listening ports
rojwilco
HOBBYOP

a year ago

I have a containerized Dash app that I just simply run by using app.run(). The default port dash will listen on in this way is 8050; however, when I deploy this on railway (by creating a service out of my GitHub repo), the service starts up listening on 8080. How is this happening? I have a public hostname for the service, is that changing it somehow?

Related question, if I have a public hostname for my service, can I still connect to it on the internal private hostname from another service?

Solved

17 Replies

rojwilco
HOBBYOP

a year ago

c1ac1dab-83ee-45b4-b732-98360b9b39b7


a year ago

we inject a PORT=8080 variable and dash is probably listening on that if available.

if I have a public hostname for my service, can I still connect to it on the internal private hostname from another service?
yes


rojwilco
HOBBYOP

a year ago

Is that injection part of the public hostname thing? Also, how do I turn off a public hostname?


a year ago

its always injected regardless.

to turn it off would be the same as removing the domain.


rojwilco
HOBBYOP

a year ago

to turn it off would be the same as removing the domain.
gotcha, it wasn't showing up on mobile


rojwilco
HOBBYOP

a year ago

i have more questions that are related but not about the title of this thread. should i open a new thread?


a year ago

feel free to ask here


a year ago

Also, if for some reason you need your app running on 8050 specifically, you can change the PORT variable in your service settings


a year ago

if it doesn’t show there, add it and Railway will detect it


rojwilco
HOBBYOP

a year ago

i'm trying to set up an nginx service (via a github hosted dockerfile and nginx config) that is supposed to proxy https://service-host.railway.app/some-other-app to the internal url of another service (my dash app). i'm having a hard time with the rewrites, i can get to the initial page but the returned links are not rewritten. trying to find a solution that is wholly in the nginx config. heres what i got:

server {
    listen 80;

    location /trump-polls/ {
        proxy_pass http://some-other-app:8080/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location / {
        return 404;
    }
}

rojwilco
HOBBYOP

a year ago

i did try rewrite /some-other-app(/.*)$ $1 break; but it didn't make a difference


rojwilco
HOBBYOP

a year ago

sorry if this is too much about my own app and not railway, looking for any tips


a year ago

tips? you need to use caddy


rojwilco
HOBBYOP

a year ago

I shall check it out, thank you


rojwilco
HOBBYOP

a year ago

Well, i got it to work with caddy, but couldn't without making the dash app know about the path. Probably something to do with me not using a real wsgi. At least the caddy config is much simpler


rojwilco
HOBBYOP

a year ago

Thanks again for the help. Railway is pretty dope


a year ago

!s


Status changed to Solved adam 12 months ago


Loading...