Export/import database

Hi,
I have installed baserow in my pre-production cluster and create some tables in a database.
I’m using docker images baserow:1.10

I now install basrow in my production environment and want to migrate database from preproduction to production

I tried to export each tables and import them in the production baserow but table field are lost (type , fk …)

I tried to copy data from /baserow/date but the container failed to start

How to migrate database from one cluster to another ?

Hi @come, since you are self-hosting, you can leverage internal Baserow commands to import & export applications (databases) of a workspace.

So let’s say that your original workspace has id=60, then you could export as:

django-admin export_workspace_applications 60

And import on the new instance as:

django-admin import_workspace_applications 70 workspace_60

The workspace_60 is the name of the export, this would be the default name. 70 would be a workspace id of the new workspace on the new instance. You would need to transfer this file from the old to the new Baserow instance.

These commands are DJango commands, hence why they are called through django-admin (or manage.py file).

These commands can be run from backend containers in the docker-compose setup, not sure from top of my head if this will work out of the box in the single Docker image.

1 Like

See Install with Docker // Baserow for a guide on how to do this with the baserow/baserow:XYZ docker image (the single one Petrs refers to above in his solution).

Thanks for your reponses

How can I find the id of my workspace ?

I tried to run the command but I have this exception with root:

Traceback (most recent call last):
File “/baserow/backend/src/baserow/manage.py”, line 40, in
main()
File “/baserow/backend/src/baserow/manage.py”, line 36, in main
execute_from_command_line(sys.argv)
File “/baserow/venv/lib/python3.7/site-packages/django/core/management/init.py”, line 419, in execute_from_command_line
utility.execute()
File “/baserow/venv/lib/python3.7/site-packages/django/core/management/init.py”, line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/baserow/venv/lib/python3.7/site-packages/django/core/management/base.py”, line 354, in run_from_argv
self.execute(*args, **cmd_options)
File “/baserow/venv/lib/python3.7/site-packages/django/core/management/base.py”, line 398, in execute
output = self.handle(*args, **options)
File “/baserow/backend/src/baserow/core/management/commands/export_workspace_applications.py”, line 55, in handle
with open(files_path, “wb”) as files_buffer:
PermissionError: [Errno 13] Permission denied: ‘/group_11.zip’

May I have a response ?

Can you provide the exact details of the exact command you ran and how you ran it? From the looks of your error whatever command you are running cannot write out to that location. Even if running as root on your host OS, file permissions and users are different inside docker containers: docker file permissions - Google Zoeken .

Here is my command in the baserow container root user, folder /

./baserow.sh backend-cmd manage export_workspace_applications 1

I don’t know how to get my workspace id ?

It’s weird I can create a file by touching in this folder with root user, why baserow.sh can’t ?