R
Railway6mo ago
met

Data sync between environments

I have an app which is made up of an Elysia API and a postgres DB. I have a prod and staging env setup. I faced a bit of a weird issue where I was using my app in the prod environment which included changes in the prod environment. However, the weird thing is these changes reflected in the staging environment. I am using internal DB urls and there are as follows: Prod env - postgresql://PROD_USER_HERE:PROD_PASSWORD_HERE@postgres.railway.internal:5432/railway Staging env - postgresql://STAGING_USER_HERE:STAGING_PASSWORD_HERE@postgres.railway.internal:5432/railway I am wondering if this is the right approach or if i should be using external URLs for each environment? Any advice is appreciated
8 Replies
Percy
Percy6mo ago
Project ID: b6238b67-1449-4085-9111-5da192d6ede2
met
met6mo ago
b6238b67-1449-4085-9111-5da192d6ede2
Brody
Brody6mo ago
the weird thing is these changes reflected in the staging environment
what changes?
met
met6mo ago
new rows added to the DB
Brody
Brody6mo ago
interesting, there is a private network for each environment within a project, aka the private network is isolated from one environment to another. i have seen an issue very similar to this, their issue was that they where hardcoding the public url somewhere so that no matter the environment the app would always request the same url
met
met6mo ago
Thats what I figured. My URLs are definitely not hardcoded anywhere but its possible i was on staging when i thought i was on prod. If i notice anything again I will open a new thread.
Brody
Brody6mo ago
sounds good, and yes you should be using the private urls whenever possible, its both faster and you are not charged for any egrees over the private network
met
met6mo ago
perfect