teable icon indicating copy to clipboard operation
teable copied to clipboard

Documentation for backup and importing complete instance - Docker

Open nicholas-mn opened this issue 1 year ago • 5 comments

Is your feature request related to a problem? Please describe. There is no documentation on how to backup and importing the complete database. For people like me with limited experience experience with databases, this would be priceless when doing backups and migrations.

There seems to be a page in the documentation mentioning backup, but it's left empty: https://help.teable.io/deployment/migrating-from-docker-standalone-to-teable-enterprise#id-1.-backup-your-data

Describe the solution you'd like

  1. Step-by-step instructions on how to backup the complete teable instance when self-hosting with Docker.
  2. Step-by-step instructions on how to import the data to a new instance/machine.

Or even better, a ready-made export/import script.

Describe alternatives you've considered At the moment, I backup the complete volumes and zip them up for backups. I don't think this is the most optimal way to do it - please correct me if I am wrong.

Additional context The reason for me creating this issue, is that I tried to add redis cache to my current docker-compose.yml. I first copied the entire folder with docker-compose.yml, .env, volume folders to another folder and added redis cache to docker-compose.yml.

When I ran docker compose up -d and tried to visit the teable instance in the browser, the database was wiped clean, which I couldn't debug (I lack the technical skills at the moment). Other than this, the instance seemed to work fine.

nicholas-mn avatar Oct 25 '24 10:10 nicholas-mn

Guide from docker how to backup volumes: https://docs.docker.com/engine/storage/volumes/#back-up-restore-or-migrate-data-volumes

LLM answer

Replace placeholders with values from your .env file or Docker setup.

Backup

  1. Identify the PostgreSQL container:
    docker ps
    
  2. Create a backup:
    docker exec -t <postgres_container_name> pg_dump -U ${POSTGRES_USER} ${POSTGRES_DB} > backup.sql
    

Restore

  1. Stop the Teable app:
    docker compose down
    
  2. Restore the backup:
    cat backup.sql | docker exec -i <postgres_container_name> psql -U ${POSTGRES_USER} ${POSTGRES_DB}
    
  3. Restart Teable:
    docker compose up -d
    

kpodp0ra avatar Dec 28 '24 20:12 kpodp0ra

It would be ideal to be able to restore containers and volumes or whatever is necessary to be able to migrate an existing teable.io installation.

neurohost avatar Jan 24 '25 22:01 neurohost

You can export data from teable.io to CSV and import them to your local instance.

kpodp0ra avatar Jan 27 '25 03:01 kpodp0ra

You can export data from teable.io to CSV and import them to your local instance.

I have found the CSV import slightly unreliable if the data has special characters. I think it messes up if a field has a comma in it.

nicholas-mn avatar Jan 28 '25 14:01 nicholas-mn

psql -U ${POSTGRES_USER} ${POSTGRES_DB}

Hello, what is the username and db name? how to find this info? Thank you

lepidas avatar Mar 08 '25 06:03 lepidas