Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

vkryukov/roam-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Roam Research offline graph backup

This tool backs up one or few local Roam Research graphs. You can run it periodically using cron etc. to perform regular backups of your graph.

Since it's a version 0.1, it assumes that you are using Google Chrome on Mac OS. It should be fairly trivial to make it more generic, but I have neither desire nor ability to test it in multiple configurations, although patches are welcome.

Installation

  1. Download roam_backup.py and place it somewhere by navigating to the desired folder and executing the following command:
    curl -O https://raw.githubusercontent.com/vkryukov/roam-backup/master/roam_backup.py
    
  2. Install Selenium Chrome driver with brew cask install chromedriver
  3. Install selenium python package with pip3 install selenium --user
  4. Run python3 roam_backup.py -h to see the help message.

Usage

usage: roam_backup.py [-h] [--debug] [--timeout TIMEOUT] [--json] local_graph backup_dir

Backup local Roam database.

positional arguments:
  local_graph        name of the local graph
  backup_dir         folder to place backup files

optional arguments:
  -h, --help         show this help message and exit
  --debug            show the browser and pause after each step
  --timeout TIMEOUT  max timeout for each action
  --json             export JSON file

Scheduling backup

To schedule backups on macOS, you can use a launchd.plist generator. E.g. if you put the script in /Users/vkryukov, and want to backup a local database test into /Users/vkryukov/roam-backups every 15 minutes, you should populate the following fields:

  • Name: Roam offline backup
  • Command: /usr/local/bin/python3 /Users/vkryukov/roam_backup.py test /Users/vkryukov/roam-backup
  • Minute: */15

Leave all the other fields blank.

Important. After the file is created, you will need to also specify the working directory. By default, the working directory is /, and unless you change it, chromedriver won't be able to download any files. You can set it to your home directory or /tmp. It's also convenient to setup stderr and stdout logs, e.g.:

    <key>StandardOutPath</key>
    <string>/Users/vkryukov/launchd.stdout.log</string>
    <key>StandardErrorPath</key>
    <string>/Users/vkryukov/launchd.stderr.log</string>
    <key>WorkingDirectory</key>
    <string>/Users/vkryukov</string>

You can modify the example to suit your needs.

About

Backup local Roam files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages