TandoorRecipes / recipes

Application for managing recipes, planning meals, building shopping lists and much much more!
https://docs.tandoor.dev
Other
5.14k stars 550 forks source link

Webinterface Backup Export/Import #79

Open therealschimmi opened 4 years ago

therealschimmi commented 4 years ago

Can you include some option to export all recipes or even everything into one zip file?

vabene1111 commented 4 years ago

in what format would you like such a feature ?

right now you can easily export the whole database using pg_dump or alternativley by creating django fixtures python manage.py dumpdata cookbook. Both of these options are nice to create backups but are probably of not much use if you want to import into any other kind of recipe manager. I would really love to have compatability with other managers but that sadly isn't an easy task to do (see #19)

therealschimmi commented 4 years ago

I dont care about compatibility too much. I would just like to have a backup in case i screw up something with Docker and lose all content. Just make it accessible from the webinterface :)

vabene1111 commented 4 years ago

Ok, a web based backup interface it is! I think this can and will be done but it proably wont be the biggest priority since there are many good options that already work pretty well on the command line.

In the meantime you can try this script i personally use for my backups https://github.com/vabene1111/DockerPostgresBackups but be aware that its not really polished/edge case proof

vabene1111 commented 4 years ago

maybe https://github.com/django-dbbackup/django-dbbackup can be used in combination with #103 and a custom interface to configure/download/restore

vabene1111 commented 3 years ago

while django-dbbackup in combination with https://github.com/timonweb/django-dbbackup-ui looks really good it appears to be full of bugs where people are having all kinds of problems different databases, special characters in the DB and storage backends.

Need to find a better solution as reliability is the number one priority when it comes to backups ...

vabene1111 commented 3 years ago

ok so i have decided to implement backups using djangos dumpdata and loaddata commands.

thickconfusion commented 2 years ago

Just wanted to drop by and say this thread was helpful for the following: I just migrated Tandoor from an armv71 docker host to an arm64 docker host. In general it's easy to move bind and volume mounts by carefully stopping the containers, gzipping their volumes, moving to the new host, and firing back up.

However, encountered a strange issue. Because of the architecture change, Postgre (db_recipes) was giving me a strange error:

FATAL:  database files are incompatible with server
DETAIL:  The database cluster was initialized without USE_FLOAT8_BYVAL but the server was compiled with USE_FLOAT8_BYVAL.
HINT:  It looks like you need to recompile or initdb.
LOG:  database system is shut down

So I ended up using a form of this https://github.com/vabene1111/DockerPostgresBackups to create a dump, then restore it on the new machine. Voila!

vabene1111 commented 2 years ago

awesome, database migration is always easiest with dumps because it is independet of the version and environment and even if it is you can just change text to get it working. Glad it helped

mikhail5555 commented 2 years ago

Sorry for bumping this old issue, but would a python manage.py dumpdata followed by a python manage.py loaddata work when you want to migrate from a sqlite database to a postgresql database (or is there better approach)?

vabene1111 commented 2 years ago

that is likely one of the best appraoches but make sure to properly test it before deleting the old DB. There are several foreign relations across the database and loaddata might have a hard time handeling those.

I know there is an old discussion from someone who did exactly what you are planning to do, maybe that helps you.

mikhail5555 commented 2 years ago

that is likely one of the best appraoches but make sure to properly test it before deleting the old DB. There are several foreign relations across the database and loaddata might have a hard time handeling those.

I know there is an old discussion from someone who did exactly what you are planning to do, maybe that helps you.

Thanks, i will attempt to find that discussion, i guess i must have missed it. I will also make a small write up once I (successfully) do so, so hopefully other people would also be able to do it.

Szeraax commented 1 year ago

I just successfully exported all my recipes to a zip file via web interface and was able to import them. Is there still any work to be done on this issue? Or are we good to close it?

vabene1111 commented 1 year ago

yes, the recipes are not a real backup because there are supermarkets, food metadata, autoamtions an much more that should also be included in a real backup. This is planned at some point

gruhland commented 8 months ago

Sorry to add a new comment to this thread. I just updated my docker installation. Then I tried to export ALL recipes. The information window shows the progress of the export but I get no automatic download. The text on the page shows immediately "If download did not start automatically: Herunterladen (Expired)" where download (Herunterladen) is crossed out. If I try to export only one recipe it is no problem. Any idea? Regards Goetz

smilerz commented 8 months ago

Sorry to add a new comment to this thread. I just updated my docker installation. Then I tried to export ALL recipes. The information window shows the progress of the export but I get no automatic download. The text on the page shows immediately "If download did not start automatically: Herunterladen (Expired)" where download (Herunterladen) is crossed out. If I try to export only one recipe it is no problem. Any idea? Regards Goetz

it should be fixed in the next release - in the meantime, if you hit refresh it will frequently start the download.

gruhland commented 8 months ago

Thanks, I will try :-)