5 months ago
Hey
Please see the attached screenshot of my project.
Everything is working fine, and both docker containers ("m..." and "fo...") sucessfully connect to the MySQL container, both using the internal DB route (mysql.railway.internal)
I didn't do anything different afaik during set up and deployment of these two containers, but only one ("m...") has the cute dashed connection link to the MySQL container.
I have no idea how/what caused that connection link between "m..." and MySQL to show up in the first placea - other than preusming it's automatic because the "m..." container is actively sending requests to the MySQL container (...but, so is the "f..." container...)
So, I'm wondering why the other one doesn't and how I can fix this.
But, I'm also aware nothing seems to be broken without it, so I guess this is more curiosity (unless I'm missing something).
Sorry if this is a bit vague and waffly.
Cheers
Attachments
4 Replies
5 months ago
If its working then nothings broken, its just some variable was referenced (thats why its showing broken lines or a connection) "${{MySQL.DB_URL}}" to "m..." but hardcoded in "fo.."
Im not sure if theres an existing documentation for the connection lines, groupings, and components but this might help you
https://docs.railway.com/guides/private-networking#using-reference-variables
https://docs.railway.com/guides/variables
5 months ago
The links are established when you reference another container's variables.
Let's say you have a foo service which needs to talk to MySQL, you can set DATABASE_URL on foo 2 ways and they are both valid,
1. Read the value from mysql service and set it to be that in app, kind of like hardcoding it. Doing it this way will not create any links between these 2 services but they will work just the same.
2. You set the DATABASE_URL to be ${{MySQL.DATABASE_URL}}, this way the variable is dynamic and referencing the MySQL service. Anytime the DATABASE_URL on MySQL service change, the variable on foo service will change too. This is recommended and will create a nice dashed link on the UI showing foo service is dependent on MySQL service. I believe there are also other benefits like deployment order (not 100% sure).
4 months ago
Hey rjbathgate, Did my answer clear up your concerns ?
4 months ago
Yes, thanks (and sorry for the lack of follow up earlier!)
Status changed to Solved chandrika • 4 months ago