a year ago
Hello Team,
I am attempting to expose multiple ports using the new V2 Runtime. Excited to test this out. Still having some connectivity issues, wanted to make sure I have exposed them correctly. Started with first port, 8545:
App Dockerfile
# Expose necessary ports
EXPOSE 443 8545 8546 30303 8080
Railway.yml
services:
go-marscredit:
build: .
ports:
- "8080:80"
- "443:443"
- "8545:8545"
- "8546:8546"
- "30303:30303"
NODE_ID: "node1"
Public Networking
Mapped a generated domain to port 8545.
go-marscredit-production.up.railway.app
-> Port 8545
App Logging
INFO [07-01|08:02:52.224] WebSocket enabled url=ws://[::]:8546
INFO [07-01|08:02:52.223] HTTP server started endpoint=[::]:8545 auth=false prefix= cors=* vhosts=*
Network Test
curl -v http://go-marscredit-production.up.railway.app:8545
* Host go-marscredit-production.up.railway.app:8545 was resolved.
* IPv6: (none)
* IPv4: 104.196.232.237
* Trying 104.196.232.237:8545...
* connect to 104.196.232.237 port 8545 from 192.168.0.2 port 57946 failed: Operation timed out
* Failed to connect to go-marscredit-production.up.railway.app port 8545 after 7920 ms: Couldn't connect to server
* Closing connection
curl: (28) Failed to connect to go-marscredit-production.up.railway.app port 8545 after 7920 ms: Couldn't connect to server
What am I doing incorrectly on the railway side, if anything? Thanks!
9 Replies
a year ago
Some things to note -
At this time the ability to expose multiple ports is only supported for https (or websockets), you can't mix and match with TCP yet.
The
-> Port 8545
means the external port 443 maps to that port internally, you can't use:8545
affixed to the domain.You are given a different domain for each internal port you use, everything is always going to be exposed with https and port 443.
What you specifically where doing wrong -
Calling the domain with http instead of https.
Calling the domain and specifying a port, instead of letting curl assume 443 by way of the https scheme.
a year ago
Super helpful explanation on the architecture. Should I modify my railway.yml to map 443 to all of the exposed internal ports, like this:
services:
go-marscredit:
build: .
ports:
- "443:80"
- "443:443"
- "443:8545"
- "443:8546"
- "443:30303"
NODE_ID: "node1"
a year ago
My bad, I didn't notice you had a file named railway.yml before.
Railway does not and has never supported a railway.yml file or anything with a syntax as you have shown, please do not ask AI for Railway configs.
All config with the magic ports needs to be solely through the UI in the service settings.
Similarly, the EXPOSE keyword in your Dockerfile does absolutely nothing on this platform.
a year ago
AI is my coding assistant, and only going to get better, so prob gonna keep happening with other devs.
If it does nothing, then how does railway know which ports to expose? See below file:
Attachments
a year ago
AI is my coding assistant, and only going to get better, so prob gonna keep happening with other devs.
You are not the first and you won't be the last, But at this time AI doesn't know enough about Railway to write you correct configs all the time, so for your own sake, please do not use AI to write your configs, ask the community instead!
If it does nothing, then how does railway know which ports to expose?
By the Railway magic, aka by looking at what ports have an http service listening on them, it's dynamically detected.
a year ago
My bad, I didn't notice you had a file named railway.yml before.
Railway does not and has never supported a railway.yml file or anything with a syntax as you have shown, please do not ask AI for Railway configs.
All config with the magic ports needs to be solely through the UI in the service settings.
Similarly, the EXPOSE keyword in your Dockerfile does absolutely nothing on this platform.
Thanks Brody! This is super valuable intel here ^^. You should have a button we can click to flag and then this data can push over to your technical docs. Imagine if the technical docs had a section at the bottom of each page with valuable community info. Would save SO MUCH time. Just a thought.
a year ago
Some docs pages do have a link to a community post -
https://help.railway.app/feedback/public-networking-8be1a5c2
But that docs page has no mention of magic ports since this feature is so new.
a year ago
RESOLVED. Server timeout issue.Another random issue:
We setup external TCP to map to an internal port to test, and it was working perfectly externally, but then when we enabled Private Networking, it stopped working externally. Connections just time out. So, we disabled Private Networking, but still no go.
`roundhouse.proxy.rlwy.net:50590 => :30304`
a year ago
While private networking is disabled, If you removed the TCP proxy and added it back, does it work again?
If so, enable the private network again, does it break it again?