Private networking
Hi! I have 2 Spring Boot apps and try to make them communicate over private networking. Could you please help What I am doing wrong?
My api-gateway can't connect over private network.
api-gateway project id: 08a6b80c-da39-486f-8ba0-ae1777316271
app I try to connect to: bdbdf463-b88a-4345-aa66-c8186c5e9b74
12 Replies
Project ID:
08a6b80c-da39-486f-8ba0-ae1777316271,bdbdf463-b88a-4345-aa66-c8186c5e9b74
@Brody Thanks for the answer. But it didn't really help me tbh. I'm a bit noob in those questions. I would really appreacciate if you could be more detailed. Thanks in advance
you need to run your app on host
::
how to do that for spring, would be something you'd need to consult springs docs for@Brody Figured it out. Thanks a lot.
For any spring bootes: set server.address=:: in env variables for all services and it will work
no problem, and thanks for reporting back the method!
Ah, I got played so bad 😂 I didn't notice envs in my Postman. Basically, I was calling service itself, not via api-gateway. So issue still persists (
postman is a desktop app, you can't call the private domain from your computer
@Brody I know. With Postman I call my api-gateway with public url, api-gateway itself should route to other service via private network
are you running both of these apps on the host
::
?Yes, I do
Do I need to specify port when connecting?
Ok. I found that if we specify port after the internal link which application is running on when it is deployed solves the issue.
But now I have another question is that what if I want to run 3-4 instances of the app. Each of them has it's own port after deploy. How can we solve this issue
OK. Figured out everything. Thanks for the support @Brody . Is there any guides section on the server? I can contribute with guide for spring boot-ers)
I would absolutely love if you could add another code example to this page for spring boot
https://docs.railway.app/troubleshoot/fixing-common-errors
https://github.com/railwayapp/docs/edit/main/src/docs/troubleshoot/fixing-common-errors.md
I think what would be most helpful is if you showed how to get spring boot to listen on the host
::
and the auto generated PORT
variable
(I know the rest of the code examples listen on 0.0.0.0, they will have to be updated)