Copy Postgres service to other environment & DB management

3 months ago

Loving Railway so far. I'm actually also considering moving from a different managed database (Neon) to a Postgres instance within the Railway environment. I currently have three environments: dev, test, and production. I've tested out my application in the dev environment using a local Postgres service, and it works great. Is there a way to copy the entire Postgres service & its contents into the test environment? Or do I need to set it up from scratch like I did with the initial dev setup?

From the docs, I also read at the bottom that Postgres services in Railway "are considered unmanaged, meaning you have total control over their configuration and maintenance". My interpretation is that it's basically the same as running my own DB in a VPS, and I'm on the hook for backups and availability — but since Railway offers both backups and HA, I should be safe in those regards right?

Anyways, just trying to do some research before I pull the trigger on changing up my DB hosting 🙂

Project ID: b292c479-b6ff-45de-ab65-8751f6e479a7

Solved

0 Replies

3 months ago

Hello!

We don't offer a way sync data between environments, but you can sync a service between environments with the Sync button at the top right, and that is the preferable way to do it vs manually deploying test-* or dev-* databases into the environments as you have done, but either way, syncing postgres data would have to be done with pgdump and pgrestore.

And yes hosting a database on Railway is similar to hosting it yourself on a VPS, but on Railway we run Postgres with an image in a container, we manage the container itself, but we don't manage the postgres database as Neon would, so no HA, though we do offer backups and backup schedules, but thats limited to the Pro plan.

Hope this helps!


3 months ago

Thanks Brody!


3 months ago

If you have any more questions feel free to ask!


3 months ago

I actually do! I feel like the more research I do, the more uncertain I get. <:cryingman:786867299553378324>

Is Railway recommended for a production database? Or is the recommended use-case by Railway to perhaps use them for lower-level environments but not in production? I'm aware of the backups feature and the HA limitations, but is there any guidance out there recommending not to use Railway for a production database? Are there any stats on companies that do use Railway for production? I'm just wondering if I'm approaching the use-case here the wrong way or not.


3 months ago

We have many large companies with terabytes of data in Postgres databases hosted on Railway without issues, so they are absolutely fit for production, it's more so a question of if they are a fit for you specifically, personally, I wouldn't use 3rd party databases, sure they may offer some flashy features, but then we would have to charge you egress for that outbound traffic, and that also means your 3rd party database wont be in the same data center so you would suffer a latency penalty as well.


3 months ago

Makes sense, thanks for the reassurance & info. I can definitely see myself upgrading to the Pro plan soon to make use of database backups and go all-in on Railway for this application.

I've noticed you in the threads here all day helping out everyone. You're awesome and thank you Brody!


3 months ago

Well I do work for Railway haha and this is my preferred way of helping the users!


3 months ago

So thank you for the kind words!


3 months ago

!s


Status changed to Solved brody 3 months ago


Copy Postgres service to other environment & DB management - Railway Help Station