3 months 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
3 months 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
3 months 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 • 3 months ago
3 months ago
This did not solve my issue. Seriously!
Status changed to Awaiting Railway Response Railway • 3 months ago
Status changed to Open Railway • 3 months ago
3 months ago
Could you clarify? Are you looking to 'import' the data of the main environment to your PR environment?
3 months 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
3 months 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
3 months ago
that is what I understand. But that seems like insanity!
3 months 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…
3 months 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 • 2 months ago
