a month ago
Hey,
Am a bit confused!
Is there a way to have the postgres and redis of main env availbe in pr enviroment automaticaly?
Pinned Solution
a month ago
Unless you use the public URLs, you won't be able to use private networking to access services in other environments.
You can create shared variables containing public URLs of your databases from your project settings, then in the PR environment configurations, set the base environment to the environment with the shared variables.
https://docs.railway.com/variables#shared-variables
Attachments
8 Replies
a month ago
PR environments are fully isolated, so each one spins up its own instances of all services in the project, including Postgres and Redis, with fresh empty volumes and regenerated credentials. There is no built-in setting to automatically share the production database services with PR environments. If you want your PR environment app services to connect to the production databases instead of the ephemeral ones, you would need to manually override the connection variables (e.g. DATABASE_URL, REDIS_URL) in those PR environments to point to the production instances.
Status changed to Awaiting User Response Railway • 29 days ago
a month ago
This did not solve my issue. Seriously!
Status changed to Awaiting Railway Response Railway • 29 days ago
Status changed to Open Railway • 29 days ago
a month ago
Could you clarify? Are you looking to 'import' the data of the main environment to your PR environment?
a month ago
Just have a solid set of env bars that point to the main env db and redis etc
moshetanzer
Just have a solid set of env bars that point to the main env db and redis etc
a month ago
Unless you use the public URLs, you won't be able to use private networking to access services in other environments.
You can create shared variables containing public URLs of your databases from your project settings, then in the PR environment configurations, set the base environment to the environment with the shared variables.
https://docs.railway.com/variables#shared-variables
Attachments
a month ago
that is what I understand. But that seems like insanity!
a month ago
What seems like insanity…? It makes sense that services in other environments don’t have access to other services in a different environment via private networking. It’s in a different environment for a reason. You don’t want to accidentally break a production database…
a month ago
that is a users choice. A rc web app will never break production 😂 - if it does the problem is not the cloud. The same way I can set a public url - railway should offer a private url. Not sure what you are even saying 🤔
Status changed to Solved 0x5b62656e5d • 7 days ago
