a year ago
This is a followup/extension of this question:
https://help.railway.app/questions/django-project-django-db-utils-operatio-d7b1fdf3
The workaround presented works for me as well, but it is hiding an issue that I still need to solve for other things. For example, when I run the railway CLI and connect to a shell in django, I need the database connection to work. It does not resolve the "fake" postgres URL though. Why is it that the DNS spoofing of that URL works in the "web" container, but does not work in the "release" container or a one off shell? I guess I could flip to the publicly visible IP instead, but that is problematic for two reasons. 1) It is less secure to open the DB up to the internet. 2) Traffic would be charged egress fees.
I use heroku for my enterprise SaaS in my day job, but really like some of what you are doing. I hope this issue can be fixed (and you should post the solution online, because I've found at least 3 other people complain about the same thing).
Thanks!
ⓘ Deployment information is only viewable by project members and Railway employees.
3 Replies
a year ago
It is not a fake postgres URL, it is an internal domain that only the containers inside of the project can resolve and connect to, aka a private network.
Locally, you can not connect to a domain within the private network so you must use the public host and port.
a year ago
Ah - coming from the Heroku world I had a different mental model of how things were run. I assumed that when you ran a "release" you were running it on a container that was considered part of my project. And similar for the CLI, I assumed that it was spinning up a container in my project and relaying the input/output to my screen. I should have realized this wasn't the case when there wasn't any spin-up time. Is it possible to spin up a single use container that is configured with the same code base and environment variables as my main Django web service? I do something like this interactively all the time, connected to a Django shell (python manage.py shell). Thanks for the quick response.
a year ago
We don't have any mechanism to spin up a container on demand, at this time, both railway run and railway shell run commands locally with the linked services variables available.
We are going to be looking into SSH access, likely similar to how heroku does it, and a way to proxy local requests to the private domains into the private network in the project.