This topic is about syncing Gramps between 2PCs in the same LAN. One is Windows another is Linux.
I read couple of topics where they mention different approaches to that problem, and I’m kinda overwhelmed with the abundance of options and seeking advice.
Some folks in the above threads say to use GRAMPSHOME, some say to use file copy (.gramps for DB, and .dpkg for DB with media), some say to use Nextcloud Files or Syncthing.
It won’t be concurrent work on the Gramps database, only 1 PC at a time. Sometimes I would want to work offline and then merge the changes to the main database, so changes should be propagated into the second PC not to be lost.
Which approach is more applicable to my case? Making GRAMPSHOME on the shared drive accessible from both PC?
Using alternatively two computers to work on a DB is the most difficult case if you want to prevent discrepancies or inconsistencies on the DB.
If I understand correctly, none of the PC is the “primary” one; you use them on an equal basis.
Since exporting and merge-importing a database is quite complicated and the source of potential merge conflicts, I would work with an external storage device I connect to the PCs when needed. Thus you have a single DB and it is obvious it can’t be updated simultaneously because you can plug to a single computer only.
Don’t use a USB flash stick for that: they are not reliable enough. The stick could fry out. Prefer an external disk. Though SSDs are more and more present, try to find a spinning magnetic disk with a slow rotational speed (once again for reliability sake).
Then the GRAMPSHOME trick can be used to point onto your removable disk.
thanks for the advice. And where the media files are stored by default? Should I alter any setting for media to be stored on the external drive, or changing GRAMPSHOME location would be enough for cross-system portability?
According to the code (gramps/gen/const.py), media files are stored in USER_PICTURES which is by default $GRAMPHOME/Pictures. If this directory does not exist, store location falls back to $GRAMPSHOME/gramps.
Consequently, If you did not touch configuration (menu Edit>Preferences), which would override the defaults, notably paths relative to GRAMPSHOME, it should work. There does not seem to be differences between Window$ and Linux. So, if you correctly structure your external drive (creating the Pictures directory inside GRAMPSHOME), it should be possible to share the drive.
Note that I did not test it because I have no W$ computer.
Ultimately, the media path is stored within the database file, not gramps.ini. This allows multiple databases to have the own unique media folder.
More info: The default setting in const.py is used when importing a backup file with media to determine where the media files will be unpacked. First option is the media path set in Preferences, second your OS Pictures folder and if not your Gramps user directory.
Yes. GRAMPSHOME overrides the default location where Gramps would normally create the user directory.
I am on Windows and the normal location Gramps would create the user directory is…
c:\users\%username%\appdata\roaming\
I have set my GRAMPSHOME to…
c:\users\%username%\Genealogy\
My gramps user folder is created here and I manually created my Media folder (and all my other genealogy folders and files) here for one stop access.
Do not be confused. Your database and media folders can be manually changed. It is these two folders that have to be seen by both computers in your scenario. Both computers do not need the same access to all your .ini configuration files, your plugin directories, thumbnail folders, etc. Each computer can run with their own set of these files.
The database folder set in Preferences is stored in the gramps.ini file. The media folder used by the database is stored with the database. Each computer needs to be able to have access to the same folder using the same full directory name.
Thanks. I get your idea. You mean I can set different gramps.ini files for each computer, so they can point out to this same dir on my external drive, but drive can have different letter on each PC.
I figured out how to have two computers use the same media where the media path is NOT STORED in the database allowing each computer to independently point to the media folder.
The caveats! I do not know how or if environment variables can be set in other OS other than Windows. And I do not know if the environment variable can point to a location not on the hard drive. I assume a drive on a LAN can be accessed but what about a cloud storage location??
How it would work:
Create an environment variable GRAMPSMEDIA pointing to the media folder in the same way GRAMPSHOME is created.
The program file \gramps\gen\const.py needs to be hacked.
Change at line 136 (6.0.8)
USER_PICTURES = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES)
if not USER_PICTURES:
USER_PICTURES = USER_DATA
to
if "GRAMPSMEDIA" in os.environ:
USER_PICTURES = get_env_var("GRAMPSMEDIA")
else:
USER_PICTURES = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES)
if not USER_PICTURES:
USER_PICTURES = USER_DATA
Now, if there is no base media path set in Preferences, USER_PICTURES is used.
And actually setting the base media path to a location on the hard drive still works.
One way I dealt with this was was to store the database, media and backups on GoogleDrive. Both computers are writing to the same database and looking at the same media folder. I was using two Chromebooks so I was able to map the drives exactly the same in the Debian container. And I was not using them at the same time. I dropped this strategy when one Chromebook went to Trixie and other couldn’t be upgraded past Bookworm. Wasn’t sure what might happen.