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?



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 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.


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.


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.)

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?


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.