Update backup.md

Further information, backup using import/export.
This commit is contained in:
nough 2022-07-08 09:19:48 +01:00 committed by GitHub
parent be6bb5f039
commit c86ff27bef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,7 +31,7 @@ The filenames consist of `<random uuid4>_<recipe_id>`. In case you screw up real
The standard docker build of tandoor uses postgresql as the back end database. This can be backed up using a function called "dumpall". This generates a .SQL file containing a list of commands for a postgresql server to use to rebuild your database. You will also need to back up the media files separately. The standard docker build of tandoor uses postgresql as the back end database. This can be backed up using a function called "dumpall". This generates a .SQL file containing a list of commands for a postgresql server to use to rebuild your database. You will also need to back up the media files separately.
Making a full copy of the docker directory can work as a back up, but only if you know you will be using the same hardware, os, and postgresql version upon restore. If not, then the different version of postgresql won't be compatible with the existing tables. Making a full copy of the docker directory can work as a back up, but only if you know you will be using the same hardware, os, and postgresql version upon restore. If not, then the different version of postgresql won't be compatible with the existing tables.
You can back up from docker even when the tandoor container is failing, so long as the postgresql database has started successfully. You can back up from docker even when the tandoor container is failing, so long as the postgresql database has started successfully. When using this backup method, ensure that your recipes have imported successfully. One user reported only the titles and images importing on first try, requiring a second run of the import command.
the following commands assume that your docker-compose files are in a folder called "docker". replace "docker_db_recipes_1" with the name of your db container. The commands also assume you use a backup name of pgdump.sql. It's a good idea to include a date in this filename, so that successive backups do not get deleted. the following commands assume that your docker-compose files are in a folder called "docker". replace "docker_db_recipes_1" with the name of your db container. The commands also assume you use a backup name of pgdump.sql. It's a good idea to include a date in this filename, so that successive backups do not get deleted.
To back up: To back up:
@ -47,3 +47,12 @@ cat pgdump.sql | sudo docker exec -i docker_db_recipes_1 psql postgres -U django
``` ```
This connects to the postgres table instead of the actual dgangodb table, as the import function needs to delete the table, which can't be dropped off you're connected to it. This connects to the postgres table instead of the actual dgangodb table, as the import function needs to delete the table, which can't be dropped off you're connected to it.
## Backup using export and import
You can now export recipes from Tandoor using the export function. This method requires a working web interface.
1. Click on a recipe
2. Click on the three meatballs then export
3. Select the all recipes toggle and then export. This should download a zip file.
Import:
Go to Import > from app > tandoor and select the zip file you want to import from.