Is it possible to connect to TCP proxy through private networking?

Hello! Today i deployed a DB (Mysql5.7) on a service and enabled the TCP proxy. I successfully connected to it from my web service. Is it possible to connect to the service through the private networking? Thanks!
21 Replies
Percy
Percy15mo ago
Project ID: 5a24ad58-38fd-44b0-ac79-47f2f1093c71
dwaynemac
dwaynemacOP15mo ago
5a24ad58-38fd-44b0-ac79-47f2f1093c71
Brody
Brody15mo ago
yes it is, as long as you are using the new mysql template it comes with a MYSQL_PRIVATE_URL for you to referance in your own service
dwaynemac
dwaynemacOP15mo ago
i'm using a docker image because i need mysql 5.7 (old version) i wouldnt mind copy-pasting the address instead of referencing a variable
Brody
Brody15mo ago
ideally you would never have to copy / paste within railway
dwaynemac
dwaynemacOP15mo ago
but i tried and couldnt get it to work
Brody
Brody15mo ago
MYSQLDATABASE=${{MYSQL_DATABASE}}
MYSQLHOST=${{RAILWAY_TCP_PROXY_DOMAIN}}
MYSQLPASSWORD=${{MYSQL_ROOT_PASSWORD}}
MYSQLPORT=${{RAILWAY_TCP_PROXY_PORT}}
MYSQLUSER=root
MYSQL_DATABASE=railway
MYSQL_PRIVATE_URL=mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:3306/${{MYSQL_DATABASE}}
MYSQL_ROOT_PASSWORD=<password>
MYSQL_URL=mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{MYSQL_DATABASE}}
MYSQLDATABASE=${{MYSQL_DATABASE}}
MYSQLHOST=${{RAILWAY_TCP_PROXY_DOMAIN}}
MYSQLPASSWORD=${{MYSQL_ROOT_PASSWORD}}
MYSQLPORT=${{RAILWAY_TCP_PROXY_PORT}}
MYSQLUSER=root
MYSQL_DATABASE=railway
MYSQL_PRIVATE_URL=mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:3306/${{MYSQL_DATABASE}}
MYSQL_ROOT_PASSWORD=<password>
MYSQL_URL=mysql://${{MYSQLUSER}}:${{MYSQL_ROOT_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{MYSQL_DATABASE}}
you should just be able to set these in the raw editor for your database deployment and then do the reference in your service
dwaynemac
dwaynemacOP15mo ago
i'm not using the template
Brody
Brody15mo ago
i know, thats why you need to add that stuff yourself
dwaynemac
dwaynemacOP15mo ago
ok does RAILWAY_PRIVATE_DOMAIN contain the private domain on each service then? initialized by railway i'll try this. thank you very much
Brody
Brody15mo ago
yes it does
dwaynemac
dwaynemacOP15mo ago
related question. if i only connect through private networking. can i disable the tcp proxy?
Brody
Brody15mo ago
yes you can there is no proxy stuff going on with the private network
dwaynemac
dwaynemacOP15mo ago
Thanks again
Brody
Brody15mo ago
where you able to connect to the database via the private network?
dwaynemac
dwaynemacOP15mo ago
Cant test it right now. Will do later
Brody
Brody15mo ago
ah okay, please update later then!
dwaynemac
dwaynemacOP15mo ago
after setting up this variables. connecting through MYSQL_URL worked fine but not MYSQL_PRIVATE_URL
Brody
Brody15mo ago
ah gotcha, that makes sense, mysql 6.0+ is probably also setup to listen on ipv6 addresses by default, where as the older mysql version isn't, if that matters to you id be happy to do some tests to see if I could get 5.7 communicating on the private network
dwaynemac
dwaynemacOP15mo ago
ooh, OK! i'm planning to migrate to a newer mysql eventually knowing that private connection IS possible is ok for the moment
Brody
Brody14mo ago
okay I'll get back to you on this in a bit solved in https://discord.com/channels/713503345364697088/1156976345423814826
Want results from more Discord servers?
Add your server