Backup of work to .gramps and gpkg on Gramps Web

I’m running the Gramps Web with the docker option described on the documentation.

Is there a “suggested method” to produce backups from this configuration?
I would like to be able to set something like a cronob to run on periodically (maybe once a day) and maybe with file rotation (so that I can keep track of the last 3 o 4 backups). Ideally I would like to be able to export in both formats: .gramps and .gpkg

is that possible to acheive?

Thanks

Jorhe

In my simplified dimension, it’d be wonderful to see .gramps form fall back to just being a plain text XML file with no compression.

And .gpkg be the compressed version that would contain a .gramps plain text XML file of the same basename, a README.md about the archive and an optional Media folder. And, if Gramps was having problems restoring, simply renaming the Media folder would make that portion be ignored by the Import.

The timed-backup was just recently implemented in the desktop fork. Because of the improvements sitting in the queue, I have opted to not use it until 5.2 is released. Instead, the backup upon exit is a more efficient use of resources.

Dunno if the timed-backed feature is enabled in GrampsWeb. But you probably wouldn’t want to use it until there’s the 24 hour interval and dirty-flag (don’t waste resources doing a backup if unchanged) features implemented.

And for GrampsWeb, a scheduled backup would better than a timed one. I don’t recall seeing that as a feature request.

Hi,

I was indeed looking for a scheduled backup. So far my usecase is to give access to Gramps for me and my children. So I do have a known schedule that noone would be using the app to the backup. If that scheduled backup is not available, I can make a cronjob to do it but I couldn’t find a command line to do an export/backup of the database.
I could do the rotation myself and the rotation is just in case something bad happend on the last backup to have another fallback option.
The other problem I would have is supposing that there is a command line to do the backup, I have gramps on docker containers, the cronjob would be running outside the container. how can I run a script outside the container making calls inside a container?

Regading the file format, at this time I don’t have an opinion on it. When I did the backup I’m using I did both formats .gramps and .gpkg just in case. I imported the .gramps (because that was the format the web supported) and it worked. I think I have tried to openned it with 7zip and it was a XML in the end.

Jorge

1 Like

Here are the command line options for export. You could export to gramps-xml or gpkg, depending on whether you want to back up your media separately.

Disregard – I was thinking of the desktop version, not the server version, sorry!

1 Like

I wonder if CLI commands for the desktop fork of Gramps will work on the server? (Perhaps they require that another instance of Gramps isn’t running. That situation might not be easy to predict on the server.)

@DavidMStraub
Is there a cronjob compatible command that can be used to archive the Tree & another for the longer process of archiving of the Tree plus media?

Failing that, do you plan to have a Schedule-compatible feature planned for the Automatic backup preference?

Hi,

exporting .gramps is already easily possible from the web interface. What is not possible (intentionally) is exporting a .gpkg, i.e. XML + media. This is because the Gramps .gpkg export plugin was not designed with server security in mind, so it will happily export “media files” with a path pointing to /etc/passwd, for instance. Moreover, it anyway wouldn’t work with media files not hosted locally, which is preferable for larger deployments.

When you are in control of the server and using local media files, you could of course just use rsync or indeed run an export on the command line (which is possible), but the real solution is to implement a “download all media files” feature that avoids the issues described above. This is tracked in this issue: Support instance migration · Issue #371 · gramps-project/gramps-webapi · GitHub

I will also add a “backup” section to the user documentation site.

The feature to export all media files is now available in the development version.

3 Likes

If I recall correctly, the media filenames and path are changed during upload.

The meaningful filenaming and folder structures a user might employ for organization in the wilds of a desktop fork are boiled down and replaced with a simple unique identifer system and folder structure. The need for this is undeniable.

But I’m wondering about how to make these backups sync friendly with the desktop fork? Does Gramps Web archive the old filename & paths when setting up the server version. It seems like that would be neeeded for the sync tool.

If I accidentally trash a subdirectory of my desktop Media files, it would be nice to be able to restore them from a Gramps Web backup. But it will probably be impossible to find that content. Or if you restore the Grambs Web media to the local fork, you will likely have 100% duplicates with disimilar names in a consolidated folder substructure.

If the original media filenames & paths are remembered, perhaps the Gramps Web media backup could include a crosswalking manifest? A list in CSV with at least 5 columns: the media object handle ( or Gramps ID?), the server filename, the server filepath, the desktop filename, the desktop filepath.

This wouldn’t eliminate the issue but there would be enough info to attack specific parts.

It’s a bit involved, let me elaborate.

Let’s assume we have two media files with relative paths: FamilyPics/Bach/JohannSebastian.jpg was added on desktop, 128ecf542a35ac5270a87dc740918404.jpg was uploaded on the web. The desktop media directory is /home/jsbach/media/gramps, on the server it’s /app/media/.

This will lead to the following file structure on the server (assuming we are not using the new multi-tree setup):

/app/media/FamilyPics/Bach/JohannSebastian.jpg
/app/media/128ecf542a35ac5270a87dc740918404.jpg

On desktop, it will sync to:

/home/jsbach/media/gramps/FamilyPics/Bach/JohannSebastian.jpg
/home/jsbach/media/gramps/128ecf542a35ac5270a87dc740918404.jpg

and when downloading a media archive ZIP (new feature), it will contain:

FamilyPics/Bach/JohannSebastian.jpg
128ecf542a35ac5270a87dc740918404.jpg

When using media on S3, files are stored with their hashes, so there will only be the following objects:

s3://some-bucket/8f45bc0c88a6585e27e0cc00a195d936
s3://some-bucket/128ecf542a35ac5270a87dc740918404

However, when syncing or downloading a ZIP, the behaviour will be the same as for “local files”. So, yes, you can restore the files including the directory structure when you accidentally delete them on desktop.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.