Metabase backup
vvozibic
PROOP

11 days ago

I have an Metabase for Postgress DB, have a lot of questions/dashboards inside Metabase. Can I backup and restore it?

Solved$20 Bounty

14 Replies

Railway
BOT

11 days ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


Status changed to Awaiting Conductor Response ray-chen 11 days ago


vvozibic
PROOP

11 days ago

nope, thats topics are not related with Metabase backup exactly


uxuz
MODERATOR

11 days ago

Hey, since you are using Postgres with Metabase, backing up your Postgres database should be sufficient, at least according to the Metabase docs. Backing up your Postgres database can be done using pg_dump.


Status changed to Awaiting User Response Railway 11 days ago


vvozibic
PROOP

11 days ago

yep, its sufficient, but when I wanna move Metabase, for example in new environment, I lost all of my SQL questions and dashboards, w/o a backup


Status changed to Awaiting Conductor Response Railway 11 days ago


vvozibic

yep, its sufficient, but when I wanna move Metabase, for example in new environment, I lost all of my SQL questions and dashboards, w/o a backup

uxuz
MODERATOR

11 days ago

I suppose that this is because the volume's data of your Postgres database isn't copied over to your newly created environment.


Status changed to Awaiting User Response Railway 11 days ago


vvozibic
PROOP

11 days ago

now it's only theore question, seems like we dont understand each other

first of all, I have a DB postgress and have a backup from the box setup inside railway, all good
second, Metabase over postgress, setup throw railway with docker image https://hub.docker.com/r/metabase/metabase
inside metabase I have a lot of questions/dashboards and dont have an option to export it or backup them? looks like all of question/dashboards exist only in docker container and will disappear if I refresh it

is it true?


Status changed to Awaiting Conductor Response Railway 11 days ago


vvozibic

now it's only theore question, seems like we dont understand each otherfirst of all, I have a DB postgress and have a backup from the box setup inside railway, all goodsecond, Metabase over postgress, setup throw railway with docker image https://hub.docker.com/r/metabase/metabaseinside metabase I have a lot of questions/dashboards and dont have an option to export it or backup them? looks like all of question/dashboards exist only in docker container and will disappear if I refresh itis it true?

bytekeim
PRO

11 days ago

hyy

yeah ur kinda spot on with that Metabase stores all ur questions, dashboards, and stuff in its own app database, not in ur main Postgres DB that's just the data source. If ur running the straight Docker image on Railway without any tweaks, it's probs using the default H2 DB which is just a file inside the container on ephemeral storage. So when u redeploy or "refresh" the service, poof, it's gone cuz Railway wipes that temp storage each time.

To fix this and backup properly:

  • quick backup hack if u can't access files by using Metabase's API to export everything. Log in, grab an API key from Admin > Settings, then hit endpoints like /api/card for questions and /api/dashboard for dashboards. U can script it in Python or whatever to dump to JSON—there's tons of GitHub scripts for this, lmk if u need a link. Then u can import back into a new setup.

  • make it persistent and attach a Railway volume to ur Metabase service. Go to ur project, add a volume, attach it to the service, and set the mount path to /metabase.db. That'll save the H2 file across redeploys. But honestly, H2 sucks for real use—switch to an external Postgres for the app DB.

  • spin up a new Postgres service in Railway (their template makes it easy). Then migrate ur data: Stop ur current Metabase, download the Metabase JAR (same version), run the load-from-h2 command with ur H2 file path and Postgres URI. After that, update ur Metabase env vars like MB_DB_TYPE=postgres, MB_DB_HOST=ur-new-db-host, etc., and redeploy. Ur stuff will stick around, and u can backup the Postgres normally with pg_dump or Railway's tools.

  • moving to new env , Export via API or dump the DB, then import/dump into the new one's DB. If ur using volumes or external DB, just copy the volume data or DB dump over.

This should save u from losing dashboards again. test it on a duplicate service first tho. Hit me up if u need more helpp


vvozibic

now it's only theore question, seems like we dont understand each otherfirst of all, I have a DB postgress and have a backup from the box setup inside railway, all goodsecond, Metabase over postgress, setup throw railway with docker image https://hub.docker.com/r/metabase/metabaseinside metabase I have a lot of questions/dashboards and dont have an option to export it or backup them? looks like all of question/dashboards exist only in docker container and will disappear if I refresh itis it true?

uxuz
MODERATOR

11 days ago

Hey, first of all, everything should already be answered by the Metabase documentation I have linked above.

The Metabase template on Railway uses the Postgres database to store all of its data. So backing the Postgres database will backup all of your questions and so on. Again, this is explained in the first paragraph of the documentation I have linked above.

The Metabase service itself doesn't have any persistent data, as it doesn't have a volume.


Status changed to Awaiting User Response Railway 11 days ago


vvozibic
PROOP

10 days ago

@uxuz looks like you wrong, cause @bytekeim have an right answer


Status changed to Awaiting Conductor Response Railway 10 days ago


vvozibic
PROOP

10 days ago

hmm, I saw an answer from @bytekeim and then its disappear, strange


bytekeim
PRO

10 days ago

@vvozibic did you figure out who to fix the issue


vvozibic

hmm, I saw an answer from @bytekeim and then its disappear, strange

uxuz
MODERATOR

10 days ago

Hey, bytekeim was suspended during the period and has now been unbanned. I'll give them the benefit of doubt and mark their message above as the solution and reward them the bounty. Their original response is also attached below for future references: Image

Attachments


Status changed to Awaiting User Response Railway 10 days ago


Status changed to Solved uxuz 10 days ago


bytekeim

@vvozibic did you figure out who to fix the issue

vvozibic
PROOP

10 days ago

thanks, I tried to fetch cards from Metabase API, all good
I'll try to setup your proposal later, thanks a lot!


Status changed to Awaiting Conductor Response Railway 10 days ago


Status changed to Solved vvozibic 10 days ago


vvozibic
PROOP

10 days ago

step to migrate from Metabase template without volume to Metabase with Postgress

if you have an old template Metabse w/o volume – you use H2 database inside Docker and disappear all of you data when Docker redeployed

first of all you need a create a dump of H2 from Metabase, I created it throw SSH connect via railway cli targz and export to local machine
second, I tried a variant with docker migrate, but java works better, u need to have a metabase.jar in local machine and metabase.db.mv.db / metabase.db.trace.db files from archived DB dump
third, just run java -jar metabase.jar \ load-from-h2 "$(pwd)/metabase.db/metabase.db"


Status changed to Awaiting Conductor Response Railway 10 days ago


Status changed to Solved vvozibic 10 days ago


Loading...