Can't get private networking to work
zed077
PROOP

9 months ago

We are perfectly able to get our server side apps (java, python, postgresql) to talk to each other using the public network but as soon as we change the domain to the private one, it does not work. Any pointers as to why this can be?

Thanks,

Cedric

Solved$20 Bounty

Pinned Solution

root101
HOBBY

8 months ago

I just posted something similar here: https://station.railway.com/questions/container-unable-to-resolve-external-dom-a711c97f
don't know if it's gonna help, but hey, you could still try it

(i'm just gonna copy-past it here)

Hi, just to shed some light on the work with internal networking, since I went through a lot of work at the time, these are the main keys to making it work.

Let's assume we have this URL as internal:

some-service.railway.internal

This is the url given in the settings/Networking/Private Networking tab in config of a service (or db or whatever)

I have to 'parse it' to: http://some-service.railway.internal:port

1 - So basically you need to specify the http, not https, just plain old http, since its internal (i assume) it doesn't need to be s'ed.

2 - You need to add the port in witch the service is running, this is usually the 'EXPOSE' in dockerfile or similar config in the framework you are using.

3 - If you are running a service (like a DB), that need a different format, note that the public url have a different port that the internal, like postgres for example, you have the public url: postgresql://postgres:password@some-public-url.rlwy.net:12345/railway , the internal url will be something like: postgresql://postgres:password@some-public-url.railway.internal:5432/railway Note the change in some-public-url.rlwy.net to some-public-url.railway.internal, and port from 12345 to 5432

I don't know if this is some kind of magic, but it do make it work for me... feel free to test it and let me know

4 Replies

brody
EMPLOYEE

9 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 9 months ago


uxuz
MODERATOR

9 months ago

Hey, private networking is IPv6 only. Did you make sure that your applications are also listening on IPv6? For example, here is the documentation for binding your Python application to IPv4 and IPv6.


root101
HOBBY

8 months ago

I just posted something similar here: https://station.railway.com/questions/container-unable-to-resolve-external-dom-a711c97f
don't know if it's gonna help, but hey, you could still try it

(i'm just gonna copy-past it here)

Hi, just to shed some light on the work with internal networking, since I went through a lot of work at the time, these are the main keys to making it work.

Let's assume we have this URL as internal:

some-service.railway.internal

This is the url given in the settings/Networking/Private Networking tab in config of a service (or db or whatever)

I have to 'parse it' to: http://some-service.railway.internal:port

1 - So basically you need to specify the http, not https, just plain old http, since its internal (i assume) it doesn't need to be s'ed.

2 - You need to add the port in witch the service is running, this is usually the 'EXPOSE' in dockerfile or similar config in the framework you are using.

3 - If you are running a service (like a DB), that need a different format, note that the public url have a different port that the internal, like postgres for example, you have the public url: postgresql://postgres:password@some-public-url.rlwy.net:12345/railway , the internal url will be something like: postgresql://postgres:password@some-public-url.railway.internal:5432/railway Note the change in some-public-url.rlwy.net to some-public-url.railway.internal, and port from 12345 to 5432

I don't know if this is some kind of magic, but it do make it work for me... feel free to test it and let me know


lofimit
HOBBY

8 months ago

It's like your apps aren’t actually listening on the private network interface or port you’re trying to connect to. Like, PostgreSQL usually listens on 5432 on the private network, but your public URL uses a random port so if you just swap domains but keep the public port, it won’t work.

Also, make sure you’re using the full private URL with the right port (usually the default service port, not the random public one). Double-check your app configs aren’t still binding only to localhost or the public interface.

Try connecting using the private domain with the default service port and see if that fixes it. If not, your service might not be listening on the private network IP at all.


zed077
PROOP

8 months ago

That's great, thanks guys! We need to look at enabling ipv6 over http on python and java but at the same time preventing external access to it. I wish it could be easier.


Status changed to Solved chandrika 8 months ago


Loading...